-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat : spring 컨트롤러 작성 * feat : spring 컨트롤러 작성 완료 * refactor : 기존 예외처리 로직 controller에서 service로 이동, 알트 피드백 반영 * fix : 충돌 해결 * style : 자바 컨벤션에 맞도록 코드 수정 * fix : 병합 충돌 해결 * refactor : chess controller view, rest controller 로 분리
- Loading branch information
Showing
48 changed files
with
461 additions
and
329 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/main/java/wooteco/chess/controller/SpringChessRestController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package wooteco.chess.controller; | ||
|
||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import wooteco.chess.service.GameService; | ||
import wooteco.chess.view.dto.requestdto.PositionRequestDto; | ||
import wooteco.chess.view.response.ResponseDto; | ||
|
||
@RestController | ||
@RequestMapping("/chess") | ||
public class SpringChessRestController { | ||
private final GameService gameService; | ||
|
||
public SpringChessRestController(GameService gameService) { | ||
this.gameService = gameService; | ||
} | ||
|
||
@GetMapping("/state") | ||
public ResponseDto findCurrentState() { | ||
return gameService.getCurrentState(); | ||
} | ||
|
||
@PostMapping("/state") | ||
public ResponseDto changeState(@RequestBody String request) { | ||
return gameService.changeState(request); | ||
} | ||
|
||
@GetMapping("/pieces") | ||
public ResponseDto findAllPiecesOnBoard() { | ||
return gameService.findAllPiecesOnBoard(); | ||
} | ||
|
||
@GetMapping("/record") | ||
public ResponseDto calculateScore() { | ||
return gameService.calculateScore(); | ||
} | ||
|
||
@PostMapping("/move") | ||
public ResponseDto move(@RequestBody PositionRequestDto requestDTO) { | ||
return gameService.move(requestDTO); | ||
} | ||
|
||
@GetMapping("/isnotfinish") | ||
public ResponseDto isNotFinish() { | ||
return gameService.isNotFinish(); | ||
} | ||
|
||
@GetMapping("/result") | ||
public ResponseDto findWinner() { | ||
return gameService.getWinner(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.