-
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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); | ||
Optional<Game> game = gameRepository.findById(code); | ||
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. 이거 조건문 이후에 추가하면 얼리 리턴되서 굳이 안가져올수도 있을 것 같아용 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. |
||
if (!lobby.isPresent()) { | ||
return false; | ||
} | ||
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. 역시 개발자는 코드로 이야기하나보네요 ㅋㅋㅋ 이건 이해가 확실히 되네요. |
||
} | ||
} |
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 exist | ||
) { | ||
} |
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로 변경