Skip to content

Commit

Permalink
fix: ChattingListResponseDto 상대방 정보를 포함하도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
koreaioi committed Nov 13, 2024
1 parent 73fdd77 commit 0c5c7ef
Showing 1 changed file with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
package com.leets.X.domain.chat.dto.response;

import com.leets.X.domain.chat.entity.ChatRoom;
import com.leets.X.domain.user.domain.User;

public record ChattingListResponseDto(
Long roomId,
Long user1Id,
Long user2Id,
String user1Name,
String user2Name,

Long senderId,
String senderName,

Long opponentId,
String opponentImageUrl,
String opponentName,

LatestMessageDto latestMessageDto
) {
public static ChattingListResponseDto of(ChatRoom chatRoom, LatestMessageDto latestMessageDto) {
public static ChattingListResponseDto of(Long roomId, User sender, User opponent, LatestMessageDto latestMessageDto) {
return new ChattingListResponseDto(
chatRoom.getId(),
chatRoom.getUser1().getId(),
chatRoom.getUser2().getId(),
chatRoom.getUser1().getCustomId(),
chatRoom.getUser2().getCustomId(),
roomId,
sender.getId(), sender.getName(),
opponent.getId(), opponent.getName(), opponent.getImage().getUrl(),
latestMessageDto
);
}
Expand Down

0 comments on commit 0c5c7ef

Please sign in to comment.