-
Notifications
You must be signed in to change notification settings - Fork 1
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]: user Id로 마이페이지 조회 API 구현 #96
Conversation
|
||
public Status getStatusByGroupAndUser(Long groupId, Long userId) { | ||
Apply apply = applyQueryHandler.findOptionalByUserIdAndGroupId(userId, groupId) | ||
.orElseGet(() -> Apply.builder().status(Status.NONE).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.
group에 대한 로그인 user의 지원서가 없다면 Status 값이 NONE인 Apply 객체를 생성했습니다.
Optional.isPresent() 메서드를 통해 분기처리해도 되지만, (apply가 존재하는 경우 Optional.get().getStatus() 반환, 없는 경우 Status.NONE 반환) 위 코드가 가독성 면에서 더 좋다고 생각해 Status 값이 NONE인 Apply 객체를 생성했습니다.
@@ -9,6 +9,7 @@ public enum Status { | |||
APPROVE("승인"), | |||
REFUSE("거절"), | |||
WAIT("대기"), | |||
NONE("없음"), |
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.
지원서가 없는 상태를 나타내기 위해 NONE 상수를 추가했습니다.
this.content = content; | ||
this.reason = reason; | ||
this.status = Status.WAIT; | ||
this.isCheckRejected = 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.
@builder 어노테이션을 Entity 자체에 정의한 뒤, @Builder.Default 어노테이션을 통해 status, isCheckRejected default값을 지정했습니다.
Issue number
작업 사항