Merge pull request #2362 from v6ak/feature/2345-setting-item-date-from-addons

Setting item date from addons (#2345)
This commit is contained in:
eikek 2023-11-07 17:52:18 +01:00 committed by GitHub
commit 69602527b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

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

View File

@ -6,7 +6,7 @@
package docspell.common.bc
import docspell.common.Ident
import docspell.common.{Ident, Timestamp}
import io.circe.generic.extras.Configuration
import io.circe.generic.extras.semiauto.{deriveConfiguredDecoder, deriveConfiguredEncoder}
@ -99,4 +99,10 @@ object ItemAction {
implicit val jsonDecoder: Decoder[ItemAction] = deriveConfiguredDecoder
implicit val jsonEncoder: Encoder[ItemAction] = deriveConfiguredEncoder
case class SetDate(date: Timestamp) extends ItemAction
object SetDate {
implicit val jsonDecoder: Decoder[SetDate] = deriveDecoder
implicit val jsonEncoder: Encoder[SetDate] = deriveEncoder
}
}