Skip to content

Commit

Permalink
Hotfix/extension (#55)
Browse files Browse the repository at this point in the history
* hotfix: 리스트부분 nullable 가능 부분 수정 (#dev)

* hotfix: 이미지 확장자 소문자 요청 가능하도록 수정 (#dev)
  • Loading branch information
pparkjs authored Feb 3, 2024
1 parent 378878c commit 09f9327
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.listywave.image.application.domain;

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;

Expand All @@ -13,4 +17,12 @@ public enum ImageFileExtension {
;

private final String uploadExtension;

@JsonCreator
public static ImageFileExtension fromString(String key) {
return Arrays.stream(ImageFileExtension.values())
.filter(extensionType -> extensionType.name().equalsIgnoreCase(key))
.findFirst()
.orElseThrow(() -> new CustomException(ErrorCode.NOT_FOUND, "해당 이미지 확장자가 존재하지 않습니다."));
}
}

0 comments on commit 09f9327

Please sign in to comment.