Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix :: 복지패스 발급 후 데이터 저장 문제 해결 #67

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,15 @@ public PolicyResponseDto getPolicy(Long policyId, HttpServletRequest request, Ht
.build();
}

@Transactional
public PolicyPathResponseDto makePolicyPath(Long userId, PolicyPathRequestDto requestDto) {
UserInfo userInfo = userInfoRepository.findById(userId)
.orElseThrow(() -> new UserNotFoundException("해당 ID의 유저 정보를 찾을 수 없습니다."));
userInfo.updateBirthDate(requestDto.birthDate());

PolicyPath tempPolicyPath = determinePolicyPath(requestDto);

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

return PolicyPathResponseDto.builder()
.policyPathNum(tempPolicyPath.getNumber())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public UserInfo(String email, String nickname) {
this.nickname = nickname;
favoritePolicies = new ArrayList<>();
favoriteWords = new ArrayList<>();
policyPaths = new ArrayList<>();
}

public void addFavoriteWord(Word word) {
Expand All @@ -83,7 +84,9 @@ public void removeFavoriteWord(Word word) {
}

public void addPolicyPath(PolicyPath policyPath) {
this.policyPaths.add(policyPath);
if (!policyPaths.contains(policyPath)) {
policyPaths.add(policyPath);
}
}

public void updateRefreshToken(String refreshToken) {
Expand Down
Loading