Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ru.metahouse.prices.api.v1
- import akka.http.scaladsl.server.Directives._
- import akka.http.scaladsl.server.{RequestContext, Route}
- import ru.metahouse.commons.frontend.HttpUtils._
- import ru.metahouse.prices.HttpService
- import ru.metahouse.prices.model.Photo
- import scala.concurrent.ExecutionContext
- trait PhotosRoute {
- this: HttpService =>
- val photos: Route = pathPrefix("photos") {
- path("add") {
- post {
- extractExecutionContext { implicit ec: ExecutionContext =>
- extractRequestContext { rc: RequestContext =>
- val request = rc.request.entity.convertTo[Photo]
- val msg = if (request.value.isDefined) StatusCodes.OK else StatusCodes.InternalServerError
- complete(msg)
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement