diff --git a/src/main/java/com/goormdari/domain/routine/dto/request/CompleteRoutineRequest.java b/src/main/java/com/goormdari/domain/routine/dto/request/CompleteRoutineRequest.java index 6327241..0d4737f 100644 --- a/src/main/java/com/goormdari/domain/routine/dto/request/CompleteRoutineRequest.java +++ b/src/main/java/com/goormdari/domain/routine/dto/request/CompleteRoutineRequest.java @@ -1,13 +1,17 @@ package com.goormdari.domain.routine.dto.request; import lombok.Builder; +import lombok.Getter; +import org.springframework.web.multipart.MultipartFile; @Builder public record CompleteRoutineRequest ( Long routineIndex, - String routineName + String routineName, + + MultipartFile file ) { diff --git a/src/main/java/com/goormdari/domain/routine/presentation/RoutineController.java b/src/main/java/com/goormdari/domain/routine/presentation/RoutineController.java index 17a94c6..9c3b00a 100644 --- a/src/main/java/com/goormdari/domain/routine/presentation/RoutineController.java +++ b/src/main/java/com/goormdari/domain/routine/presentation/RoutineController.java @@ -44,8 +44,7 @@ public class RoutineController { @PostMapping("/upload") public ResponseCustom uploadRoutine( @Parameter(description = "Accesstoken을 입력해주세요.", required = true) @RequestHeader("Authorization") String token, - @Parameter(description = "Schemas의 completeRoutineRequest를 참고해주세요.", required = true) @Valid @RequestBody CompleteRoutineRequest completeRoutineRequest, - @Parameter(description = "file 이미지 업로드", required = true) @Valid @RequestParam("file") MultipartFile file + @Parameter(description = "Schemas의 completeRoutineRequest를 참고해주세요.", required = true) @Valid @ModelAttribute CompleteRoutineRequest completeRoutineRequest ) { if (token == null) { throw new InvalidTokenException(); @@ -56,7 +55,7 @@ public ResponseCustom uploadRoutine( throw new IllegalArgumentException("Invalid token"); } Long userId = jwtUtil.extractId(jwt); - String imgURL = s3Service.uploadImageToS3(file); + String imgURL = s3Service.uploadImageToS3(completeRoutineRequest.file()); return ResponseCustom.OK(routineService.completeRoutine(userId, completeRoutineRequest, imgURL)); }