Skip to content

Commit

Permalink
Merge pull request #66 from 9oormthon-univ/hyundong
Browse files Browse the repository at this point in the history
fix :: 복지패스 조회 반환 값 수정
  • Loading branch information
hyundong-L authored Dec 6, 2024
2 parents 176d377 + 7833f54 commit e71240e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.danpoong.onchung.domain.policy.controller;

import com.danpoong.onchung.domain.policy.domain.enums.PolicyPath;
import com.danpoong.onchung.domain.policy.dto.PolicyPathRequestDto;
import com.danpoong.onchung.domain.policy.dto.PolicyPathResponseDto;
import com.danpoong.onchung.domain.policy.dto.PolicyResponseDto;
Expand Down Expand Up @@ -40,7 +39,7 @@ public ResponseTemplate<PolicyPathResponseDto> makePolicyPath(

@Operation(summary = "발급 받은 복지패스 조회")
@GetMapping("/path")
public ResponseTemplate<List<PolicyPath>> getPolicyPath(@AuthenticationPrincipal Long userId) {
public ResponseTemplate<List<Integer>> getPolicyPath(@AuthenticationPrincipal Long userId) {
return new ResponseTemplate<>(HttpStatus.OK, "발급한 복지패스 조회 성공", policyService.getPolicyPaths(userId));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,19 @@ public PolicyPathResponseDto makePolicyPath(Long userId, PolicyPathRequestDto re

PolicyPath tempPolicyPath = determinePolicyPath(requestDto);

userInfo.addPolicyPath(tempPolicyPath);
if (!userInfo.getPolicyPaths().contains(tempPolicyPath)) {
userInfo.addPolicyPath(tempPolicyPath);
}

return PolicyPathResponseDto.builder()
.policyPathNum(tempPolicyPath.getNumber())
.build();
}

public List<PolicyPath> getPolicyPaths(Long userId) {
public List<Integer> getPolicyPaths(Long userId) {
UserInfo userInfo = userInfoRepository.findById(userId).orElseThrow(() -> new UserNotFoundException("해당 ID의 유저 정보를 찾을 수 없습니다."));
return userInfo.getPolicyPaths();

return userInfo.getPolicyPaths().stream().map(PolicyPath::getNumber).toList();
}

private PolicyPath determinePolicyPath(PolicyPathRequestDto requestDto) {
Expand Down

0 comments on commit e71240e

Please sign in to comment.