-
Notifications
You must be signed in to change notification settings - Fork 8
feat: News 소식지 도메인 추가 #302
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: News 소식지 도메인 추가 #302
Conversation
BaseEntity를 상속한 이유는 이후에 유저도 소식지를 쓸 수 있게 되면 필요할 것이라 추정되기에
Walkthrough
Tip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 (
|
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 (4)
src/main/java/com/example/solidconnection/news/domain/News.java (4)
4-4: 1. 명시적import사용 권장
현재import jakarta.persistence.*;를 사용하고 있는데, 이는 필요 이상의 의존성을 유발할 수 있습니다. 다음과 같이 필요한 어노테이션만 명시적으로 import해주세요.-import jakarta.persistence.*; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Column;
12-12: 4.@EqualsAndHashCode에callSuper=true지정 권장
상위BaseEntity의 필드를 포함하여 동등성 비교를 수행하려면callSuper = true옵션을 활성화하는 것이 좋습니다.-@EqualsAndHashCode +@EqualsAndHashCode(callSuper = true)
19-21: 6.title과description필드 유효성 검증 추가 제안
두 필드에 null 허용 여부나 길이 제한이 명시되어 있지 않습니다. 다음을 고려해주세요:
@Column(nullable = false)@Size(max = …)또는@NotBlank등의 Bean Validation 어노테이션 적용
26-27: 7.url컬럼명 재정의 검토
일부 DB에서url이 예약어일 수 있습니다. 명시적인 컬럼명 지정 방안을 검토해주세요.- @Column(length = 500) - private String url; + @Column(name = "news_url", length = 500) + private String url;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/main/java/com/example/solidconnection/news/domain/News.java(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build
🔇 Additional comments (2)
src/main/java/com/example/solidconnection/news/domain/News.java (2)
9-10: 2. 클래스 어노테이션 구성이 적절합니다
Lombok의@Getter와 JPA의@Entity를 조합하여 가독성과 유지보수성을 잘 고려하셨습니다.
15-17: 5.id필드 설정이 적절합니다
GenerationType.IDENTITY를 사용하여 기본키를 자동 생성하도록 잘 구현하셨습니다.
|
|
||
| @Getter | ||
| @Entity | ||
| @NoArgsConstructor |
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
3. 생성자 또는 빌더 구현 필요 (치명적)
현재 @NoArgsConstructor만 적용되어 있어 News 인스턴스를 생성할 방법이 없습니다. 다음 중 하나를 필수로 도입해주세요:
- 생성자 추가
생성자에title,description,thumbnailUrl,url필드를 파라미터로 받도록 선언 @Builder적용
Lombok의 빌더 패턴을 사용하여 안정적인 인스턴스 생성 지원- 정적 팩토리 메서드 구현
News.of(...)와 같은 명확한 생성 방식을 제공
nayonsoso
left a comment
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.
BaseEntity를 상속한 이유는 이후에 유저도 소식지를 쓸 수 있게 되면 필요할 것이라 추정되고, 최대한 생성/수정 시간을 기록해두는게 좋다고 생각해서 추가했습니다.
좋습니다
| package com.example.solidconnection.news.domain; | ||
|
|
||
| import com.example.solidconnection.entity.common.BaseEntity; | ||
| import jakarta.persistence.*; |
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.
이 부분 와일드카드가 아니라, 어떤걸 Import 했는지 분명히 보여주도록 바꿔주세요!
https://github.com/solid-connection/solid-connect-server/wiki/개발-컨벤션-정리#13-와일드카드-사용-금지
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.
같은곳에서 5개 이상 import되면 제 인텔리제이가 멋대로 합쳐버리는 문제가 있었네요 ㅎㅎ
다음과 같이 해결했습니다.
와일드카드 import 임계치 조정
• Windows/Linux: File → Settings → Editor → Code Style → Java → Imports 탭
• macOS: IntelliJ IDEA → Preferences → Editor → Code Style → Java → Imports
• Class count to use import with ‘’ 값을 기본 5 → 예: 99 또는 999 로 높여 “한 패키지에서 99개 이상 import할 때만 * 사용”
• Names count to use static import with ‘’ 값도 동일하게 높여서 static import 와일드카드 방지
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.
어떻게 해결했는지까지 공유해주셔서 감사합니다~😇
Gyuhyeok99
left a comment
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.
혹시 flyway 작성 안해도 되나요??
헐 감사합니다... |
BaseEntity를 상속한 이유는 이후에 유저도 소식지를 쓸 수 있게 되면 필요할 것이라 추정되기에
관련 이슈
작업 내용
소식지 도메인을 추가했습니다. 기존의 firebase/excel 기반의 도메인과 동일한 형식입니다.
BaseEntity를 상속한 이유는 이후에 유저도 소식지를 쓸 수 있게 되면 필요할 것이라 추정되고, 최대한 생성/수정 시간을 기록해두는게 좋다고 생각해서 추가했습니다.
url 500제한은 기존 도메인들의 관행을 따랐습니다.
특이 사항
리뷰 요구사항 (선택)