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

GTB-25 [feat] 도메인 생성 #19

Merged
merged 13 commits into from
May 16, 2024
Merged

GTB-25 [feat] 도메인 생성 #19

merged 13 commits into from
May 16, 2024

Conversation

jwnnoh
Copy link
Member

@jwnnoh jwnnoh commented May 16, 2024

1. 무슨 이유로 코드를 변경했나요?

  • 가천테이블 내 도메인 설계 및 프로젝트 기본 설정을 위해 코드를 작성하였습니다.

2. 어떤 위험이나 장애를 발견했나요?

  • 특이사항 없습니다.

3. 관련 스크린샷을 첨부해주세요.

gachontable


4. 완료 사항

  • 도메인 클래스 구현
  • BaseTimeEntity 클래스 구현
  • 전역 에러 처리 클래스 구현
  • 로컬 DB 연결 프로퍼티 파일 작성
  • 시큐리티 설정

5. 추가 사항

@jwnnoh jwnnoh added the ✨ feature 새로운 기능 label May 16, 2024
@jwnnoh jwnnoh self-assigned this May 16, 2024
@jwnnoh jwnnoh changed the title GTB-25 GTB-25 [feat] 도메인 생성 May 16, 2024
Copy link
Contributor

@rootTiket rootTiket left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!

@yechan-kim yechan-kim assigned yechan-kim and jwnnoh and unassigned jwnnoh and yechan-kim May 16, 2024
@yechan-kim
Copy link
Contributor

고생하셨습니다!

Copy link
Contributor

@hoonyworld hoonyworld left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!
엔티티를 만드는 과정에서 @NoArgsConstructor에 PROTECTED LEVEL를 주어 관리하신 점이 인상적이였습니다!

접근 권한을 Private로 하면 프록시 객체 생성에 문제가 생기고, 접근 권한을 Public으로 하면 무분별한 객체 생성 및 setter를 통한 값 주입을 할 수 있기에 접근 권한을 Protected로 작성하면 좋습니다!

그런데 양방향 매핑을 해서 외래키를 관리할 지, 아니면 단방향 매핑을 한 후 @onDelete(action = OnDeleteAction.CASCADE) 어노테이션을 적용해서 관리할 지 고민을 해보아야 할 것 같습니다.
가독성 측면에서 관리할 수 있는 필드가 줄어들기에 개인적으로 onDelete 어노테이션을 선호하지만,
성능적인 측면에서도 비교해본 후 결정할 부분이라고 생각됩니다.

보시면 좋을 참고링크를 첨부합니다
NOW-SOPT-SERVER/hoonyworld#9 (comment)

@Getter
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
Copy link
Contributor

Choose a reason for hiding this comment

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

@AllArgsContsturctor로 매개변수 있는 생성자를 만들어주는 것보다, builder 패턴이나 정적 팩토리메서드 패턴으로 관리하는게 더 좋을 것 같습니다!

Copy link
Contributor

Choose a reason for hiding this comment

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

다른 프로젝트에서 매개변수 있는 생성자 대신 빌더 + 정적 팩토리 메서드 패턴으로 관리해준 예시입니다!
참고하시면 좋을 것 같아요 ㅎㅎ

public static Blog create(final Member member, final BlogCreateRequest blogCreateRequest) {
    return Blog.builder()
            .member(member)
            .title(blogCreateRequest.title())
            .description(blogCreateRequest.description())
            .build();
}

@Builder
public Blog(Member member, String title, String description) {
    this.member = member;
    this.title = title;
    this.description = description;
}

@jwnnoh jwnnoh merged commit 138d799 into develop May 16, 2024
@jwnnoh jwnnoh deleted the GTB-25 branch May 16, 2024 13:38
private Integer headCount;

@Column(nullable = true)
private Status waitingStatus;
Copy link
Contributor

Choose a reason for hiding this comment

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

Status에 대한 @Enumerated(EnumType.STRING)이 빠진 것 같습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ feature 새로운 기능
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants