mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Refactoring some code into separate files
This commit is contained in:
@ -2,7 +2,7 @@ package docspell.joex.notify
|
||||
|
||||
import docspell.common._
|
||||
import docspell.joex.notify.YamuscaConverter._
|
||||
import docspell.store.queries.QItem
|
||||
import docspell.store.queries.ListItem
|
||||
|
||||
import yamusca.implicits._
|
||||
import yamusca.imports._
|
||||
@ -19,7 +19,7 @@ case class MailContext(
|
||||
object MailContext {
|
||||
|
||||
def from(
|
||||
items: Vector[QItem.ListItem],
|
||||
items: Vector[ListItem],
|
||||
max: Int,
|
||||
account: AccountId,
|
||||
itemBaseUri: Option[LenientUri],
|
||||
@ -46,7 +46,7 @@ object MailContext {
|
||||
|
||||
object ItemData {
|
||||
|
||||
def apply(now: Timestamp)(i: QItem.ListItem): ItemData = {
|
||||
def apply(now: Timestamp)(i: ListItem): ItemData = {
|
||||
val dueIn = i.dueDate.map(dt => Timestamp.daysBetween(now, dt))
|
||||
val dueInLabel = dueIn.map {
|
||||
case 0 => "**today**"
|
||||
|
@ -3,14 +3,12 @@ package docspell.joex.notify
|
||||
import cats.data.OptionT
|
||||
import cats.effect._
|
||||
import cats.implicits._
|
||||
|
||||
import docspell.backend.ops.OItemSearch.Batch
|
||||
import docspell.backend.ops.OItemSearch.{Batch, ListItem, Query}
|
||||
import docspell.common._
|
||||
import docspell.joex.mail.EmilHeader
|
||||
import docspell.joex.scheduler.{Context, Task}
|
||||
import docspell.store.queries.QItem
|
||||
import docspell.store.records._
|
||||
|
||||
import emil._
|
||||
import emil.builder._
|
||||
import emil.javamail.syntax._
|
||||
@ -66,11 +64,11 @@ object NotifyDueItemsTask {
|
||||
mail <- OptionT.liftF(makeMail(sendCfg, cfg, ctx.args, items))
|
||||
} yield mail
|
||||
|
||||
def findItems[F[_]: Sync](ctx: Context[F, Args]): F[Vector[QItem.ListItem]] =
|
||||
def findItems[F[_]: Sync](ctx: Context[F, Args]): F[Vector[ListItem]] =
|
||||
for {
|
||||
now <- Timestamp.current[F]
|
||||
q =
|
||||
QItem.Query
|
||||
Query
|
||||
.empty(ctx.args.account)
|
||||
.copy(
|
||||
states = ItemState.validStates.toList,
|
||||
@ -91,7 +89,7 @@ object NotifyDueItemsTask {
|
||||
sendCfg: MailSendConfig,
|
||||
cfg: RUserEmail,
|
||||
args: Args,
|
||||
items: Vector[QItem.ListItem]
|
||||
items: Vector[ListItem]
|
||||
): F[Mail[F]] =
|
||||
Timestamp.current[F].map { now =>
|
||||
val templateCtx =
|
||||
|
Reference in New Issue
Block a user