-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathNotificationMapper.java
More file actions
32 lines (28 loc) · 1.29 KB
/
NotificationMapper.java
File metadata and controls
32 lines (28 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package clap.server.application.mapper;
import clap.server.adapter.inbound.web.dto.common.SliceResponse;
import clap.server.adapter.inbound.web.dto.notification.FindNotificationListResponse;
import clap.server.domain.model.notification.Notification;
import org.springframework.data.domain.Slice;
public class NotificationMapper {
private NotificationMapper() {throw new IllegalArgumentException();}
public static FindNotificationListResponse toFindNoticeListResponse(Notification notification) {
return new FindNotificationListResponse(
notification.getNotificationId(),
notification.getTask().getTaskId(),
notification.getType(),
notification.getReceiver().getMemberId(),
notification.getTask().getTitle(),
notification.getMessage() != null ? notification.getMessage() : null,
notification.getCreatedAt()
);
}
public static SliceResponse<FindNotificationListResponse> toSliceOfFindNoticeListResponse(Slice<FindNotificationListResponse> slice) {
return new SliceResponse<>(
slice.getContent(),
slice.getNumber(),
slice.getSize(),
slice.isFirst(),
slice.isLast()
);
}
}