def bulkDownloadSummary()

in app/controllers/BulkDownloadController.scala [330:359]


  def bulkDownloadSummary(tokenValue:String, notOnlyRushes:Option[Boolean]) = Action.async {
    val tokenFut = serverTokenDAO.get(tokenValue)
    tokenFut.flatMap({
      case None =>
        Future(Forbidden(GenericErrorResponse("forbidden", "invalid or expired token").asJson))
      case Some(token) =>
        token.associatedId match {
          case None =>
            logger.error(s"Token $tokenValue is invalid, it does not contain a project ID")
            Future(NotFound(GenericErrorResponse("not_found", "Invalid token").asJson))
          case Some(combinedId) =>
            val ids = combinedId.split("\\|")
            val projectId = ids.head
            val vaultId = ids(1)
            logger.debug(s"Combined ID is $combinedId, project ID is $projectId, vault ID is $vaultId")
            withVaultAsync(vaultId) { userInfo =>
              getContent(userInfo, projectId, !notOnlyRushes.getOrElse(false)).map({
                case Right(synopses) =>
                  Result(
                    header = ResponseHeader(200, Map.empty),
                    body = HttpEntity.Strict(ByteString.fromString(outPutSynopses(synopses)), Some("application/ndjson"))
                  )
                case Left(problem) =>
                  logger.warn(s"Could not complete bulk download for token $tokenValue: $problem")
                  BadRequest(GenericErrorResponse("invalid", problem).asJson)
              })
            }
        }
    })
  }