From dda2605cd675be3ec20a099bb53b9085aa300b5d Mon Sep 17 00:00:00 2001 From: soHyn Date: Sat, 13 Jan 2024 01:27:56 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20Get=EB=A9=94=EC=84=9C=EB=93=9C=20?= =?UTF-8?q?=EB=AA=A8=EB=91=90=20pathVariable=20=ED=98=95=ED=83=9C=EB=A1=9C?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../subgoal/controller/SubgoalController.java | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/main/java/tenten/blooming/domain/subgoal/controller/SubgoalController.java b/src/main/java/tenten/blooming/domain/subgoal/controller/SubgoalController.java index fc36506..676f105 100644 --- a/src/main/java/tenten/blooming/domain/subgoal/controller/SubgoalController.java +++ b/src/main/java/tenten/blooming/domain/subgoal/controller/SubgoalController.java @@ -2,10 +2,8 @@ import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import tenten.blooming.domain.subgoal.dto.CompletedGoalInfoResponse; -import tenten.blooming.domain.subgoal.dto.GetUserIdRequest; import tenten.blooming.domain.subgoal.dto.ResponseUpdateSubgoal; import tenten.blooming.domain.subgoal.dto.SubgoalResponse; import tenten.blooming.domain.subgoal.entity.Subgoal; @@ -41,24 +39,20 @@ public ResponseEntity updateSubgoal( return ResponseEntity.ok(responseUpdateSubgoal); } - @GetMapping("/subgoal/{goalId}/progress") - public ResponseEntity getSubgoalInfoByUserId( - @PathVariable Long goalId, - @RequestBody @Validated GetUserIdRequest request - ) { - SubgoalResponse subgoalResponse = subgoalService.getSubgoalInfoByUserId(request.getUserId()); + @GetMapping("/subgoal/{userId}/progress") + public ResponseEntity getSubgoalInfoByUserId(@PathVariable Long userId) { + SubgoalResponse subgoalResponse = subgoalService.getSubgoalInfoByUserId(userId); - User findUser = userRepository.findById(request.getUserId()).orElse(null); + User findUser = userRepository.findById(userId).orElse(null); subgoalResponse.setNickname(findUser.getNickname()); return ResponseEntity.ok(subgoalResponse); } - @GetMapping("/snows") - public ResponseEntity getCompletedGoalInfos( - @RequestBody @Validated GetUserIdRequest request) + @GetMapping("/snows/{userId}") + public ResponseEntity getCompletedGoalInfos(@PathVariable Long userId) { - CompletedGoalInfoResponse completedGoalInfoResponse = subgoalService.getCompletedGoalInfo(request.getUserId()); + CompletedGoalInfoResponse completedGoalInfoResponse = subgoalService.getCompletedGoalInfo(userId); return ResponseEntity.ok(completedGoalInfoResponse); }