Skip to content

[5주차 과제] 한지성 과제 제출합니다#10

Open
thepackour wants to merge 3 commits intoCAUSWICT-EDU:thepackourfrom
thepackour:thepackour
Open

[5주차 과제] 한지성 과제 제출합니다#10
thepackour wants to merge 3 commits intoCAUSWICT-EDU:thepackourfrom
thepackour:thepackour

Conversation

@thepackour
Copy link

@thepackour thepackour commented Nov 18, 2025

테이블 상태 (SHOW TABLE STATUS)

showtablestatus

생성된 테이블 (Datagrip - Show Diagram...)

diagram

엔티티는 5b487fb 커밋에서 완성했으나 실수로 Post 엔티티가 member_id를 참조하도록 만들어서 그 다음 커밋에서 subject_id를 참조하도록 수정했습니다.

Member(user), Subject, Professor 추가, Post 수정, 프로젝트 구조 변경

5주차 듣고 변경 예정
5주차 워크북 내용에 맞춰서 Entity 수정함
Post 엔티티 title 컬럼 삭제해서 findByTitle() 내부 기능 삭제(메서드는 남아있음), findById() 추가, 다른 클래스도 이에 맞춰 수정
@thepackour thepackour changed the title [3주차 과제] 한지성 과제 제출합니다 [5주차 과제] 한지성 과제 제출합니다 Nov 18, 2025
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class member_post_likes extends BaseEntity {
Copy link

Choose a reason for hiding this comment

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

왜 이 클래스에서는 deleted_at 이 없는지 궁금합니다.
deleted_at이 있으면 로그 같은 개념으로 정보를 가지고 있을 수 있을 것 같아 코멘트 해드립니다

Copy link
Author

Choose a reason for hiding this comment

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

게시글 좋아요는 추적을 하거나 복구를 할 필요성이 딱히 안 느껴져서 deleted_at이 불필요하다고 판단했습니다.

public abstract class BaseEntity {

@CreatedDate
private LocalDateTime created_at;
Copy link

Choose a reason for hiding this comment

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

같은 의미에서 BaseEntity에 delete_at 을 가지면 좋을 것 같습니다.


@Entity
@Getter
@Setter
Copy link

Choose a reason for hiding this comment

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

스터디에서 데어터 자체를 변경하는 것을 지양해야 한다고 배웠는데 @Setter를 사용한 이유가 궁금합니다

Copy link
Author

Choose a reason for hiding this comment

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

말씀 하신대로 setter를 사용하면 엔티티가 중간에 임의로 변경될 수 있으므로 지양하는게 맞으나, content 필드는 수정을 하는 경우도 있을 것 같아 넣었습니다. 그런데 다시 생각해보니 setter는 모든 필드에 적용되어 불필요한 메서드가 발생하는 듯 합니다. 아마 setter 대신 메서드를 직접 작성하는게 더 나을 것 같습니다.

@Column
private LocalDateTime deleted_at;

public void updateContent(String new_content) { this.content = new_content; }
Copy link

Choose a reason for hiding this comment

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

위와 같은 이유 입니다

@Kadoros
Copy link

Kadoros commented Nov 19, 2025

엔티티 설개를 넘어서 그것을 프로그램애 응용 시킬려고 노력하는 것이 좋았던것 같습니다.

if (postCooldownChecker.checkCooldown() == false) throw new TooManyPostsException("Too Many Posts");

Post post = new Post(null, title, content);
Post post = Post.builder()

Choose a reason for hiding this comment

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

잠깐 언급하고 넘어갔던 builder를 쓰셨네요! 좋습니다

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants