add /api/tournament/:id/teams API endpoint for team battles - for #6756
parent
d48056fd79
commit
b280646bf4
|
@ -259,6 +259,22 @@ final class Api(
|
|||
}
|
||||
}
|
||||
|
||||
def tournamentTeams(id: String) =
|
||||
Action.async { implicit req =>
|
||||
env.tournament.tournamentRepo byId id flatMap {
|
||||
_ ?? { tour =>
|
||||
env.tournament.jsonView.getTeamStanding(tour) map { arr =>
|
||||
JsonOk(
|
||||
Json.obj(
|
||||
"id" -> tour.id,
|
||||
"teams" -> arr
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def tournamentsByOwner(name: String) =
|
||||
Action.async { implicit req =>
|
||||
implicit val lang = reqLang
|
||||
|
|
|
@ -554,6 +554,7 @@ GET /api/tournament controllers.Api.currentTournaments
|
|||
GET /api/tournament/:id controllers.Api.tournament(id: String)
|
||||
GET /api/tournament/:id/games controllers.Api.tournamentGames(id: String)
|
||||
GET /api/tournament/:id/results controllers.Api.tournamentResults(id: String)
|
||||
GET /api/tournament/:id/teams controllers.Api.tournamentTeams(id: String)
|
||||
POST /api/tournament controllers.Tournament.apiCreate
|
||||
POST /api/swiss/new/:teamId controllers.Swiss.apiCreate(teamId: String)
|
||||
GET /api/swiss/:id/games controllers.Api.swissGames(id: String)
|
||||
|
|
|
@ -367,7 +367,7 @@ final class JsonView(
|
|||
}
|
||||
}
|
||||
|
||||
private def getTeamStanding(tour: Tournament): Fu[Option[JsArray]] =
|
||||
def getTeamStanding(tour: Tournament): Fu[Option[JsArray]] =
|
||||
tour.isTeamBattle ?? {
|
||||
teamStandingCache get tour.id dmap some
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue