Skip to content

Commit

Permalink
[FIX] Album Example 삭제에 따른 분기처리 #138
Browse files Browse the repository at this point in the history
  • Loading branch information
jun02160 committed Mar 9, 2024
1 parent f8a69a8 commit 66c0253
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package sopt.org.umbba.api.controller.album;

import static sopt.org.umbba.api.config.jwt.JwtProvider.*;
import static sopt.org.umbba.api.service.album.AlbumService.*;
import static sopt.org.umbba.common.exception.SuccessType.*;
import static sopt.org.umbba.external.s3.S3BucketPrefix.*;

Expand Down Expand Up @@ -60,7 +61,9 @@ public ApiResponse<PreSignedUrlDto> getImgPreSignedUrl(@RequestBody final AlbumI
@ResponseStatus(HttpStatus.OK)
public ApiResponse deleteAlbum(@PathVariable final Long albumId, final Principal principal) {
String imgUrl = albumService.deleteAlbum(albumId, getUserFromPrincial(principal));
s3Service.deleteS3Image(imgUrl);
if (!imgUrl.equals(ALBUM_EXAMPLE)) { // Example Album의 이미지는 삭제하지 X
s3Service.deleteS3Image(imgUrl);
}
return ApiResponse.success(DELETE_ALBUM_SUCCESS);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class AlbumService {
private final AlbumRepository albumRepository;
private final UserRepository userRepository;

public static final String ALBUM_EXAMPLE = "example";

@Transactional
public Long createAlbum(final CreateAlbumRequestDto request, final String imgUrl, final Long userId) {

Expand Down Expand Up @@ -63,6 +65,7 @@ public String deleteAlbum(final Long albumId, final Long userId) {
// Sample Album을 삭제할 경우
if (albumId.equals(0L)) {
parentchild.updateDeleteSampleAlbum();
return ALBUM_EXAMPLE;
}

Album album = getAlbumById(albumId);
Expand Down

0 comments on commit 66c0253

Please sign in to comment.