Add logic to set due date from addons, based on #2362

Signed-off-by: martin f. krafft <madduck@madduck.net>
This commit is contained in:
martin f. krafft 2023-11-12 11:00:35 +01:00
parent f6cb97119b
commit 750be99aaf
3 changed files with 13 additions and 0 deletions

View File

@ -127,6 +127,12 @@ private[backend] class BackendCommands[F[_]: Sync](
itemOps
.setItemDate(Nel.of(item), date.some, collective)
.void
case ItemAction.SetDueDate(duedate) =>
logger.debug(s"Set due date $duedate on item ${item.id} for $collective") *>
itemOps
.setItemDueDate(Nel.of(item), duedate, collective)
.void
}
def runAttachAction(

View File

@ -105,4 +105,10 @@ object ItemAction {
implicit val jsonDecoder: Decoder[SetDate] = deriveDecoder
implicit val jsonEncoder: Encoder[SetDate] = deriveEncoder
}
case class SetDueDate(duedate: Option[Timestamp]) extends ItemAction
object SetDueDate {
implicit val jsonDecoder: Decoder[SetDueDate] = deriveDecoder
implicit val jsonEncoder: Encoder[SetDueDate] = deriveEncoder
}
}

View File

@ -21,6 +21,7 @@ object AddonOutputExample extends Helper {
ItemAction.ReplaceTags(Set("tagX", "tagY")),
ItemAction.RemoveTags(Set("tag0", "tag9")),
ItemAction.RemoveTagsCategory(Set("doc-type")),
ItemAction.SetDueDate(Some(Timestamp.ofMillis(1707908400000L))),
ItemAction.SetFolder("folder-name".some),
ItemAction.SetCorrOrg(id("OaIy-org-ID").some),
ItemAction.SetCorrPerson(id("OaIy-person-ID").some),