diff --git a/src/main/java/com/capstone/BnagFer/domain/tactic/service/TacticService.java b/src/main/java/com/capstone/BnagFer/domain/tactic/service/TacticService.java index a4e87e6..43e6635 100644 --- a/src/main/java/com/capstone/BnagFer/domain/tactic/service/TacticService.java +++ b/src/main/java/com/capstone/BnagFer/domain/tactic/service/TacticService.java @@ -36,15 +36,6 @@ 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); @@ -52,7 +43,8 @@ public TacticResponse createTactic(TacticCreateRequest request, User user){ accountsCommonService.checkUserActivity(user); // 프로필 존재 확인 - saveUserTactic(user, tactic); + accountsCommonService.checkUserProfile(user); + tacticRepository.save(tactic); // 11개의 개별 포지션에 대한 설명 createPositionDetails(request.positionDetails(), tactic); @@ -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); } @@ -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); @@ -204,4 +198,4 @@ private void sendNotification(User user, Tactic tactic, Long parentCommentId, Ta } } -} +} \ No newline at end of file diff --git a/src/main/java/com/capstone/BnagFer/global/config/SecurityConfig.java b/src/main/java/com/capstone/BnagFer/global/config/SecurityConfig.java index 53d2a8a..1adf7b7 100644 --- a/src/main/java/com/capstone/BnagFer/global/config/SecurityConfig.java +++ b/src/main/java/com/capstone/BnagFer/global/config/SecurityConfig.java @@ -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);