Skip to content

Commit

Permalink
fix: 채팅방 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
geneaky committed Oct 8, 2024
1 parent 10fe133 commit cdf64ec
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
package toy.bookchat.bookchat.db_module.chatroom.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import toy.bookchat.bookchat.db_module.chatroom.ChatRoomHashTagEntity;

public interface ChatRoomHashTagRepository extends JpaRepository<ChatRoomHashTagEntity, Long> {

void deleteAllByChatRoomId(Long chatRoomId);
@Modifying
@Query("delete from ChatRoomHashTagEntity c where c.chatRoomId = :chatRoomId")
void deleteByChatRoomId(@Param("chatRoomId") Long chatRoomId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void validate() {
return;
}

if (!tags.isEmpty()) {
if (tags != null && !tags.isEmpty()) {
this.roomName = null;
this.title = null;
this.isbn = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ public ChatRoomHashTagCleaner(ChatRoomHashTagRepository chatRoomHashTagRepositor
}

public void cleanAll(Long chatRoomId) {
chatRoomHashTagRepository.deleteAllByChatRoomId(chatRoomId);
chatRoomHashTagRepository.deleteByChatRoomId(chatRoomId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.UUID;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.domain.Pageable;
Expand All @@ -32,11 +31,11 @@
import toy.bookchat.bookchat.domain.participant.service.ParticipantCleaner;
import toy.bookchat.bookchat.domain.participant.service.ParticipantReader;
import toy.bookchat.bookchat.domain.participant.service.ParticipantValidator;
import toy.bookchat.bookchat.infrastructure.s3.StorageService;
import toy.bookchat.bookchat.domain.user.User;
import toy.bookchat.bookchat.domain.user.service.UserReader;
import toy.bookchat.bookchat.infrastructure.rabbitmq.MessagePublisher;
import toy.bookchat.bookchat.infrastructure.rabbitmq.message.NotificationMessage;
import toy.bookchat.bookchat.infrastructure.s3.StorageService;

@Service
public class ChatRoomService {
Expand Down Expand Up @@ -151,8 +150,7 @@ public void reviseChatRoom(ReviseChatRoomRequest request, MultipartFile chatRoom
if (request.tagExistent()) {
chatRoomHashTagCleaner.cleanAll(chatRoom.getId());

List<HashTag> hashTags = request.createHashTags();
for (HashTag hashTag : hashTags) {
for (HashTag hashTag : request.createHashTags()) {
HashTag storedHashTag = hashTagAppender.append(hashTag);
chatRoomHashTagAppender.append(chatRoom.getId(), storedHashTag);
}
Expand Down

0 comments on commit cdf64ec

Please sign in to comment.