|
11 | 11 | public record NotificationResponse( |
12 | 12 | @Schema(description = "알림 ID") Long id, |
13 | 13 | @Schema(description = "알림 타입") Notification.NotificationType type, |
14 | | - @Schema(description = "알림 메시지") String message, |
15 | 14 | @Schema(description = "읽음 여부") Boolean isRead, |
16 | 15 | @Schema(description = "관련 가입 신청 ID") Long joinRequestId, |
| 16 | + @Schema(description = "동호회 이름") String clubName, |
| 17 | + @Schema(description = "신청자 닉네임") String applicantNickname, |
17 | 18 | @Schema(description = "관련 대상 ID (댓글, 채팅 등)") Long targetId, |
18 | 19 | @Schema(description = "알림 생성 일시") LocalDateTime createdAt |
19 | 20 | ) { |
20 | 21 | public static NotificationResponse from(Notification notification) { |
| 22 | + var joinRequest = notification.getJoinClubRequest(); |
| 23 | + |
21 | 24 | return NotificationResponse.builder() |
22 | 25 | .id(notification.getId()) |
23 | 26 | .type(notification.getType()) |
24 | | - .message(notification.getMessage()) |
25 | 27 | .isRead(notification.getIsRead()) |
26 | | - .joinRequestId(notification.getJoinClubRequest() != null |
27 | | - ? notification.getJoinClubRequest().getId() : null) |
| 28 | + .joinRequestId(joinRequest != null ? joinRequest.getId() : null) |
| 29 | + .clubName(joinRequest != null ? joinRequest.getClub().getName() : null) |
| 30 | + .applicantNickname(joinRequest != null ? joinRequest.getUser().getNickname() : null) |
28 | 31 | .targetId(notification.getTargetId()) |
29 | 32 | .createdAt(notification.getCreatedAt()) |
30 | 33 | .build(); |
|
0 commit comments