-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat : auth 유효 검증 api 구현 #108
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ public GameStatusResponse findStatus(final String code) { | |
private StatusType checkStatusChanged(final Game game) { | ||
game.setStatsSnapshot(); | ||
final StatusType statusType = game.getStatusType(Clock.systemDefaultZone().millis()); | ||
if (game.isDeleted()){ | ||
if (game.isDeleted()) { | ||
gameRepository.delete(game); | ||
return StatusType.WAIT; | ||
} | ||
|
@@ -81,4 +81,16 @@ public GameResultResponse findResult(final String code) { | |
} | ||
return GameResultResponse.from(game); | ||
} | ||
|
||
public boolean isValid(final String code, final String name) { | ||
Optional<Lobby> lobby = lobbyRepository.findById(code); | ||
if (!lobby.isPresent()) { | ||
return false; | ||
} | ||
Optional<Game> game = gameRepository.findById(code); | ||
if (!game.isPresent()) { | ||
return lobby.get().isParticipantExist(name); | ||
} | ||
return game.get().isPlayerExist(name); | ||
Comment on lines
+91
to
+94
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 역시 개발자는 코드로 이야기하나보네요 ㅋㅋㅋ 이건 이해가 확실히 되네요. |
||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/mafia/mafiatogether/game/application/dto/response/GameExistResponse.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,6 @@ | ||
package mafia.mafiatogether.game.application.dto.response; | ||
|
||
public record GameExistResponse( | ||
boolean valid | ||
) { | ||
} |
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
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
false 조건을
로비 가없을때,
로비에서 게임시작전 플레이어(이름)가 없을때,
게임이 있을때 플레이어(이름)가 없는경우
라고 생각하면되는거지?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ㅇㅇ 맞음
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여러번 번복해서 죄송한데, game exists 라는 네이밍이 개인적으로는 어색한 것 같아요. 사실 로비가 있는것도 게임이 생성된 것이니 괜찮은 것 같기도 하지만 딱 한번에 와닿지는 않는 느낌?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네이밍이라고 하면 api말하시는건가요? 아니면 controller의 isGameExist말하시는 건가요? 저도 하면서 exists보다는 auth의 유효성 검사니까 valid가 더 맞는거 같던데...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@waterricecake
feat : exist 네이밍 valid로 변경