-
Notifications
You must be signed in to change notification settings - Fork 2
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
[OING-379] feat: 알림 목록 조회 기능 추가 #280
Open
Kwon770
wants to merge
8
commits into
dev
Choose a base branch
from
feature/OING-379
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4221e74
feat: Add UserNotioficationHistory domain in Gateway
Kwon770 7a2bad7
feat: Add flyway sql based on UserNotificationHistory newly added
Kwon770 4083957
feat: Impl getMyRecentNotifications API
Kwon770 9fb2de5
test: Add UserNotificationHistoryServiceTest and MemberBridgeImplTest
Kwon770 b62428b
feat: Add the trigger to create userNotificationHistory on NewComment…
Kwon770 d0e18f9
feat: Add the trigger to create userNotificationHistory on birthday
Kwon770 8e37c59
feat: Add appendAppNewVersionReleasedNotiHistory in UserNotificationH…
Kwon770 ef42eea
test: Add test for creating notification test in UserNotificationHist…
Kwon770 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
24 changes: 0 additions & 24 deletions
24
gateway/src/main/java/com/oing/controller/NotificationController.java
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
gateway/src/main/java/com/oing/controller/UserNotificationHistoryController.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,23 @@ | ||
package com.oing.controller; | ||
|
||
import com.oing.domain.ProfileStyle; | ||
import com.oing.dto.response.NotificationResponse; | ||
import com.oing.restapi.UserNotificationHistoryApi; | ||
import com.oing.service.UserNotificationHistoryService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Controller; | ||
|
||
import java.time.ZonedDateTime; | ||
import java.util.List; | ||
|
||
@RequiredArgsConstructor | ||
@Controller | ||
public class UserNotificationHistoryController implements UserNotificationHistoryApi { | ||
|
||
private final UserNotificationHistoryService userNotificationHistoryService; | ||
|
||
@Override | ||
public List<NotificationResponse> getMyRecentNotifications(String loginMemberId) { | ||
return userNotificationHistoryService.getRecentUserNotifications(loginMemberId); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...va/com/oing/domain/NotificationStyle.java → ...in/java/com/oing/domain/ProfileStyle.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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package com.oing.domain; | ||
|
||
public enum NotificationStyle { | ||
public enum ProfileStyle { | ||
BIRTHDAY, NONE; | ||
} |
40 changes: 40 additions & 0 deletions
40
gateway/src/main/java/com/oing/domain/UserNotificationHistory.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,40 @@ | ||
package com.oing.domain; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity(name = "user_notification_history") | ||
@NoArgsConstructor(access = lombok.AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
@Getter | ||
@Builder | ||
@Table(indexes = { | ||
@Index(name = "user_notification_history_idx1", columnList = "sender_member_id"), | ||
@Index(name = "user_notification_history_idx2", columnList = "receiver_member_id") | ||
}) | ||
public class UserNotificationHistory extends BaseEntity { | ||
@Id | ||
@Column(name = "user_notification_history_id", columnDefinition = "CHAR(26)", nullable = false) | ||
private String id; | ||
|
||
@Column(name = "title", nullable = false) | ||
private String title; | ||
|
||
@Column(name = "content", nullable = false) | ||
private String content; | ||
|
||
@Column(name = "aos_deep_link") | ||
private String aosDeepLink; | ||
|
||
@Column(name = "ios_deep_link") | ||
private String iosDeepLink; | ||
|
||
@Column(name = "sender_member_id", columnDefinition = "CHAR(26)", nullable = false) | ||
private String senderMemberId; | ||
|
||
@Column(name = "receiver_member_id", columnDefinition = "CHAR(26)", nullable = false) | ||
private String receiverMemberId; | ||
} |
43 changes: 43 additions & 0 deletions
43
gateway/src/main/java/com/oing/dto/request/CreateUserNotificationHistoryDTO.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,43 @@ | ||
package com.oing.dto.request; | ||
|
||
import com.oing.domain.UserNotificationHistory; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.Size; | ||
|
||
@Schema(description = "유저 알림 이력 생성 요청") | ||
public record CreateUserNotificationHistoryDTO( | ||
@NotBlank | ||
@Schema(description = "알림 제목", example = "엄마님이 내 생존신고에 댓글을 달았어요") | ||
String title, | ||
|
||
@NotBlank | ||
@Schema(description = "알림 내용", example = "우와~ 맛있겠다!!") | ||
String content, | ||
|
||
@Schema(description = "AOS 딥링크", example = "post/view/123?openComment=true") | ||
String aosDeepLink, | ||
|
||
@Schema(description = "iOS 딥링크", example = "post/view/123?openComment=true&dateOfPost=2024-12-24") | ||
String iosDeepLink, | ||
|
||
@Size(min = 26, max = 26) | ||
@Schema(description = "알림 전송자 유저 ID", example = "01HGW2N7EHJVJ4CJ999RRS2E97") | ||
String senderMemberId, | ||
|
||
@Size(min = 26, max = 26) | ||
@Schema(description = "알림 수신자 유저 ID", example = "01HGW2N7EHJVJ4CJ999RRS2E97") | ||
String receiverMemberId | ||
) { | ||
public UserNotificationHistory toEntity(String id) { | ||
return UserNotificationHistory.builder() | ||
.id(id) | ||
.title(title) | ||
.content(content) | ||
.aosDeepLink(aosDeepLink) | ||
.iosDeepLink(iosDeepLink) | ||
.senderMemberId(senderMemberId) | ||
.receiverMemberId(receiverMemberId) | ||
.build(); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,20 +1,22 @@ | ||
package com.oing.dto.response; | ||
|
||
import com.oing.domain.NotificationStyle; | ||
import com.oing.domain.ProfileStyle; | ||
import com.oing.domain.UserNotificationHistory; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
import java.time.ZoneId; | ||
import java.time.ZonedDateTime; | ||
|
||
@Schema(description = "알림 응답") | ||
public record NotificationResponse( | ||
@Schema(description = "노티 ID", example = "01HGW2N7EHJVJ4CJ999RRS2E97") | ||
String notificationId, | ||
|
||
@Schema(description = "발송자 이미지 url", example = "https://..") | ||
String senderImageUrl, | ||
@Schema(description = "발송자 프로필 이미지 url", example = "https://..") | ||
String senderProfileImageUrl, | ||
|
||
@Schema(description = "알림 스타일", example = "BIRTHDAY") | ||
NotificationStyle style, | ||
@Schema(description = "발송자 프로필 스타일", example = "BIRTHDAY") | ||
ProfileStyle sencerProfileStyle, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 오타가 있어요! |
||
|
||
@Schema(description = "알림 제목", example = "우리 가족 모두가 생존신고를 완료했어요") | ||
String title, | ||
|
@@ -31,4 +33,16 @@ public record NotificationResponse( | |
@Schema(description = "알림 생성 시간", example = "2023-12-23T01:53:21.577347+09:00") | ||
ZonedDateTime createdAt | ||
) { | ||
public static NotificationResponse of(UserNotificationHistory userNotificationHistory, String senderProfileImageUrl, ProfileStyle profileStyle) { | ||
return new NotificationResponse( | ||
userNotificationHistory.getId(), | ||
senderProfileImageUrl, | ||
profileStyle, | ||
userNotificationHistory.getTitle(), | ||
userNotificationHistory.getContent(), | ||
userNotificationHistory.getIosDeepLink(), | ||
userNotificationHistory.getAosDeepLink(), | ||
userNotificationHistory.getCreatedAt().atZone(ZoneId.systemDefault()) | ||
); | ||
} | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저희 플젝에서 회원은 Member로 나타내고 있어서 통일성을 위해 User 대신
MemberNotificationHistory
로 바꾸는 건 어떠신가요??