-
Notifications
You must be signed in to change notification settings - Fork 0
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
Entity 정의 #14
Entity 정의 #14
Conversation
- BaseEntity 정의하여 공통 필드 `createdAt`, `updatedAt` 작성
- Hashtag, Post, PostHashtag Entity 정의 - SocialMediaType enum 정의
src/main/java/team05/integrated_feed_backend/core/entity/BaseEntity.java
Outdated
Show resolved
Hide resolved
src/main/java/team05/integrated_feed_backend/core/entity/BaseEntity.java
Outdated
Show resolved
Hide resolved
- 로컬 빌드하면서 메인 메소드에 추가했던 exclude옵션 삭제했습니다
src/main/java/team05/integrated_feed_backend/module/post/entity/Hashtag.java
Outdated
Show resolved
Hide resolved
private Set<PostHashtag> postHashtags = new HashSet<PostHashtag>(); // Hashtag와 PostHashtag 간의 일대다 관계 | ||
} |
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.
💭
코드로 충분히 이해가 되서 주석 없어도 될 것 같아요!
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.
주석 삭제 반영했습니다!
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.
❓호옥시 양방향으로 하신 이유가 있을까요? 저는 개인적으로는 일단 단방향으로만 만들고, 필요할 때 양방향을 하는 편이라서용! 다른 분들 의견도 궁금해요!
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.
저는 필요할 것 같을 때 미리 설정하는데
게시물 상세 api에서 필요할 것 같아 있어도 좋을 것 같습니다!
그때 가서 추가해도 괜찮고요!
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.
저는 그냥 단순하게 양쪽에서 간편히 조회한다 생각해서 설정했어요! 그런데 성능상 둘 다 계속 같이 로드해야 한다고 하면 단방향이 나을 것 같기도 하네요.. 상세 조회 할 때 따로 쿼리를 만들어야겠지만용
src/main/java/team05/integrated_feed_backend/module/post/entity/Post.java
Outdated
Show resolved
Hide resolved
src/main/java/team05/integrated_feed_backend/module/post/entity/Post.java
Show resolved
Hide resolved
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.
고생하셨습니다 👍
- `BaseEntity` Common으로 이동 - JPA 자동 매핑으로 불필요한 @column 어노테이션 일괄 삭제
Co-authored-by: 조혜온 <[email protected]>
…EAM-05/integrated-feed-backend into feature/entity-definition
src/main/java/team05/integrated_feed_backend/module/post/entity/Post.java
Show resolved
Hide resolved
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.
엔티티 만드는게 고민도 많고, 할 일도 많으셨을텐데 고생하셨습니당👍🏻🌟
src/main/java/team05/integrated_feed_backend/common/BaseEntity.java
Outdated
Show resolved
Hide resolved
src/main/java/team05/integrated_feed_backend/module/auth/entity/VerificationCode.java
Outdated
Show resolved
Hide resolved
private Set<PostHashtag> postHashtags = new HashSet<PostHashtag>(); // Hashtag와 PostHashtag 간의 일대다 관계 | ||
} |
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.
❓호옥시 양방향으로 하신 이유가 있을까요? 저는 개인적으로는 일단 단방향으로만 만들고, 필요할 때 양방향을 하는 편이라서용! 다른 분들 의견도 궁금해요!
private Long shareCount; | ||
|
||
@OneToMany(mappedBy = "post", fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true) | ||
private Set<PostHashtag> postHashtags = new HashSet<PostHashtag>(); // Post와 PostHashtag 간 일대다 |
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.
❓ 혹시 Set 자료구조를 사용하신 이유를 여쭤봐도 될까요? Id로 동등성이 검사되기 때문에, 같은 post_id, hashtag_id를 가지고 있더라도 post_hashtag_id가 다르면 다른 객체로 인식될 것 같아서요! 그리고 사용자가 게시글을 쓸 때, 해시태그의 순서도 의미가 있을 것 같아서 List나 LinkedHashSet 자료구조도 좋을것 같습니당
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.
음.. 빨라서..? 의진님 말대로 생각해보니 중복문제는 무관할 것 같네요! 순서가 의미있고 중요하다면 List나 LinkedHashSet으로 변경이 필요할 것 같고 속도만 생각한다면 HashSet도 괜찮을 것 같습니다! 다들 어떻게 생각하시나요?
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.
사용자가 게시글을 쓸 때, 해시태그의 순서도 의미가 있을 것 같아서
혹시 좀 더 설명 부탁드려도 될까요? 아직 저는 순서에 큰 의미를 못 느껴서요!
전 주로 List
에 저장하긴 하는데 의견 나누면 좋을 것 같네요!
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.
확실히 Set을 사용하면 데이터 검색 속도가 빨라져서 좋더라구용! 그런데 hashtag로 데이터를 조회하는건 DB단에서 쿼리로 처리할 것 같아서, 애플리케이션단에서 특정 해시태그를 가지고 있는지 확인하는 작업은 드물 것 같다는 생각도 드네욤..! 제가 놓치는 부분도 있을 것 같아서.. 이건 해시태그 검색을 맡으신 분들의 의견을 들어보면 좋을 것 같습니당! @hye-on, @toughCircle
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.
혹시 좀 더 설명 부탁드려도 될까요? 아직 저는 순서에 큰 의미를 못 느껴서요!
예를 들어, 누가 인스타그램을 작성하고 해시태그로 #커피팩토리 #대방역_카페 #엉덩이빵 #커피 #불금 이런식으로 올렸으면, 저희가 이 게시글을 다시 보여줄때(상세 페이지)도 요 순서에 맞게 보여주면 좋을 것 같다는 의미였숩니당! 근데 다시 생각해보니까 그렇게 챙겨가야 하는 기능은 아닌것도 같네욤.. 실제론 저희가 게시물을 저장하는 것이 아니라 외부 API에서 가져오는것이니..
제가 여쭤본 이유는 iteration 성능이 리스트보단 셋이 더 안좋아서, 저는 특별히 Set이 필요한 상황이 아니면 리스트를 선호해서 여쭤본 것이였숩니다!
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.
아하..! 얘기 나누다 보니 List가 더 나을 것도 같아요
해시태그 맡으신 분들 의견에 따라 수정하겠습니다
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.
이 부분은 저도 리스트 생각했습니다 :)
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.
예를 들어, 누가 인스타그램을 작성하고 해시태그로 #커피팩토리 #대방역_카페 #엉덩이빵 #커피 #불금 이런식으로 올렸으면, 저희가 이 게시글을 다시 보여줄때(상세 페이지)도 요 순서에 맞게 보여주면 좋을 것 같다는 의미였숩니당! 근데 다시 생각해보니까 그렇게 챙겨가야 하는 기능은 아닌것도 같네욤.. 실제론 저희가 게시물을 저장하는 것이 아니라 외부 API에서 가져오는것이니..
에고 알림이 안와서 이제 확인합니다! 설명 감사해요😊😊
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.
그런데 hashtag로 데이터를 조회하는건 DB단에서 쿼리로 처리할 것 같아서, 애플리케이션단에서 특정 해시태그를 가지고 있는지 확인하는 작업은 드물 것 같다는 생각도 드네욤..!
그럴 것 같아요! 저도 리스트 좋습니다~!
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.
List로 변경하였습니다!
최종검토 부탁드립니다~!
7929802
src/main/java/team05/integrated_feed_backend/module/user/entity/User.java
Outdated
Show resolved
Hide resolved
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long userId; |
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.
💭 정확하진 않지만.. 테이블에 member_id로 되어 있어서, 이름이 같지 않으면 @Column(name = "member_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.
앗 그렇군요..!! 그러고보니 엔티티나 변수명은 그대로 user로 할까요? 아니면 일치시킬까요?
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.
💭 저번에 저희가 mysql에서는 user가 예약어라서 member로 하자고 한걸로 기억하는데 찾아보니 postgreSql에서도 user라고 하면 내장 테이블과 충돌이 난다고 하네요. 저는 아예 member로 바꿔도 괜찮을 것 같습니다!
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.
Member로 변경했습니다. d60ec6a
- Auditing 기능을 사용하게 변경 - jpaConfig 생성 - @jsonformat 추가
📊 Jacoco Test Coverage
|
📊 Jacoco Test Coverage
|
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.
LGTM 👍🏻🌟
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.
고생하셨어요! 👍
📊 Jacoco Test Coverage
|
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.
베이스 세팅 이것저것 확인할게 많으셨을텐데 고생 많으셨습니다!!👍
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.
고민 정말 많이 하신 것 같아요! 고생 많으셨습니다! 👍
🎟️ 관련 이슈
Resolves #5
👩💻 구현 내용
💬 코멘트
BaseEntity
에서 공통 필드 상속받아 사용합니다.회의록의 ERD를 반영하여 정의했습니다. 수정할 사항이 있다면 말씀해주세요!
구현하시면서 각자 변경사항 있을 시 수정해도 될 듯 합니다.
💭 고려한 점
@ManyToOne
연관관계를 지연로딩으로 직접 설정해주었습니다.