개발 환경
- Java 17
- 개발 환경 docker compose 실행
docker compose -f docker-compose.local.yml up -d
./local_compose_up.sh
컨벤션
⚠️ 주의 !
이 컨벤션은 2024년 7월 지원까지의 코드에 해당합니다.
이후의 규칙은 자유롭게 만들어가주세요.
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
docker compose -f docker-compose.local.yml up -d./local_compose_up.sh ⚠️ 주의 !
이 컨벤션은 2024년 7월 지원까지의 코드에 해당합니다.
이후의 규칙은 자유롭게 만들어가주세요.
함수의 이름은 동사구로 통일한다.
어노테이션이 여러개 달리는 경우, 더 핵심이 되는 것을 아래에 위치한다. (개인적으로 어노테이션이 많아지면 코드와 가장 가까운 것에 제일 먼저 눈이 가기 때문)
클래스의 바디가 시작할 때 개행하고, 바디가 끝나고 나서 개행한다. (구글 컨벤션에 의해)
클래스에 있는 함수의 이름은 구체적으로 작성한다.
학교 검색 함수의 이름은 search 가 아니라 searchUniversity로 한다.테스트 코드에서 예외 발생 e2e 테스트는 이름을 "~면_예외_응답을_반환한다"로 통일한다.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package com.example.solidconnection.news.domain; | ||
|
|
||
| import com.example.solidconnection.entity.common.BaseEntity; | ||
| import jakarta.persistence.Column; | ||
| import jakarta.persistence.Entity; | ||
| import jakarta.persistence.GeneratedValue; | ||
| import jakarta.persistence.GenerationType; | ||
| import jakarta.persistence.Id; | ||
| import lombok.EqualsAndHashCode; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @Getter | ||
| @Entity | ||
| @NoArgsConstructor | ||
| @EqualsAndHashCode | ||
| public class News extends BaseEntity { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| private Long id; | ||
|
|
||
| private String title; | ||
|
|
||
| private String description; | ||
|
|
||
| @Column(length = 500) | ||
| private String thumbnailUrl; | ||
|
|
||
| @Column(length = 500) | ||
| private String url; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| CREATE TABLE news ( | ||
| created_at datetime(6), | ||
| id bigint not null auto_increment, | ||
| updated_at datetime(6), | ||
| thumbnail_url varchar(500), | ||
| url varchar(500), | ||
| description varchar(255), | ||
| title varchar(255), | ||
| primary key (id) | ||
| ) |
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(...)와 같은 명확한 생성 방식을 제공