Skip to content

Commit

Permalink
[REFACTOR] 탈퇴 회원 복구 API를 allowedUrls에 추가하기 (#199) (#200)
Browse files Browse the repository at this point in the history
* ♻️ refactor: TacticService 원복 (#199)

* ♻️ refactor: 탈퇴 회원 복구 API를 allowedUrls에 추가 (#199)
  • Loading branch information
jiiiiiw authored Sep 14, 2024
1 parent ebe0eb2 commit b78a467
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,15 @@ public class TacticService {
private final LikeRepository likeRepository;
private final ApplicationEventPublisher eventPublisher;

private void saveUserTactic(User user, Object tacticOrComment) {
accountsCommonService.checkUserProfile(user);
if (tacticOrComment instanceof Tactic) {
tacticRepository.save((Tactic) tacticOrComment);
} else if (tacticOrComment instanceof TacticComment) {
commentRepository.save((TacticComment) tacticOrComment);
}
}

public TacticResponse createTactic(TacticCreateRequest request, User user){

Tactic tactic = request.toEntity(user);

accountsCommonService.checkUserActivity(user);

// 프로필 존재 확인
saveUserTactic(user, tactic);
accountsCommonService.checkUserProfile(user);
tacticRepository.save(tactic);

// 11개의 개별 포지션에 대한 설명
createPositionDetails(request.positionDetails(), tactic);
Expand Down Expand Up @@ -109,7 +101,8 @@ public TacticResponse copyTactic(Long tacticId, User user) {
copyTactic.setCopyDetail(user, tactic);

// 프로필 존재 확인
saveUserTactic(user, copyTactic);
accountsCommonService.checkUserProfile(user);
tacticRepository.save(copyTactic);

return TacticResponse.from(copyTactic);
}
Expand All @@ -130,7 +123,8 @@ public CommentResponse createComment(Long tacticId, CommentCreateRequest request
TacticComment tacticComment = request.toEntity(user, tactic, parent);

// 프로필 존재 확인
saveUserTactic(user, tacticComment);
accountsCommonService.checkUserProfile(user);
commentRepository.save(tacticComment);
commentCount++;
redisUtil.saveCommentCount(tacticId, commentCount);

Expand Down Expand Up @@ -204,4 +198,4 @@ private void sendNotification(User user, Tactic tactic, Long parentCommentId, Ta
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class SecurityConfig {

private final String[] swaggerUrls = {"/swagger-ui/**", "/v3/**"};
private final String[] authUrls = {"/", "/accounts/signup/**", "/accounts/social/**", "/accounts/login/**",
"/api/v1/auth", "/oauth/kakao/**", "/accounts/reissue/**", "/accounts/forgotPw/**", "/accounts/email/send-email", "/accounts/email/verify", "/accounts/checkEmail"};
"/api/v1/auth", "/oauth/kakao/**", "/accounts/reissue/**", "/accounts/forgotPw/**", "/accounts/email/send-email", "/accounts/email/verify", "/accounts/checkEmail", "/accounts/recover/**"};
private final String[] allowedUrls = Stream.concat(Arrays.stream(swaggerUrls), Arrays.stream(authUrls))
.toArray(String[]::new);

Expand Down

0 comments on commit b78a467

Please sign in to comment.