diff --git a/modules/restserver/src/main/scala/docspell/restserver/conv/AddonValidationSupport.scala b/modules/restserver/src/main/scala/docspell/restserver/conv/AddonValidationSupport.scala index dd2351b8..2ae9872f 100644 --- a/modules/restserver/src/main/scala/docspell/restserver/conv/AddonValidationSupport.scala +++ b/modules/restserver/src/main/scala/docspell/restserver/conv/AddonValidationSupport.scala @@ -7,11 +7,10 @@ package docspell.restserver.conv import cats.syntax.all._ - import docspell.addons.AddonMeta import docspell.backend.ops.AddonValidationError import docspell.backend.ops.OAddons.AddonValidationResult -import docspell.common.Ident +import docspell.common.CollectiveId import docspell.restserver.ws.{OutputEvent, OutputEventEncoder} import docspell.store.records.RAddonArchive @@ -51,7 +50,7 @@ trait AddonValidationSupport { } def addonResultOutputEventEncoder( - collective: Ident + collective: CollectiveId ): OutputEventEncoder[AddonValidationResult[(RAddonArchive, AddonMeta)]] = OutputEventEncoder.instance { case Right((archive, _)) => diff --git a/modules/restserver/src/main/scala/docspell/restserver/routes/AddonArchiveRoutes.scala b/modules/restserver/src/main/scala/docspell/restserver/routes/AddonArchiveRoutes.scala index 6995ebb8..637b6763 100644 --- a/modules/restserver/src/main/scala/docspell/restserver/routes/AddonArchiveRoutes.scala +++ b/modules/restserver/src/main/scala/docspell/restserver/routes/AddonArchiveRoutes.scala @@ -34,7 +34,7 @@ object AddonArchiveRoutes extends AddonValidationSupport { ): HttpRoutes[F] = { val dsl = new Http4sDsl[F] {} import dsl._ - implicit val wsOutputEnc = addonResultOutputEventEncoder(token.account.collective) + implicit val wsOutputEnc = addonResultOutputEventEncoder(token.account.collectiveId) HttpRoutes.of { case GET -> Root => diff --git a/modules/restserver/src/main/scala/docspell/restserver/ws/OutputEvent.scala b/modules/restserver/src/main/scala/docspell/restserver/ws/OutputEvent.scala index f41dd5de..42fb3e7d 100644 --- a/modules/restserver/src/main/scala/docspell/restserver/ws/OutputEvent.scala +++ b/modules/restserver/src/main/scala/docspell/restserver/ws/OutputEvent.scala @@ -34,7 +34,7 @@ object OutputEvent { final case class JobSubmitted(group: Ident, task: Ident) extends OutputEvent { def forCollective(token: AuthToken): Boolean = - token.account.collective == group + token.account.collectiveId.valueAsIdent == group def asJson: Json = Msg("job-submitted", task).asJson @@ -47,7 +47,7 @@ object OutputEvent { result: Option[Json] ) extends OutputEvent { def forCollective(token: AuthToken): Boolean = - token.account.collective == group + token.account.collectiveId.valueAsIdent == group def asJson: Json = Msg( @@ -56,23 +56,23 @@ object OutputEvent { ).asJson } - final case class JobsWaiting(collective: Ident, count: Int) extends OutputEvent { + final case class JobsWaiting(collective: CollectiveId, count: Int) extends OutputEvent { def forCollective(token: AuthToken): Boolean = - token.account.collective == collective + token.account.collectiveId == collective def asJson: Json = Msg("jobs-waiting", count).asJson } final case class AddonInstalled( - collective: Ident, + collective: CollectiveId, message: String, error: Option[AddonValidationError], addonId: Option[Ident], originalUrl: Option[LenientUri] ) extends OutputEvent { def forCollective(token: AuthToken) = - token.account.collective == collective + token.account.collectiveId == collective override def asJson = Msg( diff --git a/modules/restserver/src/main/scala/docspell/restserver/ws/WebSocketRoutes.scala b/modules/restserver/src/main/scala/docspell/restserver/ws/WebSocketRoutes.scala index 42ba54b2..44bb2229 100644 --- a/modules/restserver/src/main/scala/docspell/restserver/ws/WebSocketRoutes.scala +++ b/modules/restserver/src/main/scala/docspell/restserver/ws/WebSocketRoutes.scala @@ -34,7 +34,7 @@ object WebSocketRoutes { val init = for { jc <- backend.job.getUnfinishedJobCount(UserTaskScope(user.account)) - msg = OutputEvent.JobsWaiting(user.account.collective, jc) + msg = OutputEvent.JobsWaiting(user.account.collectiveId, jc) } yield Text(msg.encode) val toClient: Stream[F, WebSocketFrame.Text] =