This commit is contained in:
@@ -15,5 +15,5 @@ public class NotificationDto {
|
||||
private NotificationType type;
|
||||
private NotificationStatus status;
|
||||
private LocalDateTime createdAt;
|
||||
private String context;
|
||||
private Object context;
|
||||
}
|
||||
|
||||
@@ -153,13 +153,23 @@ public class NotificationHandler implements RequestHandler {
|
||||
}
|
||||
|
||||
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()
|
||||
.id(notification.getId())
|
||||
.message(notification.getMessage())
|
||||
.type(notification.getNotificationType())
|
||||
.status(notification.getStatus())
|
||||
.createdAt(notification.getCreatedAt())
|
||||
.context(notification.getContext())
|
||||
.context(contextObject)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user