-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
feat : ์ฑํ ๋ฉ์ธ์ง ์กฐํ ๊ธฐํ ๋ณ๊ฒฝ ์ ์ฉ
- Loading branch information
Showing
7 changed files
with
51 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 13 additions & 2 deletions
15
src/main/java/meltingpot/server/chat/dto/ChatMessageGetResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,30 @@ | ||
package meltingpot.server.chat.dto; | ||
|
||
import meltingpot.server.domain.entity.AccountProfileImage; | ||
import meltingpot.server.domain.entity.chat.ChatMessage; | ||
import meltingpot.server.domain.entity.chat.enums.Role; | ||
import org.springframework.data.domain.Slice; | ||
|
||
public record ChatMessageGetResponse( | ||
Long chatMessageId, | ||
String content, | ||
Role role | ||
Role memberRole, | ||
String memberName, | ||
String imageKey | ||
) { | ||
public static ChatMessageGetResponse from(ChatMessage chatMessage) { | ||
String thumbnailImageKey = chatMessage.getChatRoom().getParty().getAccount().getProfileImages().stream() | ||
.filter(AccountProfileImage::isThumbnail) | ||
.map(AccountProfileImage::getImageKey) | ||
.findFirst() | ||
.orElse(null); | ||
|
||
return new ChatMessageGetResponse( | ||
chatMessage.getId(), | ||
chatMessage.getContent(), | ||
chatMessage.getRole() | ||
chatMessage.getRole(), | ||
chatMessage.getAccount().getUsername(), | ||
thumbnailImageKey | ||
); | ||
} | ||
} |
18 changes: 17 additions & 1 deletion
18
src/main/java/meltingpot/server/chat/dto/ChatMessagePageResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters