Scala Found Unit Expected Future[Result]

Viewed 41
def update() = AuthAction.async(parse.json) { implicit request =>

  val list = request.body.asInstanceOf[JsArray].value

  list.foreach( mapping => {
      repository.update()
  }.andThen {
    case Success(value) => repository.update2()
    case Failure(exception) => {
    BadRequest(errorResponse(Json.toJson(""), "updation failed"))
  }
 })

}

I have a controller function where I want to wait for a DB repo function ( repository.update2() )to complete and then send a response, but its saying "Found Unit expected Future[Result]"

0 Answers
Related