Open
Conversation
Member(user), Subject, Professor 추가, Post 수정, 프로젝트 구조 변경 5주차 듣고 변경 예정
5주차 워크북 내용에 맞춰서 Entity 수정함
Post 엔티티 title 컬럼 삭제해서 findByTitle() 내부 기능 삭제(메서드는 남아있음), findById() 추가, 다른 클래스도 이에 맞춰 수정
Kadoros
reviewed
Nov 19, 2025
| @Builder | ||
| @NoArgsConstructor | ||
| @AllArgsConstructor | ||
| public class member_post_likes extends BaseEntity { |
There was a problem hiding this comment.
왜 이 클래스에서는 deleted_at 이 없는지 궁금합니다.
deleted_at이 있으면 로그 같은 개념으로 정보를 가지고 있을 수 있을 것 같아 코멘트 해드립니다
Author
There was a problem hiding this comment.
게시글 좋아요는 추적을 하거나 복구를 할 필요성이 딱히 안 느껴져서 deleted_at이 불필요하다고 판단했습니다.
Kadoros
reviewed
Nov 19, 2025
| public abstract class BaseEntity { | ||
|
|
||
| @CreatedDate | ||
| private LocalDateTime created_at; |
There was a problem hiding this comment.
같은 의미에서 BaseEntity에 delete_at 을 가지면 좋을 것 같습니다.
Kadoros
reviewed
Nov 19, 2025
|
|
||
| @Entity | ||
| @Getter | ||
| @Setter |
There was a problem hiding this comment.
스터디에서 데어터 자체를 변경하는 것을 지양해야 한다고 배웠는데 @Setter를 사용한 이유가 궁금합니다
Author
There was a problem hiding this comment.
말씀 하신대로 setter를 사용하면 엔티티가 중간에 임의로 변경될 수 있으므로 지양하는게 맞으나, content 필드는 수정을 하는 경우도 있을 것 같아 넣었습니다. 그런데 다시 생각해보니 setter는 모든 필드에 적용되어 불필요한 메서드가 발생하는 듯 합니다. 아마 setter 대신 메서드를 직접 작성하는게 더 나을 것 같습니다.
Kadoros
reviewed
Nov 19, 2025
| @Column | ||
| private LocalDateTime deleted_at; | ||
|
|
||
| public void updateContent(String new_content) { this.content = new_content; } |
|
엔티티 설개를 넘어서 그것을 프로그램애 응용 시킬려고 노력하는 것이 좋았던것 같습니다. |
riadan710
reviewed
Nov 20, 2025
| if (postCooldownChecker.checkCooldown() == false) throw new TooManyPostsException("Too Many Posts"); | ||
|
|
||
| Post post = new Post(null, title, content); | ||
| Post post = Post.builder() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
테이블 상태 (SHOW TABLE STATUS)
생성된 테이블 (Datagrip - Show Diagram...)
엔티티는 5b487fb 커밋에서 완성했으나 실수로 Post 엔티티가 member_id를 참조하도록 만들어서 그 다음 커밋에서 subject_id를 참조하도록 수정했습니다.