mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 10:28:27 +00:00
Add missing organization/person/equipment routes
This commit is contained in:
@ -11,6 +11,8 @@ trait OEquipment[F[_]] {
|
||||
|
||||
def findAll(account: AccountId, nameQuery: Option[String]): F[Vector[REquipment]]
|
||||
|
||||
def find(account: AccountId, id: Ident): F[Option[REquipment]]
|
||||
|
||||
def add(s: REquipment): F[AddResult]
|
||||
|
||||
def update(s: REquipment): F[AddResult]
|
||||
@ -25,6 +27,9 @@ object OEquipment {
|
||||
def findAll(account: AccountId, nameQuery: Option[String]): F[Vector[REquipment]] =
|
||||
store.transact(REquipment.findAll(account.collective, nameQuery, _.name))
|
||||
|
||||
def find(account: AccountId, id: Ident): F[Option[REquipment]] =
|
||||
store.transact(REquipment.findById(id)).map(_.filter(_.cid == account.collective))
|
||||
|
||||
def add(e: REquipment): F[AddResult] = {
|
||||
def insert = REquipment.insert(e)
|
||||
def exists = REquipment.existsByName(e.cid, e.name)
|
||||
|
@ -11,6 +11,7 @@ import docspell.store.records._
|
||||
|
||||
trait OOrganization[F[_]] {
|
||||
def findAllOrg(account: AccountId, query: Option[String]): F[Vector[OrgAndContacts]]
|
||||
def findOrg(account: AccountId, orgId: Ident): F[Option[OrgAndContacts]]
|
||||
|
||||
def findAllOrgRefs(account: AccountId, nameQuery: Option[String]): F[Vector[IdRef]]
|
||||
|
||||
@ -23,6 +24,8 @@ trait OOrganization[F[_]] {
|
||||
query: Option[String]
|
||||
): F[Vector[PersonAndContacts]]
|
||||
|
||||
def findPerson(account: AccountId, persId: Ident): F[Option[PersonAndContacts]]
|
||||
|
||||
def findAllPersonRefs(account: AccountId, nameQuery: Option[String]): F[Vector[IdRef]]
|
||||
|
||||
def addPerson(s: PersonAndContacts): F[AddResult]
|
||||
@ -53,6 +56,11 @@ object OOrganization {
|
||||
.compile
|
||||
.toVector
|
||||
|
||||
def findOrg(account: AccountId, orgId: Ident): F[Option[OrgAndContacts]] =
|
||||
store
|
||||
.transact(QOrganization.getOrgAndContact(account.collective, orgId))
|
||||
.map(_.map({ case (org, cont) => OrgAndContacts(org, cont) }))
|
||||
|
||||
def findAllOrgRefs(
|
||||
account: AccountId,
|
||||
nameQuery: Option[String]
|
||||
@ -75,6 +83,11 @@ object OOrganization {
|
||||
.compile
|
||||
.toVector
|
||||
|
||||
def findPerson(account: AccountId, persId: Ident): F[Option[PersonAndContacts]] =
|
||||
store
|
||||
.transact(QOrganization.getPersonAndContact(account.collective, persId))
|
||||
.map(_.map({ case (org, cont) => PersonAndContacts(org, cont) }))
|
||||
|
||||
def findAllPersonRefs(
|
||||
account: AccountId,
|
||||
nameQuery: Option[String]
|
||||
|
Reference in New Issue
Block a user