Skip to content

Conversation

@chanrhan
Copy link
Collaborator

@chanrhan chanrhan commented Nov 21, 2025

📌 ISSUE 번호

📄 작업 내용 요약

  • 앨범 내 사진 조회 API 추가
  • 앨범 제목 수정 API 추가

앨범 내 사진 조회 API

  • Album도메인과 Photo도메인을 각각 불러온 후, 조회 데이터를 가져오는 것은 너무 번거롭다고 생각
  • 따라서 View를 생성하고, 해당 View에 해당하는 도메인 모델을 설계하고, 이를 통해 조회 데이터를 한 번에 가져올 수 있도록 함

📢 참고 사항

✅ 체크리스트

  • ISSUE 번호 연결 했나요?
  • Reviewers 지정 했나요?
  • Assignees 지정 했나요?
  • Labels 지정 했나요?

@chanrhan chanrhan self-assigned this Nov 21, 2025
@chanrhan chanrhan added the enhancement New feature or request label Nov 21, 2025
@chanrhan chanrhan requested a review from kih1015 November 21, 2025 12:23
Copy link
Contributor

@kih1015 kih1015 left a comment

Choose a reason for hiding this comment

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

R 관련된 리뷰 확인해주세요!

Comment on lines +13 to +17
@Entity
@Immutable
@Getter
@Table(name = "vw_album_photos")
public class AlbumPhotoView {
Copy link
Contributor

Choose a reason for hiding this comment

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

C

뷰테이블을 만들어서 맵핑하는 전략을 선택하셨군요. 이러면 DB가 바뀐다면 뷰테이블도 추가해줘야하는 불편함이 있을 것 같긴합니다.

Comment on lines +46 to +58
public Double getLatitude() {
if (Objects.isNull(location)) {
return null;
}
return location.getX();
}

public Double getLongitude() {
if (Objects.isNull(location)) {
return null;
}
return location.getY();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

A

좋네요

Comment on lines 59 to 60

}
Copy link
Contributor

Choose a reason for hiding this comment

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

C

마지막 공백은 지워주세요

Comment on lines 21 to 29
public class PhotoItem {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Column(name = "photo_id", nullable = false)
private Long photoId;

}
Copy link
Contributor

Choose a reason for hiding this comment

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

C

공백 체크해주세요!

Comment on lines 45 to 47
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name = "album_id")
private List<PhotoItem> items = new ArrayList<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

R

성능상의 이슈로 인해 어쩔 수 없이 양방향 연관관계로 사용하는 것이 좋을 것 같습니다.. 내부에서는 양방향으로 사용하되, 외부에 PhotoItem을 숨기는 전략이 차선책일 것 같아요.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

PhotoItem 클래스에서 photoId 대신 다대일 양방향(@manytoone) 관계를 사용하여 Photo 객체를 참조하자는 의미일까요?

Copy link
Contributor

Choose a reason for hiding this comment

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

넵 연관관계의 주인은 참조키를 가지고 있는 엔티티가 되어야 성능 상 이슈가 없다고 하네요..

@chanrhan chanrhan requested a review from kih1015 November 22, 2025 07:00
@chanrhan chanrhan merged commit a64c2eb into develop Nov 22, 2025
1 check passed
@chanrhan chanrhan deleted the feature/41-album-photo-crud branch November 22, 2025 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] 앨범 내 사진 추가 및 삭제 API 추가

3 participants