Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
Marc Gorzala committed Jan 7, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent efc4af7 commit 27f437a
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -17,7 +17,16 @@
@Builder
public class GetChatResponseDto {
public static GetChatResponseDto of(Chat chat) {
Optional<Message> optionalLastMessage = chat.getMessages().stream().reduce((first, second) -> second);
Optional<Message> optionalLastMessage = chat.getMessages().stream().reduce((first, second) ->
{
if (first.getCreatedAt().isAfter(second.getCreatedAt())) {
return first;
}
else {
return second;
}
}
);
return GetChatResponseDto.builder()
.chatId(chat.getChatId().getId())
.participantIds(
@@ -40,6 +49,5 @@ public static GetChatResponseDto of(Chat chat) {
Set<String> participantIds;
OffsetDateTime lastActivity;
MessageDto lastMessage;
//@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
OffsetDateTime createdAt;
}

0 comments on commit 27f437a

Please sign in to comment.