Fail early when source id is wrong

This commit is contained in:
Eike Kettner
2020-08-08 18:42:48 +02:00
parent 8b73331409
commit 43946ed347
2 changed files with 20 additions and 5 deletions

View File

@ -8,7 +8,7 @@ import docspell.backend.PasswordCrypt
import docspell.backend.ops.OCollective._
import docspell.common._
import docspell.store.queries.QCollective
import docspell.store.records.{RCollective, RContact, RUser}
import docspell.store.records._
import docspell.store.{AddResult, Store}
trait OCollective[F[_]] {
@ -41,6 +41,8 @@ trait OCollective[F[_]] {
kind: Option[ContactKind]
): Stream[F, RContact]
def findSource(sourceId: Ident): F[Option[RSource]]
}
object OCollective {
@ -156,5 +158,7 @@ object OCollective {
): Stream[F, RContact] =
store.transact(QCollective.getContacts(collective, query, kind))
def findSource(sourceId: Ident): F[Option[RSource]] =
store.transact(RSource.find(sourceId))
})
}