mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-21 18:08:25 +00:00
Allow simple search when listing meta data
This commit is contained in:
@ -19,9 +19,10 @@ object EquipmentRoutes {
|
||||
import dsl._
|
||||
|
||||
HttpRoutes.of {
|
||||
case GET -> Root =>
|
||||
case req @ GET -> Root =>
|
||||
val q = req.params.get("q").map(_.trim).filter(_.nonEmpty)
|
||||
for {
|
||||
data <- backend.equipment.findAll(user.account)
|
||||
data <- backend.equipment.findAll(user.account, q)
|
||||
resp <- Ok(EquipmentList(data.map(mkEquipment).toList))
|
||||
} yield resp
|
||||
|
||||
|
@ -20,15 +20,16 @@ object OrganizationRoutes {
|
||||
import dsl._
|
||||
|
||||
HttpRoutes.of {
|
||||
case GET -> Root :? FullQueryParamMatcher(full) =>
|
||||
case req @ GET -> Root :? FullQueryParamMatcher(full) =>
|
||||
val q = req.params.get("q").map(_.trim).filter(_.nonEmpty)
|
||||
if (full.getOrElse(false)) {
|
||||
for {
|
||||
data <- backend.organization.findAllOrg(user.account)
|
||||
data <- backend.organization.findAllOrg(user.account, q)
|
||||
resp <- Ok(OrganizationList(data.map(mkOrg).toList))
|
||||
} yield resp
|
||||
} else {
|
||||
for {
|
||||
data <- backend.organization.findAllOrgRefs(user.account)
|
||||
data <- backend.organization.findAllOrgRefs(user.account, q)
|
||||
resp <- Ok(ReferenceList(data.map(mkIdName).toList))
|
||||
} yield resp
|
||||
}
|
||||
|
@ -23,15 +23,16 @@ object PersonRoutes {
|
||||
import dsl._
|
||||
|
||||
HttpRoutes.of {
|
||||
case GET -> Root :? FullQueryParamMatcher(full) =>
|
||||
case req @ GET -> Root :? FullQueryParamMatcher(full) =>
|
||||
val q = req.params.get("q").map(_.trim).filter(_.nonEmpty)
|
||||
if (full.getOrElse(false)) {
|
||||
for {
|
||||
data <- backend.organization.findAllPerson(user.account)
|
||||
data <- backend.organization.findAllPerson(user.account, q)
|
||||
resp <- Ok(PersonList(data.map(mkPerson).toList))
|
||||
} yield resp
|
||||
} else {
|
||||
for {
|
||||
data <- backend.organization.findAllPersonRefs(user.account)
|
||||
data <- backend.organization.findAllPersonRefs(user.account, q)
|
||||
resp <- Ok(ReferenceList(data.map(mkIdName).toList))
|
||||
} yield resp
|
||||
}
|
||||
|
@ -20,9 +20,10 @@ object TagRoutes {
|
||||
import dsl._
|
||||
|
||||
HttpRoutes.of {
|
||||
case GET -> Root =>
|
||||
case req @ GET -> Root =>
|
||||
val q = req.params.get("q").map(_.trim).filter(_.nonEmpty)
|
||||
for {
|
||||
all <- backend.tag.findAll(user.account)
|
||||
all <- backend.tag.findAll(user.account, q)
|
||||
resp <- Ok(TagList(all.size, all.map(mkTag).toList))
|
||||
} yield resp
|
||||
|
||||
|
Reference in New Issue
Block a user