Merge pull request #1328 from eikek/fix-routes

Reordered some routes due to a change in http4s
This commit is contained in:
mergify[bot] 2022-01-29 17:49:46 +00:00 committed by GitHub
commit f23d19afb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 29 deletions

View File

@ -30,6 +30,13 @@ object CollectiveRoutes {
import dsl._
HttpRoutes.of {
case GET -> Root =>
for {
collDb <- backend.collective.find(user.account.collective)
coll = collDb.map(c => Collective(c.id, c.state, c.created))
resp <- coll.toResponse()
} yield resp
case GET -> Root / "insights" =>
for {
ins <- backend.collective.insights(user.account.collective)
@ -122,13 +129,6 @@ object CollectiveRoutes {
)
resp <- Ok(BasicResult(true, "Task submitted"))
} yield resp
case GET -> Root =>
for {
collDb <- backend.collective.find(user.account.collective)
coll = collDb.map(c => Collective(c.id, c.state, c.created))
resp <- coll.toResponse()
} yield resp
}
}

View File

@ -38,6 +38,13 @@ object NotifyDueItemsRoutes extends MailAddressCodec with NonEmptyListSupport {
import dsl._
HttpRoutes.of {
case GET -> Root =>
ut.getNotifyDueItems(UserTaskScope(user.account))
.evalMap(task => taskToSettings(backend, task))
.compile
.toVector
.flatMap(Ok(_))
case GET -> Root / Ident(id) =>
(for {
task <- ut.findNotifyDueItems(id, UserTaskScope(user.account))
@ -94,13 +101,6 @@ object NotifyDueItemsRoutes extends MailAddressCodec with NonEmptyListSupport {
.map(Conversions.basicResult(_, "Saved successfully."))
resp <- Ok(res)
} yield resp
case GET -> Root =>
ut.getNotifyDueItems(UserTaskScope(user.account))
.evalMap(task => taskToSettings(backend, task))
.compile
.toVector
.flatMap(Ok(_))
}
}

View File

@ -38,7 +38,14 @@ object PeriodicQueryRoutes extends MailAddressCodec with NonEmptyListSupport {
val ut = backend.userTask
import dsl._
HttpRoutes.of {
HttpRoutes.strict {
case GET -> Root =>
ut.getPeriodicQuery(UserTaskScope(user.account))
.evalMap(task => taskToSettings(task))
.compile
.toVector
.flatMap(Ok(_))
case GET -> Root / Ident(id) =>
(for {
task <- ut.findPeriodicQuery(id, UserTaskScope(user.account))
@ -96,12 +103,6 @@ object PeriodicQueryRoutes extends MailAddressCodec with NonEmptyListSupport {
resp <- Ok(res)
} yield resp
case GET -> Root =>
ut.getPeriodicQuery(UserTaskScope(user.account))
.evalMap(task => taskToSettings(task))
.compile
.toVector
.flatMap(Ok(_))
}
}

View File

@ -33,6 +33,14 @@ object ScanMailboxRoutes {
import dsl._
HttpRoutes.of {
case GET -> Root =>
ut.getScanMailbox(UserTaskScope(user.account))
.evalMap(task => taskToSettings(user.account, backend, task))
.compile
.toVector
.map(v => ScanMailboxSettingsList(v.toList))
.flatMap(Ok(_))
case GET -> Root / Ident(id) =>
(for {
task <- ut.findScanMailbox(id, UserTaskScope(user.account))
@ -89,14 +97,6 @@ object ScanMailboxRoutes {
.map(Conversions.basicResult(_, "Saved successfully."))
resp <- Ok(res)
} yield resp
case GET -> Root =>
ut.getScanMailbox(UserTaskScope(user.account))
.evalMap(task => taskToSettings(user.account, backend, task))
.compile
.toVector
.map(v => ScanMailboxSettingsList(v.toList))
.flatMap(Ok(_))
}
}