-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
791 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/main/java/com/gamzabat/algohub/feature/notification/domain/NotificationSetting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.gamzabat.algohub.feature.notification.domain; | ||
|
||
import com.gamzabat.algohub.feature.group.studygroup.domain.GroupMember; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.OneToOne; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor | ||
public class NotificationSetting { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@OneToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "member_id") | ||
private GroupMember member; | ||
|
||
private boolean allNotifications; | ||
private boolean newProblem; | ||
private boolean newSolution; | ||
private boolean newComment; | ||
private boolean newMember; | ||
private boolean deadlineReached; | ||
|
||
@Builder | ||
public NotificationSetting(GroupMember member) { | ||
this.member = member; | ||
this.allNotifications = true; | ||
this.newProblem = true; | ||
this.newSolution = true; | ||
this.newComment = true; | ||
this.newMember = true; | ||
this.deadlineReached = true; | ||
} | ||
|
||
public void editSettings(boolean all, boolean newProblem, boolean newSolution, boolean newComment, | ||
boolean newMember, boolean deadlineReached) { | ||
this.allNotifications = all; | ||
this.newProblem = newProblem; | ||
this.newSolution = newSolution; | ||
this.newComment = newComment; | ||
this.newMember = newMember; | ||
this.deadlineReached = deadlineReached; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...in/java/com/gamzabat/algohub/feature/notification/dto/EditNotificationSettingRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.gamzabat.algohub.feature.notification.dto; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
|
||
public record EditNotificationSettingRequest(@NotNull(message = "그룹 아이디는 필수 입력입니다.") Long groupId, | ||
boolean all, | ||
boolean newProblem, | ||
boolean newSolution, | ||
boolean newComment, | ||
boolean newMember, | ||
boolean deadlineReached) { | ||
} |
29 changes: 29 additions & 0 deletions
29
...in/java/com/gamzabat/algohub/feature/notification/dto/GetNotificationSettingResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.gamzabat.algohub.feature.notification.dto; | ||
|
||
import com.gamzabat.algohub.feature.notification.domain.NotificationSetting; | ||
|
||
import lombok.Builder; | ||
|
||
@Builder | ||
public record GetNotificationSettingResponse(Long groupId, | ||
String groupName, | ||
boolean allNotifications, | ||
boolean newProblem, | ||
boolean newSolution, | ||
boolean newComment, | ||
boolean newMember, | ||
boolean deadlineReached) { | ||
|
||
public static GetNotificationSettingResponse toDTO(NotificationSetting setting) { | ||
return GetNotificationSettingResponse.builder() | ||
.groupId(setting.getMember().getStudyGroup().getId()) | ||
.groupName(setting.getMember().getStudyGroup().getName()) | ||
.allNotifications(setting.isAllNotifications()) | ||
.newProblem(setting.isNewProblem()) | ||
.newSolution(setting.isNewSolution()) | ||
.newComment(setting.isNewComment()) | ||
.newMember(setting.isNewMember()) | ||
.deadlineReached(setting.isDeadlineReached()) | ||
.build(); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/gamzabat/algohub/feature/notification/enums/NotificationCategory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.gamzabat.algohub.feature.notification.enums; | ||
|
||
public enum NotificationCategory { | ||
PROBLEM_STARTED("[%s] 문제가 시작되었습니다! 지금 도전해보세요!"), | ||
NEW_SOLUTION_POSTED("%s님이 새로운 풀이를 등록했습니다! 풀이를 확인하고 의견을 나눠보세요."), | ||
NEW_MEMBER_JOINED("%s님이 스터디에 합류했습니다!"), | ||
NEW_COMMENT_POSTED("%s님이 내 풀이에 코멘트를 남겼습니다! 어떤 리뷰인지 확인해보세요."), | ||
PROBLEM_DEADLINE_REACHED("[%s] 문제의 마감이 오늘입니다! 아직 해결하지 못했다면 지금 도전해보세요!"); | ||
|
||
private final String message; | ||
|
||
NotificationCategory(String message) { | ||
this.message = message; | ||
} | ||
|
||
public String getMessage(Object... args) { | ||
return String.format(message, args); | ||
} | ||
} |
Oops, something went wrong.