Merge pull request #2379 from madduck/addon-due-dates

Add logic to set due date from addons, based on #2362
This commit is contained in:
eikek 2023-11-15 11:41:37 +01:00 committed by GitHub
commit 1cd517bf4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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),