diff --git a/umbba-api/src/main/java/sopt/org/umbba/api/controller/album/AlbumController.java b/umbba-api/src/main/java/sopt/org/umbba/api/controller/album/AlbumController.java index d0f46a1f..ce88bacc 100644 --- a/umbba-api/src/main/java/sopt/org/umbba/api/controller/album/AlbumController.java +++ b/umbba-api/src/main/java/sopt/org/umbba/api/controller/album/AlbumController.java @@ -41,6 +41,8 @@ public class AlbumController { private final AlbumService albumService; private final S3Service s3Service; + private static final String DEFAULT_ALBUM_IMG = "default_img.png"; + @PostMapping @ResponseStatus(HttpStatus.CREATED) public ApiResponse createAlbum(@Valid @RequestBody final CreateAlbumRequestDto request, final Principal principal, HttpServletResponse response) { @@ -70,6 +72,7 @@ public ApiResponse deleteAlbum(@PathVariable final Long albumId, final Principal @GetMapping @ResponseStatus(HttpStatus.OK) public ApiResponse> getAlbumList(final Principal principal) { - return ApiResponse.success(GET_ALBUM_LIST_SUCCESS, albumService.getAlbumList(getUserFromPrincial(principal))); + String defaultImgUrl = s3Service.getS3ImgUrl(ALBUM_PREFIX.getValue(), DEFAULT_ALBUM_IMG); + return ApiResponse.success(GET_ALBUM_LIST_SUCCESS, albumService.getAlbumList(defaultImgUrl, getUserFromPrincial(principal))); } } \ No newline at end of file diff --git a/umbba-api/src/main/java/sopt/org/umbba/api/service/album/AlbumService.java b/umbba-api/src/main/java/sopt/org/umbba/api/service/album/AlbumService.java index 1a0af765..b6868cca 100644 --- a/umbba-api/src/main/java/sopt/org/umbba/api/service/album/AlbumService.java +++ b/umbba-api/src/main/java/sopt/org/umbba/api/service/album/AlbumService.java @@ -77,7 +77,7 @@ public String deleteAlbum(final Long albumId, final Long userId) { return album.getImgUrl(); } - public List getAlbumList(final Long userId) { + public List getAlbumList(final String defaultImgUrl, final Long userId) { User user = getUserById(userId); Parentchild parentchild = getParentchildByUser(user); List albumList = albumRepository.findAllByParentchildOrderByCreatedAtDesc( @@ -85,7 +85,7 @@ public List getAlbumList(final Long userId) { // Album을 아직 한번도 등록하지 않은 경우 if (albumList.isEmpty() && !parentchild.isFirstAlbumUpload() && !parentchild.isDeleteSampleAlbum()) { - return List.of(AlbumResponseDto.of(createAlbumExample())); + return List.of(AlbumResponseDto.of(createAlbumExample(defaultImgUrl))); } return albumList.stream() @@ -93,9 +93,8 @@ public List getAlbumList(final Long userId) { .collect(Collectors.toList()); } - private Album createAlbumExample() { - return new Album(0L, "사진의 제목을 입력할 수 있어요", "사진에 대해 소개해요", - "https://i1.sndcdn.com/artworks-l2lCmUXC61XR2HM5-gwB8Vg-t500x500.jpg", "직성자"); // TODO 기획 측에서 전달받은 이미지 url로 변경 + private Album createAlbumExample(final String defaultImgUrl) { + return new Album(0L, "사진의 제목을 입력할 수 있어요", "사진에 대해 소개해요", defaultImgUrl, "직성자"); } private User getUserById(Long userId) { // TODO userId -> Parentchild 한번에 가져오기