From d3ba42ea6429af2c4b268f4a6322035e15643d33 Mon Sep 17 00:00:00 2001 From: Vladik Date: Fri, 6 Sep 2024 22:04:52 +0300 Subject: [PATCH] refactor: LastMessageResponseDto.java --- .../notification/LastMessageResponseDto.java | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/chat/yourway/dto/response/notification/LastMessageResponseDto.java b/src/main/java/com/chat/yourway/dto/response/notification/LastMessageResponseDto.java index dd4ce9ee..977f0507 100644 --- a/src/main/java/com/chat/yourway/dto/response/notification/LastMessageResponseDto.java +++ b/src/main/java/com/chat/yourway/dto/response/notification/LastMessageResponseDto.java @@ -15,8 +15,6 @@ @ToString public class LastMessageResponseDto { - private static final int MAX_LENGTH = 20; - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm") private LocalDateTime timestamp; private String sentFrom; @@ -26,20 +24,10 @@ public class LastMessageResponseDto { public LastMessageResponseDto(LocalDateTime timestamp, String sentFrom, String lastMessage, - UUID topicId - ) { + UUID topicId) { this.timestamp = timestamp; this.sentFrom = sentFrom; this.lastMessage = lastMessage; this.topicId = topicId; } - - public void setLastMessage(String lastMessage) { - if (lastMessage.length() <= MAX_LENGTH) { - this.lastMessage = lastMessage; - } else { - this.lastMessage = lastMessage.substring(0, MAX_LENGTH) + "..."; - } - } - -} +} \ No newline at end of file