Update channel names when retrieving user tasks

Usertasks hold their arguments in an opaque json structure that is not
connected to the other data at the db level. When loading tasks that
holds references (like channels) they could have changed in the
meantime. This is now a hacky way around that updates the channels
when loading. Should they be deleted, the tasks fails when running.
This commit is contained in:
eikek
2022-01-30 17:09:52 +01:00
parent 0097d2bc73
commit 14a413e787
10 changed files with 102 additions and 15 deletions

View File

@ -6,6 +6,7 @@
package docspell.notification.api
import cats.Order
import cats.data.{NonEmptyList => Nel}
import io.circe.Decoder
@ -43,4 +44,7 @@ object ChannelType {
Decoder.decodeString.emap(fromString)
implicit val jsonEncoder: Encoder[ChannelType] =
Encoder.encodeString.contramap(_.name)
implicit val order: Order[ChannelType] =
Order.by(_.name)
}