Skip to content

Commit 690f5cf

Browse files
committed
♻️Refactor: 알림 응답 dto에 동호회, 수신자 정보 추가
1 parent 1ca41c8 commit 690f5cf

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/main/java/com/be/sportizebe/domain/notification/dto/response/NotificationResponse.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,23 @@
1111
public record NotificationResponse(
1212
@Schema(description = "알림 ID") Long id,
1313
@Schema(description = "알림 타입") Notification.NotificationType type,
14-
@Schema(description = "알림 메시지") String message,
1514
@Schema(description = "읽음 여부") Boolean isRead,
1615
@Schema(description = "관련 가입 신청 ID") Long joinRequestId,
16+
@Schema(description = "동호회 이름") String clubName,
17+
@Schema(description = "신청자 닉네임") String applicantNickname,
1718
@Schema(description = "관련 대상 ID (댓글, 채팅 등)") Long targetId,
1819
@Schema(description = "알림 생성 일시") LocalDateTime createdAt
1920
) {
2021
public static NotificationResponse from(Notification notification) {
22+
var joinRequest = notification.getJoinClubRequest();
23+
2124
return NotificationResponse.builder()
2225
.id(notification.getId())
2326
.type(notification.getType())
24-
.message(notification.getMessage())
2527
.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)
2831
.targetId(notification.getTargetId())
2932
.createdAt(notification.getCreatedAt())
3033
.build();

0 commit comments

Comments
 (0)