-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
89 additions
and
8 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
22 changes: 19 additions & 3 deletions
22
tht-apis/src/main/java/com/tht/thtapis/facade/chat/response/ChatRoomResponse.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,24 +1,40 @@ | ||
package com.tht.thtapis.facade.chat.response; | ||
|
||
import com.tht.domain.entity.chat.mapper.ChatRoomMapper; | ||
import com.tht.domain.entity.chat.mapper.ChatRoomUserMapper; | ||
import com.tht.domain.entity.user.User; | ||
|
||
import java.time.format.DateTimeFormatter; | ||
import java.util.List; | ||
|
||
public record ChatRoomResponse( | ||
long chatRoomIdx, | ||
String talkSubject, | ||
String talkIssue, | ||
String startDate, | ||
boolean isChatAble | ||
boolean isChatAble, | ||
List<Participant> participants | ||
) { | ||
|
||
public static ChatRoomResponse of(final ChatRoomMapper mapper, final boolean isChatAble) { | ||
public static ChatRoomResponse of(final ChatRoomMapper mapper, final boolean isChatAble, List<ChatRoomUserMapper> allParticipator) { | ||
return new ChatRoomResponse( | ||
mapper.chatRoomIdx(), | ||
mapper.talkSubject(), | ||
mapper.talkIssue(), | ||
mapper.startDate().format(DateTimeFormatter.ofPattern("y년 M월 d일")), | ||
isChatAble | ||
isChatAble, | ||
allParticipator.stream().map(Participant::of).toList() | ||
); | ||
} | ||
} | ||
|
||
record Participant( | ||
String userUuid, | ||
String userName, | ||
String profileUrl | ||
) { | ||
|
||
public static Participant of(final ChatRoomUserMapper user) { | ||
return new Participant(user.userUuid(), user.userName(), user.profileUrl()); | ||
} | ||
} |
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
1 change: 1 addition & 0 deletions
1
tht-apis/src/test/java/com/tht/thtapis/facade/chat/ChatFacadeTest.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
13 changes: 13 additions & 0 deletions
13
tht-core/domain/src/main/java/com/tht/domain/entity/chat/mapper/ChatRoomUserMapper.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.tht.domain.entity.chat.mapper; | ||
|
||
import com.querydsl.core.annotations.QueryProjection; | ||
|
||
public record ChatRoomUserMapper( | ||
String userUuid, | ||
String userName, | ||
String profileUrl | ||
) { | ||
|
||
@QueryProjection | ||
public ChatRoomUserMapper {} | ||
} |
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