-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 앨범 내 사진 추가 API 추가 #42
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
Conversation
kih1015
left a comment
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.
R 관련된 리뷰 확인해주세요!
| @Entity | ||
| @Immutable | ||
| @Getter | ||
| @Table(name = "vw_album_photos") | ||
| public class AlbumPhotoView { |
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.
C
뷰테이블을 만들어서 맵핑하는 전략을 선택하셨군요. 이러면 DB가 바뀐다면 뷰테이블도 추가해줘야하는 불편함이 있을 것 같긴합니다.
| public Double getLatitude() { | ||
| if (Objects.isNull(location)) { | ||
| return null; | ||
| } | ||
| return location.getX(); | ||
| } | ||
|
|
||
| public Double getLongitude() { | ||
| if (Objects.isNull(location)) { | ||
| return null; | ||
| } | ||
| return location.getY(); | ||
| } |
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.
A
좋네요
|
|
||
| } |
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.
C
마지막 공백은 지워주세요
| public class PhotoItem { | ||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| private Long id; | ||
|
|
||
| @Column(name = "photo_id", nullable = false) | ||
| private Long photoId; | ||
|
|
||
| } |
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.
C
공백 체크해주세요!
| @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) | ||
| @JoinColumn(name = "album_id") | ||
| private List<PhotoItem> items = new ArrayList<>(); |
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.
R
성능상의 이슈로 인해 어쩔 수 없이 양방향 연관관계로 사용하는 것이 좋을 것 같습니다.. 내부에서는 양방향으로 사용하되, 외부에 PhotoItem을 숨기는 전략이 차선책일 것 같아요.
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.
PhotoItem 클래스에서 photoId 대신 다대일 양방향(@manytoone) 관계를 사용하여 Photo 객체를 참조하자는 의미일까요?
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.
넵 연관관계의 주인은 참조키를 가지고 있는 엔티티가 되어야 성능 상 이슈가 없다고 하네요..
📌 ISSUE 번호
📄 작업 내용 요약
앨범 내 사진 조회 API
Album도메인과Photo도메인을 각각 불러온 후, 조회 데이터를 가져오는 것은 너무 번거롭다고 생각View를 생성하고, 해당View에 해당하는 도메인 모델을 설계하고, 이를 통해 조회 데이터를 한 번에 가져올 수 있도록 함📢 참고 사항
✅ 체크리스트