This commit is contained in:
@@ -15,5 +15,5 @@ public class NotificationDto {
|
|||||||
private NotificationType type;
|
private NotificationType type;
|
||||||
private NotificationStatus status;
|
private NotificationStatus status;
|
||||||
private LocalDateTime createdAt;
|
private LocalDateTime createdAt;
|
||||||
private String context;
|
private Object context;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,13 +153,23 @@ public class NotificationHandler implements RequestHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private NotificationDto toDto(Notification notification) {
|
private NotificationDto toDto(Notification notification) {
|
||||||
|
Object contextObject = null;
|
||||||
|
if (notification.getContext() != null) {
|
||||||
|
try {
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
contextObject = objectMapper.readValue(notification.getContext(), Object.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
contextObject = notification.getContext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return NotificationDto.builder()
|
return NotificationDto.builder()
|
||||||
.id(notification.getId())
|
.id(notification.getId())
|
||||||
.message(notification.getMessage())
|
.message(notification.getMessage())
|
||||||
.type(notification.getNotificationType())
|
.type(notification.getNotificationType())
|
||||||
.status(notification.getStatus())
|
.status(notification.getStatus())
|
||||||
.createdAt(notification.getCreatedAt())
|
.createdAt(notification.getCreatedAt())
|
||||||
.context(notification.getContext())
|
.context(contextObject)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user