From 4802abbbe4b03c16a19b1563a4fc5a381f70ec32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=9E=AC=ED=98=81?= Date: Sat, 28 Sep 2024 23:53:33 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20:recycle:=20user=20=EB=94=94?= =?UTF-8?q?=EB=A0=89=ED=86=A0=EB=A6=AC=20=EA=B5=AC=EC=A1=B0=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#54)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 몇가지 소소한 수정 * refactor: :recycle: user 디렉토리 구조 수정 (#53) --- .../routine/presentation/RoutineController.java | 7 ++++++- .../dto/response/findCurrentStepResponse.java | 7 ------- .../{domain => }/dto/request/AddUserRequest.java | 2 +- .../{domain => }/dto/request/LoginRequest.java | 2 +- .../dto/request/UpdateUserRequest.java | 0 .../dto/response/FindCurrentStepResponse.java | 7 +++++++ .../{domain => }/dto/response/JwtResponse.java | 2 +- .../dto/response/UserInfoResponse.java | 2 +- .../domain/user/presentation/AuthController.java | 8 ++++---- .../domain/user/presentation/UserController.java | 10 ++++++++-- .../service/CustomUserDetailsService.java | 2 +- .../user/{domain => }/service/UserService.java | 16 +++++++++++++--- 12 files changed, 43 insertions(+), 22 deletions(-) delete mode 100644 src/main/java/com/goormdari/domain/user/domain/dto/response/findCurrentStepResponse.java rename src/main/java/com/goormdari/domain/user/{domain => }/dto/request/AddUserRequest.java (88%) rename src/main/java/com/goormdari/domain/user/{domain => }/dto/request/LoginRequest.java (88%) rename src/main/java/com/goormdari/domain/user/{domain => }/dto/request/UpdateUserRequest.java (100%) create mode 100644 src/main/java/com/goormdari/domain/user/dto/response/FindCurrentStepResponse.java rename src/main/java/com/goormdari/domain/user/{domain => }/dto/response/JwtResponse.java (85%) rename src/main/java/com/goormdari/domain/user/{domain => }/dto/response/UserInfoResponse.java (85%) rename src/main/java/com/goormdari/domain/user/{domain => }/service/CustomUserDetailsService.java (95%) rename src/main/java/com/goormdari/domain/user/{domain => }/service/UserService.java (89%) 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 0213c0a..390bd40 100644 --- a/src/main/java/com/goormdari/domain/routine/presentation/RoutineController.java +++ b/src/main/java/com/goormdari/domain/routine/presentation/RoutineController.java @@ -5,7 +5,7 @@ import com.goormdari.domain.routine.application.RoutineService; import com.goormdari.domain.routine.domain.Routine; import com.goormdari.domain.routine.dto.request.CompleteRoutineRequest; -import com.goormdari.domain.user.domain.service.UserService; +import com.goormdari.domain.user.service.UserService; import com.goormdari.global.config.security.jwt.JWTUtil; import com.goormdari.global.config.s3.S3Service; import com.goormdari.global.payload.ErrorResponse; @@ -95,4 +95,9 @@ public ResponseCustom> getAllRoutineByUserId( return ResponseCustom.OK(routineService.findAllRoutineByUserId(userId)); } + @PostMapping("/temp/uploader") + public String uploadTempImage(@ModelAttribute MultipartFile file) { + String url = s3Service.uploadImageToS3(file); + return url; + } } diff --git a/src/main/java/com/goormdari/domain/user/domain/dto/response/findCurrentStepResponse.java b/src/main/java/com/goormdari/domain/user/domain/dto/response/findCurrentStepResponse.java deleted file mode 100644 index 831ea00..0000000 --- a/src/main/java/com/goormdari/domain/user/domain/dto/response/findCurrentStepResponse.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.goormdari.domain.user.domain.dto.response; - -import lombok.Builder; - -@Builder -public record findCurrentStepResponse (int currentStep) { -} diff --git a/src/main/java/com/goormdari/domain/user/domain/dto/request/AddUserRequest.java b/src/main/java/com/goormdari/domain/user/dto/request/AddUserRequest.java similarity index 88% rename from src/main/java/com/goormdari/domain/user/domain/dto/request/AddUserRequest.java rename to src/main/java/com/goormdari/domain/user/dto/request/AddUserRequest.java index a1fd982..7b2ef8c 100644 --- a/src/main/java/com/goormdari/domain/user/domain/dto/request/AddUserRequest.java +++ b/src/main/java/com/goormdari/domain/user/dto/request/AddUserRequest.java @@ -1,4 +1,4 @@ -package com.goormdari.domain.user.domain.dto.request; +package com.goormdari.domain.user.dto.request; import jakarta.validation.constraints.NotBlank; import lombok.*; diff --git a/src/main/java/com/goormdari/domain/user/domain/dto/request/LoginRequest.java b/src/main/java/com/goormdari/domain/user/dto/request/LoginRequest.java similarity index 88% rename from src/main/java/com/goormdari/domain/user/domain/dto/request/LoginRequest.java rename to src/main/java/com/goormdari/domain/user/dto/request/LoginRequest.java index 3f412ff..61bd37e 100644 --- a/src/main/java/com/goormdari/domain/user/domain/dto/request/LoginRequest.java +++ b/src/main/java/com/goormdari/domain/user/dto/request/LoginRequest.java @@ -1,4 +1,4 @@ -package com.goormdari.domain.user.domain.dto.request; +package com.goormdari.domain.user.dto.request; import jakarta.validation.constraints.NotBlank; import lombok.AllArgsConstructor; diff --git a/src/main/java/com/goormdari/domain/user/domain/dto/request/UpdateUserRequest.java b/src/main/java/com/goormdari/domain/user/dto/request/UpdateUserRequest.java similarity index 100% rename from src/main/java/com/goormdari/domain/user/domain/dto/request/UpdateUserRequest.java rename to src/main/java/com/goormdari/domain/user/dto/request/UpdateUserRequest.java diff --git a/src/main/java/com/goormdari/domain/user/dto/response/FindCurrentStepResponse.java b/src/main/java/com/goormdari/domain/user/dto/response/FindCurrentStepResponse.java new file mode 100644 index 0000000..7556e6d --- /dev/null +++ b/src/main/java/com/goormdari/domain/user/dto/response/FindCurrentStepResponse.java @@ -0,0 +1,7 @@ +package com.goormdari.domain.user.dto.response; + +import lombok.Builder; + +@Builder +public record FindCurrentStepResponse(int currentStep) { +} diff --git a/src/main/java/com/goormdari/domain/user/domain/dto/response/JwtResponse.java b/src/main/java/com/goormdari/domain/user/dto/response/JwtResponse.java similarity index 85% rename from src/main/java/com/goormdari/domain/user/domain/dto/response/JwtResponse.java rename to src/main/java/com/goormdari/domain/user/dto/response/JwtResponse.java index 1e40268..d7e56b7 100644 --- a/src/main/java/com/goormdari/domain/user/domain/dto/response/JwtResponse.java +++ b/src/main/java/com/goormdari/domain/user/dto/response/JwtResponse.java @@ -1,4 +1,4 @@ -package com.goormdari.domain.user.domain.dto.response; +package com.goormdari.domain.user.dto.response; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/src/main/java/com/goormdari/domain/user/domain/dto/response/UserInfoResponse.java b/src/main/java/com/goormdari/domain/user/dto/response/UserInfoResponse.java similarity index 85% rename from src/main/java/com/goormdari/domain/user/domain/dto/response/UserInfoResponse.java rename to src/main/java/com/goormdari/domain/user/dto/response/UserInfoResponse.java index 84b9d9b..f68d119 100644 --- a/src/main/java/com/goormdari/domain/user/domain/dto/response/UserInfoResponse.java +++ b/src/main/java/com/goormdari/domain/user/dto/response/UserInfoResponse.java @@ -1,4 +1,4 @@ -package com.goormdari.domain.user.domain.dto.response; +package com.goormdari.domain.user.dto.response; import lombok.Builder; import lombok.Getter; diff --git a/src/main/java/com/goormdari/domain/user/presentation/AuthController.java b/src/main/java/com/goormdari/domain/user/presentation/AuthController.java index bb59fcc..89bf782 100644 --- a/src/main/java/com/goormdari/domain/user/presentation/AuthController.java +++ b/src/main/java/com/goormdari/domain/user/presentation/AuthController.java @@ -1,9 +1,9 @@ package com.goormdari.domain.user.presentation; -import com.goormdari.domain.user.domain.dto.request.AddUserRequest; -import com.goormdari.domain.user.domain.dto.response.JwtResponse; -import com.goormdari.domain.user.domain.dto.request.LoginRequest; -import com.goormdari.domain.user.domain.service.UserService; +import com.goormdari.domain.user.dto.request.AddUserRequest; +import com.goormdari.domain.user.dto.response.JwtResponse; +import com.goormdari.domain.user.dto.request.LoginRequest; +import com.goormdari.domain.user.service.UserService; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; diff --git a/src/main/java/com/goormdari/domain/user/presentation/UserController.java b/src/main/java/com/goormdari/domain/user/presentation/UserController.java index 6267f79..225a509 100644 --- a/src/main/java/com/goormdari/domain/user/presentation/UserController.java +++ b/src/main/java/com/goormdari/domain/user/presentation/UserController.java @@ -1,10 +1,16 @@ package com.goormdari.domain.user.presentation; import com.goormdari.domain.calendar.exception.InvalidTokenException; +<<<<<<< HEAD +import com.goormdari.domain.user.dto.response.UserInfoResponse; +import com.goormdari.domain.user.service.UserService; +import com.goormdari.domain.user.dto.response.FindCurrentStepResponse; +======= import com.goormdari.domain.user.domain.dto.request.UpdateUserRequest; import com.goormdari.domain.user.domain.dto.response.UserInfoResponse; import com.goormdari.domain.user.domain.service.UserService; import com.goormdari.domain.user.domain.dto.response.findCurrentStepResponse; +>>>>>>> main import com.goormdari.global.config.security.jwt.JWTUtil; import com.goormdari.global.payload.ErrorResponse; import com.goormdari.global.payload.ResponseCustom; @@ -31,11 +37,11 @@ public class UserController { @Operation(summary = "현재 루틴 수 조회", description = "사용자가 완수한 루틴의 개수") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "조회 성공 ", content = {@Content(mediaType = "application/json", schema = @Schema(implementation = findCurrentStepResponse.class))}), + @ApiResponse(responseCode = "200", description = "조회 성공 ", content = {@Content(mediaType = "application/json", schema = @Schema(implementation = FindCurrentStepResponse.class))}), @ApiResponse(responseCode = "400", description = "조회 실패", content = {@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class))}), }) @GetMapping("/current-step") - public ResponseCustom getCurrentStep( + public ResponseCustom getCurrentStep( @Parameter(description = "Accesstoken을 입력해주세요.", required = true) @RequestHeader("Authorization") String token ) { if (token == null) { diff --git a/src/main/java/com/goormdari/domain/user/domain/service/CustomUserDetailsService.java b/src/main/java/com/goormdari/domain/user/service/CustomUserDetailsService.java similarity index 95% rename from src/main/java/com/goormdari/domain/user/domain/service/CustomUserDetailsService.java rename to src/main/java/com/goormdari/domain/user/service/CustomUserDetailsService.java index f0cf4ed..befdc0b 100644 --- a/src/main/java/com/goormdari/domain/user/domain/service/CustomUserDetailsService.java +++ b/src/main/java/com/goormdari/domain/user/service/CustomUserDetailsService.java @@ -1,4 +1,4 @@ -package com.goormdari.domain.user.domain.service; +package com.goormdari.domain.user.service; import com.goormdari.domain.user.domain.CustomUserDetails; import com.goormdari.domain.user.domain.User; diff --git a/src/main/java/com/goormdari/domain/user/domain/service/UserService.java b/src/main/java/com/goormdari/domain/user/service/UserService.java similarity index 89% rename from src/main/java/com/goormdari/domain/user/domain/service/UserService.java rename to src/main/java/com/goormdari/domain/user/service/UserService.java index 86abe8c..56de80a 100644 --- a/src/main/java/com/goormdari/domain/user/domain/service/UserService.java +++ b/src/main/java/com/goormdari/domain/user/service/UserService.java @@ -1,6 +1,15 @@ -package com.goormdari.domain.user.domain.service; +package com.goormdari.domain.user.service; import com.amazonaws.services.kms.model.NotFoundException; +<<<<<<< HEAD:src/main/java/com/goormdari/domain/user/service/UserService.java +import com.goormdari.domain.user.dto.response.UserInfoResponse; +import com.goormdari.domain.user.dto.response.FindCurrentStepResponse; +import com.goormdari.domain.user.domain.User; +import com.goormdari.domain.user.domain.DefaultProfileUrl; +import com.goormdari.domain.user.dto.request.AddUserRequest; +import com.goormdari.domain.user.dto.request.LoginRequest; +import com.goormdari.domain.user.dto.response.JwtResponse; +======= import com.goormdari.domain.user.domain.exception.InvalidPasswordException; import com.goormdari.domain.user.domain.dto.request.UpdateUserRequest; import com.goormdari.domain.user.domain.dto.response.UserInfoResponse; @@ -10,6 +19,7 @@ import com.goormdari.domain.user.domain.dto.request.AddUserRequest; import com.goormdari.domain.user.domain.dto.request.LoginRequest; import com.goormdari.domain.user.domain.dto.response.JwtResponse; +>>>>>>> main:src/main/java/com/goormdari/domain/user/domain/service/UserService.java import com.goormdari.domain.user.domain.repository.UserRepository; import com.goormdari.global.config.security.jwt.JWTUtil; @@ -36,11 +46,11 @@ public class UserService { private final JWTUtil jwtUtil; @Transactional - public findCurrentStepResponse findCurrentStepById(Long userId) { + public FindCurrentStepResponse findCurrentStepById(Long userId) { User user = userRepository.findById(userId) .orElseThrow(()->new NotFoundException("User Not Found")); - return findCurrentStepResponse.builder().currentStep(user.getCurrentStep()).build(); + return FindCurrentStepResponse.builder().currentStep(user.getCurrentStep()).build(); } @Transactional