-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: GameService.endGame() 리팩토링 (#304)
* refactor: game 도메인 패키지와 gaemResult 도메인 패키지 분리 * refactor: Game.endGame() 메서드 Game이 갖는 상태에 대해서만 처리하도록 변경 - ResultType, 즉 성공 실패 여부는 Game이 알 요소가 아니므로 메서드 내에서 계산하는 부분 삭제 * refactor: Game.endGame() 메서드 Game이 갖는 상태에 대해서만 처리하도록 변경 - ResultType, 즉 성공 실패 여부는 Game이 알 요소가 아니므로 메서드 내에서 계산하는 부분 삭제 * refactor: GameFinishService 게임 결과 생성하는 서비스 인터페이스 추가 및 GameResultService로 결과 생성하는 로직 구현 * refactor: PlayerService에 점수 더하는 로직 추가 * refactor: 서비스 메서드에 대한 NoRollbackFor 제거 후 새로운 트랜잭션 열어서 횟수 차감하는 서비스 로직 추가 * fix: NoRollbackFor 원복 * refactor: endGame() 메서드의 동작 분리 * chore: GameResultService 패키지 변경 * refactor: GameManageService 도메인 서비스 생성 * refactor: GameManageService 도메인 서비스 삭제하고 메서드 도메인으로 넣음 * refactor: Game 시도횟수 줄일 때 검증 추가 * test: GameTest endGame 관련 테스트 추가 * test: GameResultService 테스트 추가 * test: PlayerService 점수 추가 로직 테스트 추가 * test: GameServiceTest 게임 종료 로직 테스트 추가 * chore: 워크플로우 수정 * chore: 워크플로우 수정 * chore: 테스트 통과하도록 수정 * chore: game과 gameresult 패키지의 persistence 패키지를 repository로 변경 * chore: setDone() 메서드 네이밍 변경 * chore: 컨벤션으로 메서드 호출 순서대로 메서드 명시 * refactor: 종료되지 않은 게임에 대한 에러를 GameException으로 변경 * refactor: endGame 메서드 진행중 게임 검증을 제일 처음에 진행하도록 변경 * refactor: findPlayerById 재활용하도록 수정
- Loading branch information
1 parent
db72134
commit da3d959
Showing
38 changed files
with
596 additions
and
260 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
8 changes: 8 additions & 0 deletions
8
backend/src/main/java/com/now/naaga/game/application/GameFinishService.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,8 @@ | ||
package com.now.naaga.game.application; | ||
|
||
import com.now.naaga.game.application.dto.CreateGameResultCommand; | ||
|
||
public interface GameFinishService { | ||
|
||
void createGameResult(final CreateGameResultCommand createGameResultCommand); | ||
} |
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
13 changes: 13 additions & 0 deletions
13
backend/src/main/java/com/now/naaga/game/application/dto/CreateGameResultCommand.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,13 @@ | ||
package com.now.naaga.game.application.dto; | ||
|
||
import com.now.naaga.game.domain.EndType; | ||
import com.now.naaga.game.domain.Game; | ||
import com.now.naaga.place.domain.Position; | ||
import com.now.naaga.player.domain.Player; | ||
|
||
// TODO: 8/31/23 player -> ID / game -> game -> ID | ||
public record CreateGameResultCommand(Player player, | ||
Game game, | ||
Position position, | ||
EndType endType) { | ||
} |
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
7 changes: 0 additions & 7 deletions
7
backend/src/main/java/com/now/naaga/game/domain/ResultType.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.