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/#96] 스크랩 관련 API -> path variable 수정 및 color enum 필드 수정 #125

Merged
merged 2 commits into from
Sep 6, 2024

Conversation

JungYoonShin
Copy link
Member

📄 Work Description

스크랩(취소, 색상 수정) API

  • 기존 scrapId로 소통하던 것에서 통일성을 위해 internshipAnnouncmentId로 소통하도록 수정

스크랩 color enum 필드 수정

  • 기존 int -> string으로 관리

⚙️ ISSUE

📷 Screenshot

  • 스크랩 취소
스크린샷 2024-09-05 오전 1 18 39
- 스크랩 추가 스크린샷 2024-09-05 오전 1 18 46

💬 To Reviewers

리팩할 부분이나 보완할 부분은 편하게 코리 달아주세요~!

🔗 Reference

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

@JungYoonShin JungYoonShin added ♻️ refactor 코드 리팩토링 ex) 형식변경 🐰정윤🐰 labels Sep 4, 2024
@JungYoonShin JungYoonShin self-assigned this Sep 4, 2024
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.

기존에 scrapId로 데이터를 검색한 부분들을 InternshipAnnouncementId + userId로 받아오도록 수정되었네요!
기존 코드의 통일성을 해치지 않도록 수정한 좋은 리펙토링인 것 같습니다!
고생하셨어요:)

Comment on lines +161 to 166
private Color findColor(String color) {
return Arrays.stream(Color.values())
.filter(c-> c.getKey() == color)
.filter(c-> c.getName().equals(color))
.findAny().get();
}

Copy link
Contributor

Choose a reason for hiding this comment

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

  1. .findAny().get() 을 사용하는 경우, Invalid한 color값이 요청으로 들어오면 오류가 발생할 수 있어 이부분에 대한 예외처리가 있으면 좋을 것 같습니다..!
  2. 색상 변경은 빈번하게 일어나는 기능이라고 생각이 드는데, Color.values()를 매번 순회하는 대신, Map을 사용해 캐싱을 하는 방식도 생각해보면 좋을 것 같아요!

Copy link
Contributor

Choose a reason for hiding this comment

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

저도 동의합니다!

Copy link
Member Author

@JungYoonShin JungYoonShin Sep 7, 2024

Choose a reason for hiding this comment

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

  • 1번에 대해서는 request dto에서 유효성 검증을 하면 좋을 것 같다는 생각인데요!
    저희가 아직 validation exceptionGlobalExceptionHandler에서 전역적으로 처리하지 않고 있어서 추후에 해당 처리가 된 후에 바로 적용하겠습니다!

    👉더 좋은 의견있다면 달아주세요 ㅎㅎ

  • 2번은 저도 생각못했는데 한 번 찾아보고 적용해볼게요 감사합니다!

@jsoonworld
Copy link
Contributor

전체적으로 코드가 깔끔하게 리팩토링된 것 같습니다. 수고하셨습니다.

@JungYoonShin JungYoonShin merged commit 23f2f08 into develop Sep 6, 2024
1 check passed
@JungYoonShin JungYoonShin deleted the refactor/#96 branch September 8, 2024 16:07
@JungYoonShin JungYoonShin changed the title [♻️ refactor/#96]: 스크랩 관련 API -> path variable 수정 및 color enum 필드 수정 [♻️ refactor/#96] 스크랩 관련 API -> path variable 수정 및 color enum 필드 수정 Sep 24, 2024
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