mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-04-04 10:29:34 +00:00
Setting item date from addons (#2345)
This commit is contained in:
parent
a8b2081acd
commit
6dd30035f3
@ -121,6 +121,12 @@ private[backend] class BackendCommands[F[_]: Sync](
|
|||||||
case ItemAction.SetName(name) =>
|
case ItemAction.SetName(name) =>
|
||||||
logger.debug(s"Set name '$name' on item ${item.id} for $collective") *>
|
logger.debug(s"Set name '$name' on item ${item.id} for $collective") *>
|
||||||
itemOps.setName(item, name, collective).void
|
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(
|
def runAttachAction(
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
package docspell.common.bc
|
package docspell.common.bc
|
||||||
|
|
||||||
import docspell.common.Ident
|
import docspell.common.{Ident, Timestamp}
|
||||||
|
|
||||||
import io.circe.generic.extras.Configuration
|
import io.circe.generic.extras.Configuration
|
||||||
import io.circe.generic.extras.semiauto.{deriveConfiguredDecoder, deriveConfiguredEncoder}
|
import io.circe.generic.extras.semiauto.{deriveConfiguredDecoder, deriveConfiguredEncoder}
|
||||||
@ -99,4 +99,10 @@ object ItemAction {
|
|||||||
|
|
||||||
implicit val jsonDecoder: Decoder[ItemAction] = deriveConfiguredDecoder
|
implicit val jsonDecoder: Decoder[ItemAction] = deriveConfiguredDecoder
|
||||||
implicit val jsonEncoder: Encoder[ItemAction] = deriveConfiguredEncoder
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user