Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/main/java/stackpot/mongo/ChatRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ public interface ChatRepository extends MongoRepository<Chat, String> {
int countByChatRoomId(Long chatRoomId);

int countByChatRoomIdAndIdGreaterThan(Long chatRoomId, Long lastReadChatId);

void deleteByUserIdAndChatRoomId(Long userId, Long chatRoomId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,8 @@ public Chat saveChatMessage(ChatRequestDto.ChatMessageDto chatMessageDto, Long u

return chatRepository.save(chat);
}

public void deleteChatMessage(Long userId, Long chatRoomId) {
chatRepository.deleteByUserIdAndChatRoomId(userId, chatRoomId);
}
}