Skip to content

Commit

Permalink
Service endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
RawToast committed Mar 10, 2018
1 parent 6d3e883 commit 95042fd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dokusho-server/src/main/scala/dokusho/MongoService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ class MongoService(mongoRepository: MongoRepository) {
json = userReadingHistory.asJson
response <- Ok(json)
} yield response
case GET -> Root / "history" / "safe" / userId =>
for {
userReadingHistory <- mongoRepository.get(userId)
json: Option[Json] = userReadingHistory.map(_.asJson)
resp <- json.fold(NotFound())(j => Ok(j))
} yield resp
case req@PUT -> Root / "history" / userId =>
implicit val userDecoder: EntityDecoder[IO, ReadingHistory] = jsonOf[IO, ReadingHistory]
for {
Expand Down

0 comments on commit 95042fd

Please sign in to comment.