diff --git a/src/main/java/com/snackgame/server/game/snackgame/biz/controller/SnackgameBizController.kt b/src/main/java/com/snackgame/server/game/snackgame/biz/controller/SnackgameBizController.kt index 71c6181..2acbccd 100644 --- a/src/main/java/com/snackgame/server/game/snackgame/biz/controller/SnackgameBizController.kt +++ b/src/main/java/com/snackgame/server/game/snackgame/biz/controller/SnackgameBizController.kt @@ -64,13 +64,12 @@ class SnackgameBizController( @Authenticated member: Member, @PathVariable sessionId: Long, @RequestBody streaksRequest: StreaksRequest - ): ResponseEntity { + ): ResponseEntity { val game = snackgameBizService.removeStreaks(member.id, sessionId, streaksRequest) - return game.let { - ResponseEntity - .status(HttpStatus.CREATED) - .body(it) - } ?: ResponseEntity.ok().build() + + return ResponseEntity + .status(HttpStatus.OK) + .body(game) } @Operation( diff --git a/src/main/java/com/snackgame/server/game/snackgame/biz/service/SnackgameBizService.kt b/src/main/java/com/snackgame/server/game/snackgame/biz/service/SnackgameBizService.kt index 308bb33..2cc1db2 100644 --- a/src/main/java/com/snackgame/server/game/snackgame/biz/service/SnackgameBizService.kt +++ b/src/main/java/com/snackgame/server/game/snackgame/biz/service/SnackgameBizService.kt @@ -38,15 +38,13 @@ class SnackgameBizService( } @Transactional - fun removeStreaks(memberId: Long, sessionId: Long, streaks: StreaksRequest): SnackgameResponse? { + fun removeStreaks(memberId: Long, sessionId: Long, streaksRequest: StreaksRequest): SnackgameResponse { val game = snackGameBizRepository.getBy(memberId, sessionId) - val previous = game.board - streaks.toStreaks() + streaksRequest.toStreaks() .forEach { game.remove(it) } return SnackgameResponse.of(game) - .takeIf { game.board != previous } } @Transactional diff --git a/src/main/java/com/snackgame/server/game/snackgame/core/controller/SnackgameController.kt b/src/main/java/com/snackgame/server/game/snackgame/core/controller/SnackgameController.kt index 3d01ac3..df49190 100644 --- a/src/main/java/com/snackgame/server/game/snackgame/core/controller/SnackgameController.kt +++ b/src/main/java/com/snackgame/server/game/snackgame/core/controller/SnackgameController.kt @@ -63,13 +63,11 @@ class SnackgameController( @Authenticated member: Member, @PathVariable sessionId: Long, @RequestBody streaksRequest: StreaksRequest - ): ResponseEntity { + ): ResponseEntity { val game = snackgameService.removeStreaks(member.id, sessionId, streaksRequest) - return game.let { - ResponseEntity - .status(HttpStatus.CREATED) - .body(it) - } ?: ResponseEntity.ok().build() + return ResponseEntity + .status(HttpStatus.OK) + .body(game) } @Operation( diff --git a/src/main/java/com/snackgame/server/game/snackgame/core/service/SnackgameService.kt b/src/main/java/com/snackgame/server/game/snackgame/core/service/SnackgameService.kt index 3cab1e5..bacc1a9 100644 --- a/src/main/java/com/snackgame/server/game/snackgame/core/service/SnackgameService.kt +++ b/src/main/java/com/snackgame/server/game/snackgame/core/service/SnackgameService.kt @@ -38,15 +38,13 @@ class SnackgameService( } @Transactional - fun removeStreaks(memberId: Long, sessionId: Long, streaks: StreaksRequest): SnackgameResponse? { + fun removeStreaks(memberId: Long, sessionId: Long, streaksRequest: StreaksRequest): SnackgameResponse { val game = snackGameRepository.getBy(memberId, sessionId) - val previous = game.board - streaks.toStreaks() + streaksRequest.toStreaks() .forEach { game.remove(it) } return SnackgameResponse.of(game) - .takeIf { game.board != previous } } @Transactional