-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
284 additions
and
371 deletions.
There are no files selected for viewing
20 changes: 8 additions & 12 deletions
20
src/main/java/com/listywave/image/application/domain/ImageFileExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,27 @@ | ||
package com.listywave.image.application.domain; | ||
|
||
import static com.listywave.common.exception.ErrorCode.RESOURCE_NOT_FOUND; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.listywave.common.exception.CustomException; | ||
import com.listywave.common.exception.ErrorCode; | ||
import java.util.Arrays; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
// TODO: 정수씨 이 쪽 나중에 테스트 부탁해요~ | ||
// TODO: ImageService 쪽에서 많이 쓰이고 있어서 쉽게 리팩터링 못하겠네요.. | ||
// TODO: uploadExtension 필드 제거하고 `fromString`을 `ofName` 로 바꿔주세요! | ||
@Getter | ||
@AllArgsConstructor | ||
public enum ImageFileExtension { | ||
|
||
JPEG("jpeg"), | ||
JPG("jpg"), | ||
PNG("png"), | ||
JPEG, | ||
JPG, | ||
PNG, | ||
; | ||
|
||
private final String uploadExtension; | ||
|
||
@JsonCreator | ||
public static ImageFileExtension fromString(String key) { | ||
public static ImageFileExtension ofName(String value) { | ||
return Arrays.stream(ImageFileExtension.values()) | ||
.filter(extensionType -> extensionType.name().equalsIgnoreCase(key)) | ||
.filter(extensionType -> extensionType.name().equalsIgnoreCase(value)) | ||
.findFirst() | ||
.orElseThrow(() -> new CustomException(ErrorCode.RESOURCE_NOT_FOUND, "해당 이미지 확장자가 존재하지 않습니다.")); | ||
.orElseThrow(() -> new CustomException(RESOURCE_NOT_FOUND, "지원하지 않는 이미지 확장자입니다.")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,5 +10,6 @@ public enum ImageType { | |
LISTS_ITEM, | ||
USER_PROFILE, | ||
USER_BACKGROUND, | ||
NOTICE, | ||
; | ||
} |
13 changes: 0 additions & 13 deletions
13
src/main/java/com/listywave/image/application/dto/response/ItemPresignedUrlResponse.java
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
src/main/java/com/listywave/image/application/dto/response/ListItemPresignedUrlResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.listywave.image.application.dto.response; | ||
|
||
public record ListItemPresignedUrlResponse( | ||
int rank, | ||
String presignedUrl | ||
) { | ||
|
||
public static ListItemPresignedUrlResponse from(int rank, String presignedUrl) { | ||
return new ListItemPresignedUrlResponse(rank, presignedUrl); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...ain/java/com/listywave/image/application/dto/response/UserPresignedUrlCreateResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.listywave.image.application.dto.response; | ||
|
||
public record UserPresignedUrlCreateResponse( | ||
Long userId, | ||
String profilePresignedUrl, | ||
String backgroundPresignedUrl | ||
) { | ||
|
||
public static UserPresignedUrlCreateResponse of(Long userId, String profilePresignedUrl, String backgroundPresignedUrl) { | ||
return new UserPresignedUrlCreateResponse(userId, profilePresignedUrl, backgroundPresignedUrl); | ||
} | ||
} |
15 changes: 0 additions & 15 deletions
15
src/main/java/com/listywave/image/application/dto/response/UserPresignedUrlResponse.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.