Skip to content

Commit

Permalink
Merge pull request #20 from GDSC-snowflowerthon/feature/10
Browse files Browse the repository at this point in the history
[Refactor] Get메서드 모두 pathVariable 형태로 변경
  • Loading branch information
soHyn authored Jan 12, 2024
2 parents 6ab3cc1 + dda2605 commit 618181d
Showing 1 changed file with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -41,24 +39,20 @@ public ResponseEntity<ResponseUpdateSubgoal> updateSubgoal(
return ResponseEntity.ok(responseUpdateSubgoal);
}

@GetMapping("/subgoal/{goalId}/progress")
public ResponseEntity<SubgoalResponse> getSubgoalInfoByUserId(
@PathVariable Long goalId,
@RequestBody @Validated GetUserIdRequest request
) {
SubgoalResponse subgoalResponse = subgoalService.getSubgoalInfoByUserId(request.getUserId());
@GetMapping("/subgoal/{userId}/progress")
public ResponseEntity<SubgoalResponse> 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<CompletedGoalInfoResponse> getCompletedGoalInfos(
@RequestBody @Validated GetUserIdRequest request)
@GetMapping("/snows/{userId}")
public ResponseEntity<CompletedGoalInfoResponse> getCompletedGoalInfos(@PathVariable Long userId)
{
CompletedGoalInfoResponse completedGoalInfoResponse = subgoalService.getCompletedGoalInfo(request.getUserId());
CompletedGoalInfoResponse completedGoalInfoResponse = subgoalService.getCompletedGoalInfo(userId);

return ResponseEntity.ok(completedGoalInfoResponse);
}
Expand Down

0 comments on commit 618181d

Please sign in to comment.