-
Notifications
You must be signed in to change notification settings - Fork 2
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 : 선착순 API 기능 일부 구현 (CC-141) #30
Conversation
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.
수정부탁드립니다!
return SuccessResponse.of(SuccessCode.OK, findingGamePlayService.checkAnswer(req)); | ||
} | ||
|
||
@PostMapping("/regist") |
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.
컨트롤러도 javadoc 주석 달아주세요!
return SuccessResponse.of(SuccessCode.OK, findingGamePlayService.checkAnswer(req)); | ||
} | ||
|
||
@PostMapping("/regist") |
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.
regist
-> register
일괄 변경하는것 어떤가요? 다른 서비스 로직에도 그렇게 사용하고 있어서,,
} | ||
|
||
// 정답 개수가 0이거나 1 || 남은 선착순 자리 체크 | ||
if (count != 2 || findingGameRedisRepository.increaseCount() > 315L) { // TODO: 오늘 선착순 인원 정보 가져와야함 |
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.
숫자 2가 아니라 MAX_ANSWER_COUNT
등으로 명시하는게 어떤가요?
|
||
// 정답 개수가 0이거나 1 || 남은 선착순 자리 체크 | ||
if (count != 2 || findingGameRedisRepository.increaseCount() > 315L) { // TODO: 오늘 선착순 인원 정보 가져와야함 | ||
if (count == 2) findingGameRedisRepository.decreaseCount(); |
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.
정답을 다 못맞추거나, 정답을 다 맞췄는데 315명안에 들지 못한경우에 주는 응답이 같아도 되나요? 명시적으로 다른 값을 반환하는게 어떤가요
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.
정답을 다 맞추지 못하면 반환되는 리스트에는 아무 것도 없고, 정답을 다 맞추고 315명안에 들지 못한 경우에는 리스트에 정확한 정답 2개가 들어가 있게됩니다. 프론트에서 315명안에 들지 못했더라도 정답을 맞췄다는 view는 필요하기에 이 방식을 택했습니다.
두 경우 모두 티켓아이디는 발급을 받지 못하는데, 경우에 따라서만 티켓아이디를 보여주고 싶다면 DTO를 나누고 AnswerResponseBaseDto를 따로 만든 후, 상속받아서 사용해야할 것 같습니다.
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.
어떤 방식이든 정답 리스트가 비어있든 1개가있든 2개가있든 모두 반환해줘야하는 건 같습니다.
if (endTime - startTime > 1000L * 60 * 3) { // 3분 초과 - 실패 및 당첨자 제외 | ||
findingGameRedisRepository.decreaseCount(); | ||
findingGameRedisRepository.deleteWinner(ticketId); | ||
return RegistWinnerResponseDto.builder().success(false).build(); |
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.
Builder
쓸때 한줄씩 엔터 칠거면 전부 통일해쥬세요
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.
DTO에 한 변수만 들어가고 변경되는 값이 success의 false true밖에 없고 한줄로 씀에도 80자 이상을 넘어가지 않아서 한눈에 많은 라인을 볼 수 있게 했는데 변경하곘습니다.
.build(); | ||
findingGameWinnerRepository.save(winner); | ||
findingGameRedisRepository.deleteWinner(ticketId); | ||
return RegistWinnerResponseDto.builder().success(true).build(); |
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.
빌더패턴 컨벤션 통일!
…me.now()에 주입 (CC-147) (#28) * chore : LocalDateTime.now() 테스트코드 작성을 위한 TimeConfig 빈 등록 (CC-147) * test :TimeConfig, Clock객체를 모킹한 테스트코드 작성 (CC-147) * fix : 필요없는 출력문 제거 (CC-147) * fix : GithubAction 컨테이너의 테스트 환경에서의 UTC 시차 테스트를 위한 코드 (CC-147) * fix : 오타 수정 (CC-148) * fix : 오타 수정 (CC-148) * chore : 스프링부트 어플리케이션 Timezone KST로 설정 (CC-147) * test : 단위테스트 Timezone KST로 설정 (CC-147) * test : 단위테스트 Timezone KST로 설정한 후 LocalDateTime.now 호출로 변경 (CC-147) * test : LocalDateTimeService ci 테스트용 코드 (CC-147) * test : LocalDateTimeService ci 테스트용 코드 (CC-147) * test : Clock.instant에 UTC+9의 시차가 정상적으로 적용되는지 확인하는 테스트코드 작성 (CC-147)
📝 작업내용
💬 침고사항
📖 레퍼런스