Migrate background task to new collective id

This commit is contained in:
eikek
2022-08-07 13:13:22 +02:00
parent ae4c49027f
commit 7424a9b2f9
16 changed files with 671 additions and 28 deletions

View File

@ -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

View File

@ -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)

View File

@ -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)
}
}