Skip to content

Conversation

@wibaek
Copy link
Member

@wibaek wibaek commented May 9, 2025

BaseEntity를 상속한 이유는 이후에 유저도 소식지를 쓸 수 있게 되면 필요할 것이라 추정되기에

관련 이슈

작업 내용

소식지 도메인을 추가했습니다. 기존의 firebase/excel 기반의 도메인과 동일한 형식입니다.

BaseEntity를 상속한 이유는 이후에 유저도 소식지를 쓸 수 있게 되면 필요할 것이라 추정되고, 최대한 생성/수정 시간을 기록해두는게 좋다고 생각해서 추가했습니다.

url 500제한은 기존 도메인들의 관행을 따랐습니다.

특이 사항

리뷰 요구사항 (선택)

BaseEntity를 상속한 이유는 이후에 유저도 소식지를 쓸 수 있게 되면 필요할 것이라 추정되기에
@wibaek wibaek self-assigned this May 9, 2025
@wibaek wibaek requested a review from Gyuhyeok99 as a code owner May 9, 2025 15:47
@wibaek wibaek added the 기능 label May 9, 2025
@wibaek wibaek requested a review from nayonsoso as a code owner May 9, 2025 15:47
@coderabbitai
Copy link

coderabbitai bot commented May 9, 2025

Walkthrough

  1. 새로운 News 엔티티 클래스가 com.example.solidconnection.news.domain 패키지에 추가되었습니다.
    • 이 클래스는 BaseEntity를 상속하며 JPA의 @Entity로 지정되어 있습니다.
  2. 주요 필드로는 id(자동 생성되는 기본 키), title, description, thumbnailUrl, url이 정의되어 있습니다.
    • thumbnailUrlurl 필드는 최대 500자 길이 제한이 있습니다.
  3. 롬복(Lombok) 어노테이션을 활용해 getter, 기본 생성자, equals, hashCode 메서드가 자동 생성됩니다.
  4. 새로운 데이터베이스 마이그레이션 스크립트 V12__create_news.sql이 추가되어, news 테이블이 생성됩니다.
    • 이 테이블은 id(자동 증가 bigint 기본 키), title, description, thumbnail_url, url 컬럼과 created_at, updated_at 타임스탬프를 포함합니다.
    • thumbnail_urlurl은 500자 길이, titledescription은 255자 길이 제한이 적용됩니다.

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 134b2de and eccce37.

📒 Files selected for processing (1)
  • src/main/resources/db/migration/V12__create_news.sql (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/main/resources/db/migration/V12__create_news.sql
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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. @EqualsAndHashCodecallSuper=true 지정 권장
상위 BaseEntity의 필드를 포함하여 동등성 비교를 수행하려면 callSuper = true 옵션을 활성화하는 것이 좋습니다.

-@EqualsAndHashCode
+@EqualsAndHashCode(callSuper = true)

19-21: 6. titledescription 필드 유효성 검증 추가 제안
두 필드에 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

📥 Commits

Reviewing files that changed from the base of the PR and between 9713f51 and 5be212b.

📒 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
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

⚠️ Potential issue

3. 생성자 또는 빌더 구현 필요 (치명적)
현재 @NoArgsConstructor만 적용되어 있어 News 인스턴스를 생성할 방법이 없습니다. 다음 중 하나를 필수로 도입해주세요:

  1. 생성자 추가
    생성자에 title, description, thumbnailUrl, url 필드를 파라미터로 받도록 선언
  2. @Builder 적용
    Lombok의 빌더 패턴을 사용하여 안정적인 인스턴스 생성 지원
  3. 정적 팩토리 메서드 구현
    News.of(...)와 같은 명확한 생성 방식을 제공

Copy link
Collaborator

@nayonsoso nayonsoso left a 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.*;
Copy link
Collaborator

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-와일드카드-사용-금지

Copy link
Member Author

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 와일드카드 방지

Copy link
Collaborator

Choose a reason for hiding this comment

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

어떻게 해결했는지까지 공유해주셔서 감사합니다~😇

Copy link
Contributor

@Gyuhyeok99 Gyuhyeok99 left a comment

Choose a reason for hiding this comment

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

혹시 flyway 작성 안해도 되나요??

@wibaek
Copy link
Member Author

wibaek commented May 10, 2025

혹시 flyway 작성 안해도 되나요??

헐 감사합니다...

@wibaek wibaek merged commit bf97db4 into solid-connection:develop May 11, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SC-41]소식지 도메인 추가

3 participants