Skip to content
This repository was archived by the owner on Jan 11, 2026. It is now read-only.

Commit 8b6c8d9

Browse files
authored
[MERGE] Merge pull request #414 from SPOTeam/SPOT-269/feat
[FEAT] 알림 조회 시, 알림이 발생한 지점으로 이동할 수 있도록 응답 값 추가
2 parents f76b88f + fbe878e commit 8b6c8d9

4 files changed

Lines changed: 14 additions & 6 deletions

File tree

src/main/java/com/example/spot/domain/Notification.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ public class Notification extends BaseEntity {
3737
@Column(nullable = false)
3838
private String notifierName;
3939

40+
@Column(nullable = true)
41+
private Long studyPostId;
42+
4043
//== 회원 ==//
4144
@ManyToOne(fetch = FetchType.LAZY)
4245
@JoinColumn(name = "member_id", nullable = false)

src/main/java/com/example/spot/service/notification/NotificationQueryServiceImpl.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ public NotificationListDTO getAllNotifications(Long memberId, Pageable pageable)
9494
.notificationId(notification.getId())
9595
.createdAt(notification.getCreatedAt())
9696
.type(notification.getType())
97+
.studyId(notification.getStudy().getId())
98+
.studyPostId(notification.getStudyPostId())
9799
.studyTitle(notification.getStudy().getTitle())
98100
.studyProfileImage(notification.getStudy().getProfileImage())
99101
.notifierName(notification.getNotifierName()) // 알림 생성한 회원 이름

src/main/java/com/example/spot/service/studypost/StudyPostCommandServiceImpl.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,13 @@ public StudyPostResDTO.PostPreviewDTO createPost(Long studyId, StudyPostRequestD
135135
// 알림 생성
136136
for (Member studyMember : members) {
137137
Notification notification = Notification.builder()
138-
.study(studyPost.getStudy())
139-
.member(studyMember)
140-
.notifierName(member.getName()) // 글을 작성한 회원 이름
141-
.type(NotifyType.ANNOUNCEMENT)
142-
.isChecked(false)
143-
.build();
138+
.study(studyPost.getStudy())
139+
.member(studyMember)
140+
.studyPostId(studyPost.getId())
141+
.notifierName(member.getName()) // 글을 작성한 회원 이름
142+
.type(NotifyType.ANNOUNCEMENT)
143+
.isChecked(false)
144+
.build();
144145
notificationRepository.save(notification);
145146
}
146147
}

src/main/java/com/example/spot/web/dto/notification/NotificationResponseDTO.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public static class NotificationListDTO {
2626
@AllArgsConstructor
2727
public static class NotificationDTO{
2828
Long notificationId;
29+
Long studyId;
30+
Long studyPostId;
2931
String studyTitle;
3032
String studyProfileImage;
3133
String notifierName;

0 commit comments

Comments
 (0)