mirror of
https://codeberg.org/beerbrawl/beerbrawl.git
synced 2024-09-23 05:40:51 +02:00
fix(#24): backend: only allow organizer to update ko standings
Signed-off-by: Christoph Heiss <e11907069@student.tuwien.ac.at>
This commit is contained in:
parent
1eb6809620
commit
da28b47fa9
|
@ -1,6 +1,7 @@
|
|||
package at.ac.tuwien.sepr.groupphase.backend.endpoint;
|
||||
|
||||
import java.lang.invoke.MethodHandles;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
@ -36,14 +37,11 @@ public class KoStandingsEndpoint {
|
|||
@PermitAll
|
||||
@GetMapping()
|
||||
@Operation(summary = "Get KO standings for tournament", security = @SecurityRequirement(name = "apiKey"))
|
||||
public KoStandingDto getKoStandingsTree(
|
||||
@PathVariable(name = "id") Long tournamentId,
|
||||
Authentication authentication) {
|
||||
LOG.info("GET api/v1/tournaments/{}/ko-standings", tournamentId);
|
||||
public KoStandingDto getKoStandingsTree(@PathVariable(name = "id") Long tournamentId) {
|
||||
LOG.info("GET /api/v1/tournaments/{}/ko-standings", tournamentId);
|
||||
|
||||
var standings = koStandingsService.getKoStandingsTree(
|
||||
tournamentId);
|
||||
return koStandingsMapper.entityToDto(standings);
|
||||
final var standings = koStandingsService.getKoStandingsTree(tournamentId);
|
||||
return koStandingsMapper.modelToDto(standings);
|
||||
}
|
||||
|
||||
@ResponseStatus(HttpStatus.NO_CONTENT)
|
||||
|
@ -53,14 +51,17 @@ public class KoStandingsEndpoint {
|
|||
public void updateKoStandingDto(
|
||||
@PathVariable(name = "id") Long tournamentId,
|
||||
@PathVariable(name = "standingId") Long standingId,
|
||||
Authentication authentication,
|
||||
@RequestBody KoStandingTeamUpdate updateStandingDto) {
|
||||
LOG.info("GET api/v1/tournaments/{}/ko-standings/{} {}", tournamentId, standingId, updateStandingDto);
|
||||
@RequestBody KoStandingTeamUpdate updateStandingDto,
|
||||
Authentication authentication
|
||||
) {
|
||||
LOG.info("PUT /api/v1/tournaments/{}/ko-standings/{}", tournamentId, standingId);
|
||||
LOG.debug("request body: {}", updateStandingDto);
|
||||
|
||||
koStandingsService.updateKoStandingTeam(
|
||||
authentication.getName(),
|
||||
tournamentId,
|
||||
standingId,
|
||||
updateStandingDto);
|
||||
authentication.getName(),
|
||||
tournamentId,
|
||||
standingId,
|
||||
updateStandingDto
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue