Skip to content

Commit

Permalink
fix: fix find photos api to return empty array if not found
Browse files Browse the repository at this point in the history
  • Loading branch information
gmkim20713 committed Nov 23, 2024
1 parent d5c1800 commit 8ec2f57
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import kr.mafoo.photo.domain.enums.BrandType;
import kr.mafoo.photo.domain.PhotoEntity;
import kr.mafoo.photo.exception.AlbumNotFoundException;
import kr.mafoo.photo.exception.PhotoDisplayIndexIsSameException;
import kr.mafoo.photo.exception.PhotoDisplayIndexNotValidException;
import kr.mafoo.photo.repository.PhotoRepository;
Expand Down Expand Up @@ -49,6 +50,7 @@ public Flux<PhotoEntity> findPhotoListByAlbumId(String albumId, String requestMe
String sortMethod = (sort == null) ? "CUSTOM" : sort.toUpperCase();

return albumPermissionVerifier.verifyOwnershipOrAccessPermission(albumId, requestMemberId, VIEW_ACCESS)
.onErrorResume(AlbumNotFoundException.class, ex -> Mono.empty())
.thenMany(
switch (sortMethod) {
case "ASC" -> photoQuery.findAllByAlbumIdOrderByCreatedAtAsc(albumId);
Expand Down

0 comments on commit 8ec2f57

Please sign in to comment.