mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-21 18:08:25 +00:00
Allow to only return owning spaces
This commit is contained in:
@ -24,6 +24,8 @@ object QueryParam {
|
||||
|
||||
object FullOpt extends OptionalQueryParamDecoderMatcher[Boolean]("full")
|
||||
|
||||
object OwningOpt extends OptionalQueryParamDecoderMatcher[Boolean]("owning")
|
||||
|
||||
object ContactKindOpt extends OptionalQueryParamDecoderMatcher[ContactKind]("kind")
|
||||
|
||||
object QueryOpt extends OptionalQueryParamDecoderMatcher[QueryString]("q")
|
||||
|
@ -25,9 +25,11 @@ object SpaceRoutes {
|
||||
import dsl._
|
||||
|
||||
HttpRoutes.of {
|
||||
case GET -> Root :? QueryParam.QueryOpt(q) =>
|
||||
case GET -> Root :? QueryParam.QueryOpt(q) :? QueryParam.OwningOpt(owning) =>
|
||||
val login =
|
||||
owning.filter(identity).map(_ => user.account.user)
|
||||
for {
|
||||
all <- backend.space.findAll(user.account.collective, q.map(_.q))
|
||||
all <- backend.space.findAll(user.account.collective, login, q.map(_.q))
|
||||
resp <- Ok(SpaceList(all.map(mkSpace).toList))
|
||||
} yield resp
|
||||
|
||||
|
Reference in New Issue
Block a user