Conversation
# Conflicts: # src/main/java/com/example/RealMatch/user/domain/entity/NotificationSetting.java # src/main/java/com/example/RealMatch/user/domain/entity/enums/TermName.java # src/main/java/com/example/RealMatch/user/domain/repository/NotificationSettingRepository.java
Summary of ChangesHello @ParkJiYeoung8297, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 사용자가 자신의 알림 설정을 조회하고 수정할 수 있는 기능을 도입합니다. 앱 푸시, 이메일, 마케팅 동의와 같은 알림 채널에 대한 사용자별 설정을 관리할 수 있도록 새로운 서비스 로직, API 엔드포인트, 관련 엔티티 및 저장소 변경 사항이 포함됩니다. 이는 사용자 경험을 개선하고 개인화된 알림 관리를 가능하게 합니다. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
| boolean wantMarketingConsent = request.isMarketingConsent(); | ||
|
|
||
| // Case 1: 동의 안 함 → 기존 row 있으면 삭제 | ||
| if (!wantMarketingConsent) { | ||
| optionalUserTerm.ifPresent(userTermRepository::delete); | ||
| return; | ||
| } | ||
|
|
||
| // Case 2: 동의 함 → 기존 row 없으면 생성 | ||
| if (optionalUserTerm.isEmpty()) { | ||
| Term marketingTerm = termRepository | ||
| .findByName(MARKETING_TERM_NAME) | ||
| .orElseThrow(() -> | ||
| new CustomException(UserErrorCode.INVALID_TERM) | ||
| ); | ||
|
|
||
| UserTerm newUserTerm = UserTerm.builder() | ||
| .user(setting.getUser()) | ||
| .term(marketingTerm) | ||
| .isAgreed(true) | ||
| .build(); | ||
|
|
||
| userTermRepository.save(newUserTerm); | ||
| } |
There was a problem hiding this comment.
마케팅 수신 동의 여부를 처리하는 로직이 return을 사용하여 두 부분으로 나뉘어 있어 흐름을 파악하기 다소 어렵습니다. if-else if 구조를 사용하여 동의/비동의 케이스를 명확하게 분리하면 가독성을 높일 수 있습니다.
boolean wantMarketingConsent = request.isMarketingConsent();
boolean hasMarketingConsent = optionalUserTerm.isPresent();
// Case 1: 동의 함 → 기존 row 없으면 생성
if (wantMarketingConsent && !hasMarketingConsent) {
Term marketingTerm = termRepository
.findByName(MARKETING_TERM_NAME)
.orElseThrow(() ->
new CustomException(UserErrorCode.INVALID_TERM)
);
UserTerm newUserTerm = UserTerm.builder()
.user(setting.getUser())
.term(marketingTerm)
.isAgreed(true)
.build();
userTermRepository.save(newUserTerm);
} else if (!wantMarketingConsent && hasMarketingConsent) { // Case 2: 동의 안 함 → 기존 row 있으면 삭제
optionalUserTerm.ifPresent(userTermRepository::delete);
}| public interface NotificationSettingRepository extends JpaRepository<NotificationSetting, Long> { | ||
|
|
||
| Optional<NotificationSetting> findByUserId(Long userId); | ||
| Optional<NotificationSetting> findOneByUserId(Long userId); |
…com:RealMatchTeam/BE into feat/#327-alarm-notification-setting
Summary
알림 설정 조회 및 수정 기능 추가
Changes
Type of Change
Related Issues
참고 사항