Skip to content

Commit 8684432

Browse files
committed
hotfix: 알림 타입 세부 설명 추가
1 parent da3f905 commit 8684432

File tree

8 files changed

+59
-17
lines changed

8 files changed

+59
-17
lines changed

src/main/java/modelly/modelly_be/domain/notification/dto/internal/NotificationData.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,30 @@
66
public record NotificationData(
77
Long userId,
88
NotificationType type,
9-
//String typeDescription,
9+
String typeDescription,
1010
String title,
1111
String message,
1212
Long targetId,
1313
String senderName //채팅일 경우
1414
) {
1515

16-
public static NotificationData chattingNotification(Long userId, NotificationType type, String title, String message,Long chattingRoomId, String senderName) {
16+
public static NotificationData chattingNotification(Long userId, NotificationType type, String typeDescription, String title, String message,Long chattingRoomId, String senderName) {
1717
return new NotificationData(
1818
userId,
1919
type,
20+
typeDescription,
2021
title,
2122
message,
2223
chattingRoomId,
2324
senderName
2425
);
2526
}
2627

27-
public static NotificationData otherNotification(Long userId, NotificationType type, String title, String message,Long targetId) {
28+
public static NotificationData otherNotification(Long userId, NotificationType type, String typeDescription, String title, String message,Long targetId) {
2829
return new NotificationData(
2930
userId,
3031
type,
32+
typeDescription,
3133
title,
3234
message,
3335
targetId,

src/main/java/modelly/modelly_be/domain/notification/entity/NotificationType.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public String toDisplayReviewType(UserRole userRole) {
2323
NotificationType.REVIEW.getDescription() : "리뷰 답글 알림";
2424
}
2525

26-
public String toDisplayScheduleType(UserRole userRole, String content) {
26+
public String toDisplayScheduleType(String content) {
2727

2828
if (content.contains("취소")) return "예약 취소";
2929
if (content.contains("변경")) return "예약 변경";
@@ -34,7 +34,7 @@ public String toDisplayScheduleType(UserRole userRole, String content) {
3434
public String toDisplayReservationType(UserRole userRole, String content) {
3535
if (userRole == UserRole.MODEL){
3636
if (content.contains("확정")) return "예약 확정";
37-
if (content.contains("취소")) return "예약 취소";
37+
if (content.contains("확정되지 않았어요.")) return "예약 취소";
3838
else new GeneralException(ErrorStatus._BAD_REQUEST);
3939
} else if (userRole == UserRole.DESIGNER){
4040
return "예약 신청 알림";

src/main/java/modelly/modelly_be/domain/notification/repository/notificationRepository/NotificationRepositoryCustomImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public List<NotificationListResponse> findAllByUserAndType(User user, Notificati
6464
case RESERVATION -> type.toDisplayReservationType(userRole, title);
6565
case REVIEW -> type.toDisplayReviewType(userRole);
6666
case CHATTING -> type.getDescription();
67-
case SCHEDULE -> type.toDisplayScheduleType(userRole, title);
67+
case SCHEDULE -> type.toDisplayScheduleType(title);
6868
},
6969
t.get(qNotification.title),
7070
t.get(qNotification.content),

src/main/java/modelly/modelly_be/domain/notification/service/FCMService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public void pushToFCM(NotificationData notificationData) {
3838
data.put("body", notificationData.message());
3939
data.put("targetId", notificationData.targetId().toString());
4040
data.put("notificationType", notificationData.type().getDescription());
41+
data.put("typeDescription", notificationData.typeDescription());
4142

4243
Message message = Message.builder()
4344
.setToken(fcmToken)

src/main/java/modelly/modelly_be/domain/notification/service/mapping/ChatNotificationService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ public NotificationData createChattingNotification(MessageType messageType, Stri
2121
case DESIGNER -> title = room.getModel().getNickname() + "님";
2222
}
2323

24-
return NotificationData.chattingNotification(otherUser.getId(), NotificationType.CHATTING, title, message, room.getId(), title);
24+
return NotificationData.chattingNotification(otherUser.getId(), NotificationType.CHATTING, NotificationType.CHATTING.getDescription(), title, message, room.getId(), title);
2525
}
2626
}

src/main/java/modelly/modelly_be/domain/notification/service/mapping/ReservationNotificationService.java

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import modelly.modelly_be.domain.notification.dto.internal.NotificationData;
44
import modelly.modelly_be.domain.notification.entity.NotificationType;
55
import modelly.modelly_be.domain.reservation.entity.Reservation;
6+
import modelly.modelly_be.domain.user.entity.enums.UserRole;
67
import org.springframework.stereotype.Service;
78
import org.springframework.transaction.annotation.Transactional;
89

@@ -15,10 +16,16 @@ public class ReservationNotificationService {
1516
public NotificationData createReservationRejectNotification(Reservation reservation){
1617

1718
String message = parseStartTime(reservation.getDate(), reservation.getStartTime()) +" "+ reservation.getDesignerName() +"디자이너";
19+
20+
String title = "해당 예약은 확정되지 않았어요.";
21+
22+
String notificationTypeDescription = NotificationType.RESERVATION.toDisplayReservationType(UserRole.MODEL, title);
23+
1824
return NotificationData.otherNotification(
1925
reservation.getModel().getUser().getId(),
2026
NotificationType.RESERVATION,
21-
"해당 예약은 확정되지 않았어요.",
27+
notificationTypeDescription,
28+
title,
2229
message,
2330
reservation.getId());
2431

@@ -29,10 +36,16 @@ public NotificationData createReservationRejectNotification(Reservation reservat
2936
public NotificationData createReservationAcceptedNotification(Reservation reservation){
3037

3138
String message = parseStartTime(reservation.getDate(), reservation.getStartTime()) +" "+ reservation.getDesignerName() +"디자이너";
39+
40+
String title = "신청한 예약이 확정되었어요.";
41+
42+
String notificationTypeDescription = NotificationType.RESERVATION.toDisplayReservationType(UserRole.MODEL, title);
43+
3244
return NotificationData.otherNotification(
3345
reservation.getModel().getUser().getId(),
3446
NotificationType.RESERVATION,
35-
"신청한 예약이 확정되었어요.",
47+
notificationTypeDescription,
48+
title,
3649
message,
3750
reservation.getId());
3851

@@ -42,10 +55,16 @@ public NotificationData createReservationAcceptedNotification(Reservation reserv
4255
public NotificationData createReservationRequestNotification(Reservation reservation) {
4356

4457
String message = parseStartTime(reservation.getDate(), reservation.getStartTime()) +" "+ reservation.getModel().getNickname() + "님";
58+
59+
String title = "새로운 예약 신청이 있어요.";
60+
61+
String notificationTypeDescription = NotificationType.RESERVATION.toDisplayReservationType(UserRole.DESIGNER, title);
62+
4563
return NotificationData.otherNotification(
4664
reservation.getDesigner().getUser().getId(),
4765
NotificationType.RESERVATION,
48-
"새로운 예약 신청이 있어요.",
66+
notificationTypeDescription,
67+
title,
4968
message,
5069
reservation.getId());
5170

@@ -54,9 +73,12 @@ public NotificationData createReservationRequestNotification(Reservation reserva
5473
public NotificationData createReservationRemindNotification(Reservation reservation, String title) {
5574
String message = parseStartTime(reservation.getDate(), reservation.getStartTime()) +" "+ reservation.getModel().getNickname() + "님";
5675

76+
String notificationTypeDescription = NotificationType.RESERVATION.toDisplayReservationType(UserRole.DESIGNER, title);
77+
5778
return NotificationData.otherNotification(
5879
reservation.getDesigner().getUser().getId(),
5980
NotificationType.RESERVATION,
81+
notificationTypeDescription,
6082
title,
6183
message,
6284
reservation.getId());

src/main/java/modelly/modelly_be/domain/notification/service/mapping/ReviewNotificationService.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import modelly.modelly_be.domain.notification.dto.internal.NotificationData;
55
import modelly.modelly_be.domain.notification.entity.NotificationType;
66
import modelly.modelly_be.domain.user.entity.User;
7+
import modelly.modelly_be.domain.user.entity.enums.UserRole;
78
import org.springframework.stereotype.Service;
89
import org.springframework.transaction.annotation.Transactional;
910

@@ -17,7 +18,9 @@ public NotificationData createReviewNotification(User designer, String modelNick
1718
String title = modelNickname + "님이 작성하신 새로운 리뷰가 등록되었어요.";
1819
String message = "리뷰 관리에서 답글을 작성해보세요.";
1920

20-
return NotificationData.otherNotification(designer.getId(), NotificationType.REVIEW, title, message, reviewId);
21+
String notificationTypeDescription = NotificationType.REVIEW.toDisplayReviewType(UserRole.DESIGNER);
22+
23+
return NotificationData.otherNotification(designer.getId(), NotificationType.REVIEW, notificationTypeDescription, title, message, reviewId);
2124
}
2225

2326
//모델한테 리뷰 답글 알림 전송
@@ -26,7 +29,9 @@ public NotificationData createReplyNotification(User model, String designerNickn
2629
String title = "작성한 리뷰에 " + designerNickname + " 디자이너님이 답글을 작성했어요.";
2730
String message = "리뷰 내역에서 확인해보세요.";
2831

29-
return NotificationData.otherNotification(model.getId(), NotificationType.REVIEW, title, message, reviewId);
32+
String notificationTypeDescription = NotificationType.REVIEW.toDisplayReviewType(UserRole.MODEL);
33+
34+
return NotificationData.otherNotification(model.getId(), NotificationType.REVIEW, notificationTypeDescription, title, message, reviewId);
3035
}
3136

3237
}

src/main/java/modelly/modelly_be/domain/notification/service/mapping/ScheduleNotificationService.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ public NotificationData createScheduleChangeNotification(User user, Reservation
3131
}
3232
}
3333

34-
return NotificationData.chattingNotification(user.getId(), NotificationType.SCHEDULE, title, message, finalRoomId, senderName);}
34+
String notificationTypeDescription = NotificationType.SCHEDULE.toDisplayScheduleType(title);
35+
36+
return NotificationData.chattingNotification(user.getId(), NotificationType.SCHEDULE, notificationTypeDescription, title, message, finalRoomId, senderName);}
3537

3638
//일정 취소 알림
3739
public NotificationData createScheduleCancelNotification(User user, Reservation reservation, Long finalRoomId) {
@@ -53,7 +55,9 @@ public NotificationData createScheduleCancelNotification(User user, Reservation
5355
}
5456
}
5557

56-
return NotificationData.chattingNotification(user.getId(), NotificationType.SCHEDULE, title, message, finalRoomId, senderName);
58+
String notificationTypeDescription = NotificationType.SCHEDULE.toDisplayScheduleType(title);
59+
60+
return NotificationData.chattingNotification(user.getId(), NotificationType.SCHEDULE, notificationTypeDescription, title, message, finalRoomId, senderName);
5761
}
5862

5963
@Transactional
@@ -73,7 +77,9 @@ public NotificationData createScheduleChangeRejectNotification(User user, Reserv
7377
}
7478
}
7579

76-
return NotificationData.chattingNotification(user.getId(), NotificationType.SCHEDULE, title, message, finalRoomId, senderName);
80+
String notificationTypeDescription = NotificationType.SCHEDULE.toDisplayScheduleType(title);
81+
82+
return NotificationData.chattingNotification(user.getId(), NotificationType.SCHEDULE, notificationTypeDescription, title, message, finalRoomId, senderName);
7783

7884
}
7985

@@ -94,7 +100,10 @@ public NotificationData createScheduleChangeAcceptNotification(User user, Reserv
94100
}
95101
}
96102

97-
return NotificationData.chattingNotification(user.getId(), NotificationType.SCHEDULE, title, message, finalRoomId, senderName);
103+
String notificationTypeDescription = NotificationType.SCHEDULE.toDisplayScheduleType(title);
104+
105+
106+
return NotificationData.chattingNotification(user.getId(), NotificationType.SCHEDULE, notificationTypeDescription, title, message, finalRoomId, senderName);
98107
}
99108

100109
@Transactional
@@ -112,7 +121,10 @@ public NotificationData createRemindNotification(User user, Reservation reservat
112121

113122
String title = "내일 예정된 모델 일정이 있어요.";
114123

115-
NotificationData notificationData = NotificationData.otherNotification(user.getId(), NotificationType.SCHEDULE, title, message, reservation.getId());
124+
String notificationTypeDescription = NotificationType.SCHEDULE.toDisplayScheduleType(title);
125+
126+
127+
NotificationData notificationData = NotificationData.otherNotification(user.getId(), NotificationType.SCHEDULE, notificationTypeDescription, title, message, reservation.getId());
116128
return notificationData;
117129
}
118130

0 commit comments

Comments
 (0)