Skip to content

Commit

Permalink
Merge branch 'dev' into feat/327
Browse files Browse the repository at this point in the history
  • Loading branch information
pparkjs authored Nov 11, 2024
2 parents 9f30f66 + 4592773 commit 8e05303
Show file tree
Hide file tree
Showing 17 changed files with 284 additions and 371 deletions.
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, "지원하지 않는 이미지 확장자입니다."));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ public enum ImageType {
LISTS_ITEM,
USER_PROFILE,
USER_BACKGROUND,
NOTICE,
;
}

This file was deleted.

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);
}
}
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);
}
}

This file was deleted.

Loading

0 comments on commit 8e05303

Please sign in to comment.