-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[FEAT] 특정 공유 그룹의 특정 앨범의 사진을 조회하는 API
- Loading branch information
Showing
13 changed files
with
143 additions
and
98 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
10 changes: 4 additions & 6 deletions
10
src/main/java/com/umc/naoman/domain/photo/elasticsearch/document/PhotoEs.java
This file contains 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 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 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
11 changes: 11 additions & 0 deletions
11
src/main/java/com/umc/naoman/domain/photo/elasticsearch/service/PhotoEsService.java
This file contains 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,11 @@ | ||
package com.umc.naoman.domain.photo.elasticsearch.service; | ||
|
||
import com.umc.naoman.domain.member.entity.Member; | ||
import com.umc.naoman.domain.photo.elasticsearch.document.PhotoEs; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
|
||
public interface PhotoEsService { | ||
Page<PhotoEs> getPhotoEsListByShareGroupId(Long shareGroupId, Member member, Pageable pageable); | ||
Page<PhotoEs> getPhotoEsListByShareGroupIdAndFaceTag(Long shareGroupId, Long profileId, Member member, Pageable pageable); | ||
} |
41 changes: 41 additions & 0 deletions
41
src/main/java/com/umc/naoman/domain/photo/elasticsearch/service/PhotoEsServiceImpl.java
This file contains 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,41 @@ | ||
package com.umc.naoman.domain.photo.elasticsearch.service; | ||
|
||
import com.umc.naoman.domain.member.entity.Member; | ||
import com.umc.naoman.domain.photo.elasticsearch.document.PhotoEs; | ||
import com.umc.naoman.domain.photo.elasticsearch.repository.PhotoEsClientRepository; | ||
import com.umc.naoman.domain.shareGroup.service.ShareGroupService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class PhotoEsServiceImpl implements PhotoEsService { | ||
|
||
private final PhotoEsClientRepository photoEsClientRepository; | ||
private final ShareGroupService shareGroupService; | ||
|
||
@Override | ||
@Transactional(readOnly = true) | ||
public Page<PhotoEs> getPhotoEsListByShareGroupIdAndFaceTag(Long shareGroupId, Long profileId, Member member, Pageable pageable) { | ||
validateShareGroupAndProfile(shareGroupId, member); | ||
Long memberId = shareGroupService.findProfile(profileId).getMember().getId(); | ||
return photoEsClientRepository.findPhotoEsByShareGroupIdAndFaceTag(shareGroupId, memberId, pageable); | ||
} | ||
|
||
@Override | ||
@Transactional(readOnly = true) | ||
public Page<PhotoEs> getPhotoEsListByShareGroupId(Long shareGroupId, Member member, Pageable pageable) { | ||
validateShareGroupAndProfile(shareGroupId, member); | ||
return photoEsClientRepository.findPhotoEsByShareGroupId(shareGroupId, pageable); | ||
} | ||
|
||
private void validateShareGroupAndProfile(Long shareGroupId, Member member) { | ||
// 해당 공유 그룹이 존재하는지 확인 | ||
shareGroupService.findShareGroup(shareGroupId); | ||
// 멤버가 해당 공유 그룹에 속해있는지 확인 | ||
shareGroupService.findProfile(shareGroupId, member.getId()); | ||
} | ||
} |
1 change: 0 additions & 1 deletion
1
src/main/java/com/umc/naoman/domain/photo/entity/SamplePhoto.java
This file contains 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
Oops, something went wrong.