-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ee0ede3
feat: 앨범 내 사진 조회 및 앨범 제목 수정 API 추가
3aea8b3
fix(PhotoService): 불필요한 userId 파라미터 제거
05c15c4
feat: 앨범-사진 view 정의
704cce3
refactor: 미사용 메서드 삭제
3931139
build: swagger-ui 라이브러리 버전 변경
2df4e4b
style: 불필요한 공백 제거
e7895bc
style: 함수명 변경
1adf27f
refactor: PhotoItem 을 양방향 연관관계로 설정
f9fa82d
refactor: Photo-PhotoItem 양방향 관계 제거
57ec041
refactor(PhotoItem): @setter 제거 및 setter 함수 별도 추가
017afcd
refactor: service단에서 PhotoItem을 모르도록 수정
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,3 +41,4 @@ out/ | |
| **/application.properties | ||
|
|
||
| /lib/ | ||
| /url/ | ||
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,6 @@ public record AlbumCreateRequest( | |
| @NotNull | ||
| Long userId, | ||
| @NotEmpty | ||
| String name | ||
| String title | ||
| ) { | ||
| } | ||
10 changes: 10 additions & 0 deletions
10
src/main/java/kr/kro/photoliner/domain/album/dto/request/AlbumItemCreateRequest.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package kr.kro.photoliner.domain.album.dto.request; | ||
|
|
||
| import jakarta.validation.constraints.NotNull; | ||
| import java.util.List; | ||
|
|
||
| public record AlbumItemCreateRequest( | ||
| @NotNull | ||
| List<Long> ids | ||
| ) { | ||
| } |
10 changes: 10 additions & 0 deletions
10
src/main/java/kr/kro/photoliner/domain/album/dto/request/AlbumItemDeleteRequest.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package kr.kro.photoliner.domain.album.dto.request; | ||
|
|
||
| import jakarta.validation.constraints.NotNull; | ||
| import java.util.List; | ||
|
|
||
| public record AlbumItemDeleteRequest( | ||
| @NotNull | ||
| List<Long> ids | ||
| ) { | ||
| } |
9 changes: 9 additions & 0 deletions
9
src/main/java/kr/kro/photoliner/domain/album/dto/request/AlbumTitleUpdateRequest.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package kr.kro.photoliner.domain.album.dto.request; | ||
|
|
||
| import jakarta.validation.constraints.NotNull; | ||
|
|
||
| public record AlbumTitleUpdateRequest( | ||
| @NotNull | ||
| String title | ||
| ) { | ||
| } |
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
40 changes: 40 additions & 0 deletions
40
src/main/java/kr/kro/photoliner/domain/album/dto/response/AlbumPhotoItemsResponse.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| package kr.kro.photoliner.domain.album.dto.response; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import java.util.List; | ||
| import kr.kro.photoliner.domain.album.model.view.AlbumPhotoView; | ||
| import org.springframework.data.domain.Page; | ||
|
|
||
| public record AlbumPhotoItemsResponse( | ||
| List<InnerAlbumPhotoItem> items | ||
| ) { | ||
|
|
||
| public static AlbumPhotoItemsResponse from(Page<AlbumPhotoView> albumPhotoViews) { | ||
| return new AlbumPhotoItemsResponse( | ||
| albumPhotoViews.stream() | ||
| .map(InnerAlbumPhotoItem::from) | ||
| .toList() | ||
| ); | ||
| } | ||
|
|
||
| public record InnerAlbumPhotoItem( | ||
| Long id, | ||
| Long photoId, | ||
| String fileName, | ||
| String filePath, | ||
| String thumbnailPath, | ||
| LocalDateTime capturedDt | ||
| ) { | ||
|
|
||
| public static InnerAlbumPhotoItem from(AlbumPhotoView albumPhotoView) { | ||
| return new InnerAlbumPhotoItem( | ||
| albumPhotoView.getId(), | ||
| albumPhotoView.getPhotoId(), | ||
| albumPhotoView.getFileName(), | ||
| albumPhotoView.getFilePath(), | ||
| albumPhotoView.getThumbnailPath(), | ||
| albumPhotoView.getCapturedDt() | ||
| ); | ||
| } | ||
| } | ||
| } |
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
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
12 changes: 0 additions & 12 deletions
12
src/main/java/kr/kro/photoliner/domain/album/model/Albums.java
This file was deleted.
Oops, something went wrong.
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
59 changes: 59 additions & 0 deletions
59
src/main/java/kr/kro/photoliner/domain/album/model/view/AlbumPhotoView.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| package kr.kro.photoliner.domain.album.model.view; | ||
|
|
||
| import jakarta.persistence.Column; | ||
| import jakarta.persistence.Entity; | ||
| import jakarta.persistence.Id; | ||
| import jakarta.persistence.Table; | ||
| import java.time.LocalDateTime; | ||
| import java.util.Objects; | ||
| import lombok.Getter; | ||
| import org.hibernate.annotations.Immutable; | ||
| import org.locationtech.jts.geom.Point; | ||
|
|
||
| @Entity | ||
| @Immutable | ||
| @Getter | ||
| @Table(name = "vw_album_photos") | ||
| public class AlbumPhotoView { | ||
| @Id | ||
| @Column(name = "id") | ||
| private Long id; | ||
|
|
||
| @Column(name = "photo_id", nullable = false) | ||
| private Long photoId; | ||
|
|
||
| @Column(name = "file_name") | ||
| private String fileName; | ||
|
|
||
| @Column(name = "file_path") | ||
| private String filePath; | ||
|
|
||
| @Column(name = "thumbnail_path") | ||
| private String thumbnailPath; | ||
|
|
||
| @Column(name = "captured_dt") | ||
| private LocalDateTime capturedDt; | ||
|
|
||
| @Column(name = "location") | ||
| private Point location; | ||
|
|
||
| @Column(name = "album_id") | ||
| private Long albumId; | ||
|
|
||
| @Column(name = "user_id") | ||
| private Long userId; | ||
|
|
||
| public Double getLatitude() { | ||
| if (Objects.isNull(location)) { | ||
| return null; | ||
| } | ||
| return location.getX(); | ||
| } | ||
|
|
||
| public Double getLongitude() { | ||
| if (Objects.isNull(location)) { | ||
| return null; | ||
| } | ||
| return location.getY(); | ||
| } | ||
|
Comment on lines
+46
to
+58
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A좋네요 |
||
| } | ||
21 changes: 21 additions & 0 deletions
21
src/main/java/kr/kro/photoliner/domain/album/model/view/AlbumPhotoViews.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package kr.kro.photoliner.domain.album.model.view; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Objects; | ||
|
|
||
| public record AlbumPhotoViews( | ||
| List<AlbumPhotoView> albumPhotoViews | ||
| ) { | ||
|
|
||
| public List<AlbumPhotoView> filterIncludedInAlbum(Long albumId) { | ||
| return albumPhotoViews.stream() | ||
| .filter(albumPhotoView -> Objects.equals(albumPhotoView.getAlbumId(), albumId)) | ||
| .toList(); | ||
| } | ||
|
|
||
| public List<AlbumPhotoView> filterExcludedFromAlbum(Long albumId) { | ||
| return albumPhotoViews.stream() | ||
| .filter(albumPhotoView -> !Objects.equals(albumPhotoView.getAlbumId(), albumId)) | ||
| .toList(); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
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가 바뀐다면 뷰테이블도 추가해줘야하는 불편함이 있을 것 같긴합니다.