-
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: 스터디 공지 V2 도메인 구현 #907
Conversation
Walkthrough이번 변경사항에서는 Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant StudyAnnouncementV2 as Entity
Client->>Entity: create(title, link, study)
Note right of Entity: Builder 패턴으로 인스턴스 생성
Entity-->>Client: 생성된 StudyAnnouncementV2 인스턴스 반환
Client->>Entity: update(newTitle, newLink)
Note right of Entity: title과 link 필드 업데이트
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Job Summary for GradleCheck Style and Test to Develop :: build-test
|
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.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/main/java/com/gdschongik/gdsc/domain/studyv2/domain/StudyAnnouncementV2.java (2)
29-36
: 필드 유효성 검증과 관계 설정 개선이 필요합니다.다음 사항들을 고려해 주세요:
title
과link
필드에@NotNull
또는 길이 제한 등의 유효성 검증이 필요합니다.study
관계에 cascade 설정을 고려해 보세요.다음과 같이 개선할 수 있습니다:
- private String title; + @NotNull + @Size(max = 255) + private String title; - @Column(columnDefinition = "TEXT") + @NotNull + @Column(columnDefinition = "TEXT") private String link; - @ManyToOne(fetch = FetchType.LAZY) + @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) @JoinColumn(name = "study_v2_id") private StudyV2 study;
53-56
: update 메서드의 개선이 필요합니다.
- 매개변수 검증이 필요합니다.
- 메서드 체이닝을 위해 자기 자신을 반환하는 것을 고려해 보세요.
다음과 같이 개선할 수 있습니다:
- public void update(String title, String link) { + public StudyAnnouncementV2 update(String title, String link) { + Objects.requireNonNull(title, "제목은 null일 수 없습니다"); + Objects.requireNonNull(link, "링크는 null일 수 없습니다"); + this.title = title; this.link = link; + return this; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/main/java/com/gdschongik/gdsc/domain/studyv2/domain/StudyAnnouncementV2.java
(1 hunks)
🔇 Additional comments (2)
src/main/java/com/gdschongik/gdsc/domain/studyv2/domain/StudyAnnouncementV2.java (2)
18-22
: 클래스 선언과 애노테이션이 적절하게 구성되어 있습니다!엔티티 클래스의 기본 구조가 잘 설계되어 있으며, 접근 제어와 테이블 명명 규칙이 일관성 있게 적용되었습니다.
38-43
: 생성자와 빌더 패턴이 적절하게 구현되었습니다!private 접근 제어를 통해 빌더 패턴의 안전한 사용을 보장하고 있습니다.
public static StudyAnnouncementV2 create(String title, String link, StudyV2 study) { | ||
return StudyAnnouncementV2.builder() | ||
.title(title) | ||
.link(link) | ||
.study(study) | ||
.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.
🛠️ Refactor suggestion
팩토리 메서드에 매개변수 검증이 필요합니다.
매개변수의 null 체크와 유효성 검증을 추가하여 안전한 객체 생성을 보장해 주세요.
다음과 같이 개선할 수 있습니다:
public static StudyAnnouncementV2 create(String title, String link, StudyV2 study) {
+ Objects.requireNonNull(title, "제목은 null일 수 없습니다");
+ Objects.requireNonNull(link, "링크는 null일 수 없습니다");
+ Objects.requireNonNull(study, "스터디는 null일 수 없습니다");
+
return StudyAnnouncementV2.builder()
.title(title)
.link(link)
.study(study)
.build();
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
public static StudyAnnouncementV2 create(String title, String link, StudyV2 study) { | |
return StudyAnnouncementV2.builder() | |
.title(title) | |
.link(link) | |
.study(study) | |
.build(); | |
} | |
public static StudyAnnouncementV2 create(String title, String link, StudyV2 study) { | |
Objects.requireNonNull(title, "제목은 null일 수 없습니다"); | |
Objects.requireNonNull(link, "링크는 null일 수 없습니다"); | |
Objects.requireNonNull(study, "스터디는 null일 수 없습니다"); | |
return StudyAnnouncementV2.builder() | |
.title(title) | |
.link(link) | |
.study(study) | |
.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.
lgtm
🌱 관련 이슈
📌 작업 내용 및 특이사항
📝 참고사항
📚 기타
Summary by CodeRabbit