diff --git a/src/main/java/com/pyro/yolog/domain/diary/entity/Mood.java b/src/main/java/com/pyro/yolog/domain/diary/entity/Mood.java index 9bf3be1..3082801 100644 --- a/src/main/java/com/pyro/yolog/domain/diary/entity/Mood.java +++ b/src/main/java/com/pyro/yolog/domain/diary/entity/Mood.java @@ -17,12 +17,4 @@ public enum Mood { ANGRY("화나는"); private final String name; - - @JsonCreator - public static Mood parsing(String inputValue) { - return Stream.of(Mood.values()) - .filter(mood -> mood.getName().equals(inputValue)) - .findFirst() - .orElseThrow(RequestMoodNameInvalidException::new); - } } \ No newline at end of file diff --git a/src/main/java/com/pyro/yolog/domain/diary/entity/Weather.java b/src/main/java/com/pyro/yolog/domain/diary/entity/Weather.java index 8a21b52..eb9ecb0 100644 --- a/src/main/java/com/pyro/yolog/domain/diary/entity/Weather.java +++ b/src/main/java/com/pyro/yolog/domain/diary/entity/Weather.java @@ -17,12 +17,4 @@ public enum Weather { WINDS("바람"); private final String name; - - @JsonCreator - public static Weather parsing(String inputValue) { - return Stream.of(Weather.values()) - .filter(weather -> weather.getName().equals(inputValue)) - .findFirst() - .orElseThrow(RequestWeatherNameInvalidException::new); - } } diff --git a/src/main/java/com/pyro/yolog/global/s3/api/S3ImageApi.java b/src/main/java/com/pyro/yolog/global/s3/api/S3ImageApi.java index 9a9f3ff..4ac808c 100644 --- a/src/main/java/com/pyro/yolog/global/s3/api/S3ImageApi.java +++ b/src/main/java/com/pyro/yolog/global/s3/api/S3ImageApi.java @@ -7,6 +7,8 @@ import io.swagger.v3.oas.annotations.security.SecurityRequirement; import org.springframework.web.multipart.MultipartFile; +import java.util.List; + public interface S3ImageApi { @Operation( summary = "이미지 업로드", @@ -20,7 +22,7 @@ public interface S3ImageApi { description = "Created" ) }) - S3ImageDto uploadImage(MultipartFile image); + List uploadImage(List image); @Operation( summary = "이미지 삭제", diff --git a/src/main/java/com/pyro/yolog/global/s3/api/S3ImageImageController.java b/src/main/java/com/pyro/yolog/global/s3/api/S3ImageImageController.java index 381fa07..086e028 100644 --- a/src/main/java/com/pyro/yolog/global/s3/api/S3ImageImageController.java +++ b/src/main/java/com/pyro/yolog/global/s3/api/S3ImageImageController.java @@ -7,6 +7,8 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import java.util.List; + @RestController @RequiredArgsConstructor @RequestMapping("images") @@ -16,8 +18,8 @@ public class S3ImageImageController implements S3ImageApi { @ResponseStatus(HttpStatus.CREATED) @PostMapping("") @Override - public S3ImageDto uploadImage(@RequestPart(value = "image", required = false) MultipartFile image) { - return s3ImageService.uploadImage(image); + public List uploadImage(@RequestPart(value = "images", required = false) List images) { + return s3ImageService.uploadImage(images); } @ResponseStatus(HttpStatus.CREATED) diff --git a/src/main/java/com/pyro/yolog/global/s3/service/S3ImageService.java b/src/main/java/com/pyro/yolog/global/s3/service/S3ImageService.java index 86e2eaf..cf6c609 100644 --- a/src/main/java/com/pyro/yolog/global/s3/service/S3ImageService.java +++ b/src/main/java/com/pyro/yolog/global/s3/service/S3ImageService.java @@ -20,6 +20,7 @@ import java.net.URL; import java.net.URLDecoder; import java.nio.charset.StandardCharsets; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; @@ -34,9 +35,13 @@ public class S3ImageService { private final AmazonS3 amazonS3; - public S3ImageDto uploadImage(MultipartFile file) { - validateImageExtension(file.getOriginalFilename()); - return new S3ImageDto(uploadImageToS3(file)); + public List uploadImage(List files) { + List imageUrls = new ArrayList<>(); + files.forEach(file -> { + validateImageExtension(file.getOriginalFilename()); + imageUrls.add(new S3ImageDto(uploadImageToS3(file))); + }); + return imageUrls; } private void validateImageExtension(String fileName) {