mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-21 18:08:25 +00:00
Server-side stub impl for notify-due-items
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
package docspell.common
|
||||
|
||||
import io.circe._
|
||||
|
||||
case class AccountId(collective: Ident, user: Ident) {
|
||||
|
||||
def asString =
|
||||
@ -32,4 +34,9 @@ object AccountId {
|
||||
|
||||
separated.orElse(Ident.fromString(str).map(id => AccountId(id, id)))
|
||||
}
|
||||
|
||||
implicit val jsonDecoder: Decoder[AccountId] =
|
||||
Decoder.decodeString.emap(parse)
|
||||
implicit val jsonEncoder: Encoder[AccountId] =
|
||||
Encoder.encodeString.contramap(_.asString)
|
||||
}
|
||||
|
@ -0,0 +1,35 @@
|
||||
package docspell.common
|
||||
|
||||
import io.circe._, io.circe.generic.semiauto._
|
||||
import docspell.common.syntax.all._
|
||||
|
||||
/** Arguments to the notification task.
|
||||
*
|
||||
* This tasks queries items with a due date and informs the user via
|
||||
* mail.
|
||||
*
|
||||
* If the structure changes, there must be some database migration to
|
||||
* update or remove the json data of the corresponding task.
|
||||
*/
|
||||
case class NotifyDueItemsArgs(
|
||||
account: AccountId,
|
||||
smtpConnection: Ident,
|
||||
recipients: List[String],
|
||||
remindDays: Int,
|
||||
tagsInclude: List[Ident],
|
||||
tagsExclude: List[Ident]
|
||||
) {}
|
||||
|
||||
object NotifyDueItemsArgs {
|
||||
|
||||
val taskName = Ident.unsafe("notify-due-items")
|
||||
|
||||
implicit val jsonEncoder: Encoder[NotifyDueItemsArgs] =
|
||||
deriveEncoder[NotifyDueItemsArgs]
|
||||
implicit val jsonDecoder: Decoder[NotifyDueItemsArgs] =
|
||||
deriveDecoder[NotifyDueItemsArgs]
|
||||
|
||||
def parse(str: String): Either[Throwable, NotifyDueItemsArgs] =
|
||||
str.parseJsonAs[NotifyDueItemsArgs]
|
||||
|
||||
}
|
Reference in New Issue
Block a user