Skip to content

Commit

Permalink
revise: fetch user chatroom using banned exploded condition
Browse files Browse the repository at this point in the history
  • Loading branch information
geneaky committed May 21, 2024
1 parent 905ab61 commit 3745f3f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,14 @@ public Slice<UserChatRoomResponse> findUserChatRoomsWithLastChat(Pageable pageab
user.defaultProfileImageType,
chat.id,
chat.message,
chat.createdAt
chat.createdAt,
chatRoomBlockedUser.id.isNotNull(),
chatRoom.isDeleted
))
.from(chatRoom)
.join(participant).on(participant.chatRoom.eq(chatRoom).and(participant.user.id.eq(userId))) //사용자 채팅방
.leftJoin(subParticipant).on(subParticipant.chatRoom.eq(chatRoom)) // 채팅방 인원수
.leftJoin(chatRoomBlockedUser).on(chatRoomBlockedUser.chatRoom.id.eq(chatRoom.id).and(chatRoomBlockedUser.user.id.eq(userId)))
.leftJoin(chat).on(chat.id.eq( // 마지막 채팅, 채팅 내
JPAExpressions.select(subChat.id.max())
.from(subChat)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;

@Getter
@ToString
@EqualsAndHashCode
public class ChatRoomResponse {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ public class UserChatRoomResponse {
private Long lastChatId;
private String lastChatContent;
private LocalDateTime lastChatDispatchTime;
private Boolean isBanned;
private Boolean isExploded;

@Builder
public UserChatRoomResponse(Long roomId, String roomName, String roomSid, Long roomMemberCount, Integer defaultRoomImageType, String roomImageUri, String bookTitle, String bookCoverImageUrl,
List<String> bookAuthors, Long senderId, String senderNickname, String senderProfileImageUrl, Integer senderDefaultProfileImageType, Long lastChatId, String lastChatContent,
LocalDateTime lastChatDispatchTime) {
LocalDateTime lastChatDispatchTime, Boolean isBanned, Boolean isExploded) {
this.roomId = roomId;
this.roomName = roomName;
this.roomSid = roomSid;
Expand All @@ -50,10 +52,13 @@ public UserChatRoomResponse(Long roomId, String roomName, String roomSid, Long r
this.lastChatId = lastChatId;
this.lastChatContent = lastChatContent;
this.lastChatDispatchTime = lastChatDispatchTime;
this.isBanned = isBanned;
this.isExploded = isExploded;
}

public UserChatRoomResponse(Long roomId, String roomName, String roomSid, Long roomMemberCount, Integer defaultRoomImageType, String roomImageUri, Long senderId, String senderNickname,
String senderProfileImageUrl, Integer senderDefaultProfileImageType, Long lastChatId, String lastChatContent, LocalDateTime lastChatDispatchTime) {
String senderProfileImageUrl, Integer senderDefaultProfileImageType, Long lastChatId, String lastChatContent, LocalDateTime lastChatDispatchTime, Boolean isBanned,
Boolean isExploded) {
this.roomId = roomId;
this.roomName = roomName;
this.roomSid = roomSid;
Expand All @@ -67,6 +72,8 @@ public UserChatRoomResponse(Long roomId, String roomName, String roomSid, Long r
this.lastChatId = lastChatId;
this.lastChatContent = lastChatContent;
this.lastChatDispatchTime = lastChatDispatchTime;
this.isBanned = isBanned;
this.isExploded = isExploded;
}

public void setBookInfo(Book book) {
Expand Down

0 comments on commit 3745f3f

Please sign in to comment.