Skip to content

Commit

Permalink
feat: add permission checking logic for recap service
Browse files Browse the repository at this point in the history
  • Loading branch information
gmkim20713 committed Nov 21, 2024
1 parent 7ea131f commit 98b6f78
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class RecapService {
@Value("${recap.path.tmp}")
private String tmpPath;

private final AlbumService albumService;
private final AlbumPermissionVerifier albumPermissionVerifier;
private final PhotoService photoService;
private final MemberService memberService;

Expand All @@ -44,14 +44,14 @@ public Mono<String> createRecap(String albumId, String requestMemberId, String s

String recapId = IdGenerator.generate();

return albumService.findByAlbumId(albumId, requestMemberId)
return albumPermissionVerifier.verifyOwnershipOrAccessPermission(albumId, requestMemberId, DOWNLOAD_ACCESS)
.flatMap(albumEntity -> {
String albumType = String.valueOf(albumEntity.getType());

return graphics2dService.generateAlbumChipForRecap(recapId, albumEntity.getName(), albumType)
.then(memberService.getMemberInfo(token))
.then(memberService.getMemberInfoByToken(token))
.flatMap(memberInfo -> generateRecapFrame(recapId, memberInfo.name(), albumType))
.then(photoService.findAllByAlbumId(albumId, requestMemberId, sort)
.then(photoService.findPhotoListByAlbumId(albumId, requestMemberId, sort)
.collectList()
.flatMap(photoEntities -> {
List<String> photoUrls = photoEntities.stream()
Expand Down

0 comments on commit 98b6f78

Please sign in to comment.