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

[♻️ refactor/#129] 공고 상세 정보 및 검색 결과 화면 response body 수정 #132

Merged
merged 13 commits into from
Sep 11, 2024

Conversation

JungYoonShin
Copy link
Member

📄 Work Description

  • 공고 상세 정보 및 검색 결과 화면 response body 수정

⚙️ ISSUE

📷 Screenshot

  • 공고 상세 페이지 API
    image

  • 검색 결과 화면 API
    image

💬 To Reviewers

바뀐 수정사항은 아래와 같습니다!!

공고 상세 정보 API 수정사항

  • startDate(근무시작일) 필드명을 startYearMonth 로 수정(다른 API와의 통일성을 위해)
  • color 필드 추가
  • 스크랩 여부(기존 scrapId > isScrapped, 스크랩 추가 & 취소 & 색상 수정시 모두 기존 scrapId에서 internshipAnnouncementId로 통신하는 것으로 변경되었으므로)

검색 결과 화면 API

  • totalCount 필드 추가 (전체 데이터 개수)
  • 스크랩 여부(기존 scrapId > isScrapped, 스크랩 추가 & 취소 & 색상 수정시 모두 기존 scrapId에서 internshipAnnouncementId로 통신하는 것으로 변경되었으므로)

🔗 Reference

문제를 해결하면서 도움이 되었거나, 참고했던 사이트(코드링크)

- @AuthenticationPrincipal을 통해 userId를 가져올 때 모든 API가 유저 인증이 필수이므로 Long에서 long타입으로 수정
- @PathVariable로 internshipAnnouncementId를 받는 경우 default가 required=true이므로 타입을 Long에서 long으로 수정
- Spring AOP를 사용하여 스크랩 색상 수정API - 색상(enum) 조회시 map를 활용한 캐싱과 .values()를 통한 순차 탐색의 성능 차이를 알아보기 위한 테스트 환경 구축
- InternshipDetailResponseDto 필드 수정됨에 따라 DTO 생성시의 파라미터도 수정
- 기획측 요구사항에 따라 30 -> 60일 보다 오래된 공고를 제외하도록 수정
- 오래된 인턴십 공고를 제외하기 위해 사용되던 '60일' 값을 상수화(INTERNSHIP_CREATED_WITHIN_DAYS)하여 코드 가독성 및 유지보수성을 개선하였습니다.
- 인턴공고의 총 개수를 구할 때, 인턴공고가 없을 경우, 즉 count가 null일 경우 0L을 기본값으로 설정하여 타입 언방식에서 발생할 수 있는 NullPointerException 발생 예방
@JungYoonShin JungYoonShin added ♻️ refactor 코드 리팩토링 ex) 형식변경 🐰정윤🐰 labels Sep 10, 2024
@JungYoonShin JungYoonShin self-assigned this Sep 10, 2024
Comment on lines 36 to 40

public static Color findByName(String name) {
return colorMap.get(name);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

정윤님,

Color enum에 findByName 메서드를 추가한 부분은 정말 좋은 개선인 것 같습니다! 다만, 메서드가 호출되는 시점에 만약 존재하지 않는 컬러 이름이 입력된다면, 그에 대한 에러 처리가 어떻게 될지 조금 더 고려해보는 게 좋을 것 같습니다. 이를 통해 예외 상황에서도 안정적으로 동작할 수 있도록 추가적인 에러 핸들링을 고민해보면 어떨까요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 넵 생각하지 못한 부분이었는데 한 번 적용해볼게욥! 감사합니다 ㅎㅎ

Copy link
Contributor

@junggyo1020 junggyo1020 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

전체적으로 깔끔한 리펙토링인 것 같습니다!
데이터 형식이 비슷한 다른 API와 리펙토링 내용이 겹치는 부분들이 많아서 피드백 사항이 크게 없네요:)
고생하셨습니다..!

Comment on lines 28 to +30

private static final int INTERNSHIP_CREATED_WITHIN_DAYS = 60;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

나중의 수정을 고려해 상수를 따로 선언해주신 부분이 좋네요!

- 스크랩 수정 및 추가 시 색상 정보를 찾을 때, 잘못된 값이 들어왔을 경우에 대한 예외처리 추가
@JungYoonShin JungYoonShin merged commit aef33a5 into develop Sep 11, 2024
1 check passed
@JungYoonShin JungYoonShin changed the title [♻️ refactor/#129]: 공고 상세 정보 및 검색 결과 화면 response body 수정 [♻️ refactor/#129] 공고 상세 정보 및 검색 결과 화면 response body 수정 Sep 24, 2024
@JungYoonShin JungYoonShin deleted the refactor/#129 branch October 2, 2024 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
♻️ refactor 코드 리팩토링 ex) 형식변경 🐰정윤🐰
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants