Skip to content

Commit

Permalink
Merge pull request #121 from Me1tingPot/feature/#119
Browse files Browse the repository at this point in the history
fix : ์œ ์ € ํ”„๋กœํ•„ ๊ธฐ๋ณธ ์ด๋ฏธ์ง€ ์„ค์ •
  • Loading branch information
yewonahn authored Jul 2, 2024
2 parents 8231409 + 3f38a96 commit b25911e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import meltingpot.server.domain.repository.chat.ChatMessageRepository;
import meltingpot.server.domain.repository.chat.ChatRoomRepository;
import meltingpot.server.domain.repository.chat.ChatRoomUserRepository;
import meltingpot.server.domain.repository.party.PartyRepository;
import meltingpot.server.exception.ResourceNotFoundException;
import meltingpot.server.util.r2.FileService;
import org.springframework.data.domain.PageRequest;
Expand All @@ -33,7 +32,6 @@ public class ChatRoomQueryService {
private final ChatRoomUserRepository chatRoomUserRepository;
private final ChatRoomRepository chatRoomRepository;
private final ChatMessageRepository chatMessageRepository;
private final PartyRepository partyRepository;
private final AccountProfileImageRepository accountProfileImageRepository;
private final FileService fileService;

Expand Down Expand Up @@ -67,8 +65,10 @@ public ChatRoomsPageResponse getChatRooms(Account account, int page, int size) {
}

public String getThumbnailUrl(Account account) {
AccountProfileImage thumbnail = accountProfileImageRepository.findByAccountAndIsThumbnailTrue(account).orElseThrow();
AccountProfileImage thumbnail = accountProfileImageRepository.findByAccountAndIsThumbnailTrue(account).orElse(null);

return fileService.getCdnUrl("userProfile-image", thumbnail.getImageKey());
return thumbnail != null
? fileService.getCdnUrl("userProfile-image", thumbnail.getImageKey())
: "default-thumbnail-url";
}
}

0 comments on commit b25911e

Please sign in to comment.