mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Migrate background task to new collective id
This commit is contained in:
@ -14,7 +14,7 @@ import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder}
|
||||
import io.circe.syntax._
|
||||
import io.circe.{Decoder, Encoder}
|
||||
|
||||
/** This is the input to the `FileCopyTask`. The task copies all files from on
|
||||
/** This is the input to the `FileCopyTask`. The task copies all files from one
|
||||
* FileRepository to one ore more target repositories.
|
||||
*
|
||||
* If no `from` is given, the default file repository is used. For targets, a list of ids
|
||||
|
@ -17,9 +17,10 @@ object FileKeyPart {
|
||||
|
||||
case object Empty extends FileKeyPart
|
||||
|
||||
final case class Collective(collective: Ident) extends FileKeyPart
|
||||
final case class Collective(collective: CollectiveId) extends FileKeyPart
|
||||
|
||||
final case class Category(collective: Ident, category: FileCategory) extends FileKeyPart
|
||||
final case class Category(collective: CollectiveId, category: FileCategory)
|
||||
extends FileKeyPart
|
||||
|
||||
final case class Key(key: FileKey) extends FileKeyPart
|
||||
|
||||
@ -37,7 +38,7 @@ object FileKeyPart {
|
||||
implicit val jsonDecoder: Decoder[FileKeyPart] =
|
||||
Decoder.instance { cursor =>
|
||||
for {
|
||||
cid <- cursor.getOrElse[Option[Ident]]("collective")(None)
|
||||
cid <- cursor.getOrElse[Option[CollectiveId]]("collective")(None)
|
||||
cat <- cursor.getOrElse[Option[FileCategory]]("category")(None)
|
||||
emptyObj = cursor.keys.exists(_.isEmpty)
|
||||
|
||||
|
@ -15,9 +15,7 @@ trait StringSyntax {
|
||||
Option(s).filter(_.trim.nonEmpty)
|
||||
|
||||
def parseJsonAs[A](implicit d: Decoder[A]): Either[Throwable, A] =
|
||||
for {
|
||||
json <- parser.decode[A](s)
|
||||
} yield json
|
||||
parser.decode[A](s)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user