Skip to content
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

Merged
merged 14 commits into from
Aug 31, 2023
Merged

Conversation

twoosky
Copy link
Member

@twoosky twoosky commented Aug 31, 2023

@twoosky twoosky self-assigned this Aug 31, 2023

public Status getStatusByGroupAndUser(Long groupId, Long userId) {
Apply apply = applyQueryHandler.findOptionalByUserIdAndGroupId(userId, groupId)
.orElseGet(() -> Apply.builder().status(Status.NONE).build());
Copy link
Member Author

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("없음"),
Copy link
Member Author

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;
Copy link
Member Author

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값을 지정했습니다.

@twoosky twoosky merged commit b1b270b into dev Aug 31, 2023
1 check passed
@jihwan2da jihwan2da deleted the feature/myPage-94 branch September 13, 2023 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant