From 60fda1ca3776ca2967490ed76a276e8fff236de9 Mon Sep 17 00:00:00 2001 From: MinchoGreenT Date: Sun, 2 Jun 2024 02:15:30 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20=EC=9C=A0=EC=A0=80=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=ED=95=84=20=EB=B3=80=EA=B2=BD=20=EC=BD=94=EB=93=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/user/controller/UserController.java | 12 ++++++------ .../domain/user/dto/request/UpdateProfileDto.java | 6 ++++++ 2 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/modernfarmer/farmusspring/domain/user/dto/request/UpdateProfileDto.java 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 56be7c6d..2f447ff6 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 @@ -2,6 +2,7 @@ import com.modernfarmer.farmusspring.domain.auth.entity.CustomUser; import com.modernfarmer.farmusspring.domain.user.dto.request.SetLevelRequest; +import com.modernfarmer.farmusspring.domain.user.dto.request.UpdateProfileDto; import com.modernfarmer.farmusspring.domain.user.dto.response.SetLevelResponse; import com.modernfarmer.farmusspring.domain.user.dto.response.UserProfileResponse; import com.modernfarmer.farmusspring.domain.user.service.UserService; @@ -38,14 +39,13 @@ public BaseResponseDto deleteProfleImage(@AuthenticationPrincipal CustomUs return userService.deleteProfleImage(user.getUserId()); } - @PostMapping(value = "/profile", produces = MediaType.APPLICATION_JSON_VALUE) + @PostMapping(value = "/profile") public BaseResponseDto settingProfile( @AuthenticationPrincipal CustomUser user, - @RequestPart(value = "file", required = false) MultipartFile multipartFile, - @RequestParam("nickName") String nickName) throws IOException { - - return userService.settingProfile(user.getUserId(), multipartFile,nickName); - + @RequestPart UpdateProfileDto requestDto, + @RequestPart(value = "file", required = false) MultipartFile file + ) throws IOException { + return userService.settingProfile(user.getUserId(), file, requestDto.nickname()); } } diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/user/dto/request/UpdateProfileDto.java b/src/main/java/com/modernfarmer/farmusspring/domain/user/dto/request/UpdateProfileDto.java new file mode 100644 index 00000000..d668fa3a --- /dev/null +++ b/src/main/java/com/modernfarmer/farmusspring/domain/user/dto/request/UpdateProfileDto.java @@ -0,0 +1,6 @@ +package com.modernfarmer.farmusspring.domain.user.dto.request; + +public record UpdateProfileDto( + String nickname +) { +}