Skip to content

Commit

Permalink
#53 refactor: 게임 생성 controller -> restController
Browse files Browse the repository at this point in the history
  • Loading branch information
dbwp031 committed Oct 16, 2023
1 parent 09f95ae commit b24e976
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,6 @@ public String renderWorldcupMembers(@PathVariable Long worldcupId,
* */
@GetMapping("/{worldcupId}/game/new")
public String renderGameSettingPage() {
// List<Integer> roundTypes = worldcupService.getRoundTypes(worldcupId);
// String worldcupTitle = worldcupService.getTitle(worldcupId);
// modelMap.addAttribute("worldcupId", worldcupId);
// modelMap.addAttribute("worldcupTitle", worldcupTitle);
// modelMap.addAttribute("roundTypes", roundTypes);
return "game/setting";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,26 +60,10 @@ public ResponseEntity<WorldcupResponseDto.RoundTypesDto> getRoundTypes(@PathVari
}

@PostMapping("/{worldcupId}/game")
public ResponseEntity<Map<String, Long>> createGame(@PathVariable Long worldcupId,
@RequestParam Long initRound,
@AuthUser UserAccount userAccount) {

public ResponseEntity<Map<String, Long>> createGame(@PathVariable Long worldcupId, @RequestParam Long initRound, @AuthUser UserAccount userAccount) {
Game game = gameService.createGame(userAccount.getId(), worldcupId, initRound, PickType.ORDER);
Map<String, Long> responseMap = new HashMap<>();
System.out.println("GAME");
System.out.println(game.getId());
responseMap.put("gameId", game.getId());

return new ResponseEntity<>(responseMap, HttpStatus.OK);
}
}


// @GetMapping("/{worldcupId}/game/new/round/{round}")
// public String createGame(@PathVariable Long worldcupId,
// @PathVariable(value = "round") Long initialRound,
// Authentication authentication) {
// JwtAuthentication jwtAuthentication = (JwtAuthentication) authentication;
// Game game = gameService.createGame(jwtAuthentication.getPrincipalDetails().getId(), worldcupId, initialRound, PickType.ORDER);
// return String.format("redirect:/game/%d", game.getId());
// }
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static WorldcupResponseDto.MembersDto toWorldcupResponseMembersDto(Worldc

public static WorldcupResponseDto.GamesDto toWorldcupResponseGamesDto(Worldcup worldcup) {
List<GameResponseDto.ResultDto> games = staticGameService.findGamesByWorldcupId(worldcup.getId()).stream()
.filter(g -> g.getCurrentRoundType().equals(RoundType.ROUND1) && g.getCurrentRoundOrder().equals(g.getNextStageEndRoundOrder()))
.filter(g -> g.getCurrentRoundType().equals(RoundType.ROUND2) && g.getCurrentRoundOrder().equals(g.getNextStageEndRoundOrder()))
.map(GameConverter::toGameResponseResultDto)
.toList();
return WorldcupResponseDto.GamesDto.builder()
Expand Down

0 comments on commit b24e976

Please sign in to comment.