diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/controller/MyVeggieDiaryController.java b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/controller/MyVeggieDiaryController.java index e8403cdb..403a9d69 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/controller/MyVeggieDiaryController.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/controller/MyVeggieDiaryController.java @@ -1,10 +1,7 @@ package com.modernfarmer.farmusspring.domain.myveggiegarden.controller; import com.modernfarmer.farmusspring.domain.auth.entity.CustomUser; -import com.modernfarmer.farmusspring.domain.myveggiegarden.dto.request.CommentDelete; -import com.modernfarmer.farmusspring.domain.myveggiegarden.dto.request.CommentUpdate; -import com.modernfarmer.farmusspring.domain.myveggiegarden.dto.request.CommentWrite; -import com.modernfarmer.farmusspring.domain.myveggiegarden.dto.request.Like; +import com.modernfarmer.farmusspring.domain.myveggiegarden.dto.request.*; import com.modernfarmer.farmusspring.domain.myveggiegarden.dto.response.*; import com.modernfarmer.farmusspring.domain.myveggiegarden.entity.Diary; import com.modernfarmer.farmusspring.domain.myveggiegarden.entity.DiaryComment; @@ -35,18 +32,15 @@ public class MyVeggieDiaryController { @PostMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE) public BaseResponseDto settingMyVeggieDiary( - @RequestPart(value = "file", required = false) MultipartFile multipartFile, - @RequestParam("content") String content, - @RequestParam("isOpen") boolean isOpen, - @RequestParam("state") String state, - @RequestParam("myVeggieId") Long myVeggieId - ) throws IOException { + @RequestPart(value = "image", required = false) MultipartFile multipartFile, + @RequestPart MyVeggieDiaryInsert myVeggieDiaryInsert + ) throws IOException { return myVeggieDiaryService.settingMyVeggieDiary( multipartFile, - content, - isOpen, - state, - myVeggieId + myVeggieDiaryInsert.getContent(), + myVeggieDiaryInsert.isOpen(), + myVeggieDiaryInsert.getState(), + myVeggieDiaryInsert.getMyVeggieId() ); } diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/dto/request/MyVeggieDiaryInsert.java b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/dto/request/MyVeggieDiaryInsert.java new file mode 100644 index 00000000..0bea6d7a --- /dev/null +++ b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/dto/request/MyVeggieDiaryInsert.java @@ -0,0 +1,21 @@ +package com.modernfarmer.farmusspring.domain.myveggiegarden.dto.request; + +import jakarta.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + + +@Getter +@AllArgsConstructor +@NoArgsConstructor +public class MyVeggieDiaryInsert { + @NotNull(message = "null 값을 가지면 안됩니다.") + String content; + + boolean isOpen; + @NotNull(message = "null 값을 가지면 안됩니다.") + String state; + @NotNull(message = "null 값을 가지면 안됩니다.") + Long myVeggieId; +} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/user/controller/UserController.java b/src/main/java/com/modernfarmer/farmusspring/domain/user/controller/UserController.java index aeddf9f2..d0dacfb8 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/user/controller/UserController.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/user/controller/UserController.java @@ -42,8 +42,8 @@ public BaseResponseDto deleteProfleImage(@AuthenticationPrincipal CustomUs @PostMapping(value = "/profile", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public BaseResponseDto settingProfile( @AuthenticationPrincipal CustomUser user, - @RequestParam("nickname") String nickname, - @RequestPart(value = "file", required = false) MultipartFile file + @RequestPart String nickname, + @RequestPart(value = "image", required = false) MultipartFile file ) throws IOException { return userService.settingProfile(user.getUserId(), file, nickname); }