diff --git a/src/main/java/space/space_spring/controller/ChattingController.java b/src/main/java/space/space_spring/controller/ChattingController.java index 29d89f5d..2b0d7963 100644 --- a/src/main/java/space/space_spring/controller/ChattingController.java +++ b/src/main/java/space/space_spring/controller/ChattingController.java @@ -2,20 +2,14 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.context.event.EventListener; import org.springframework.messaging.handler.annotation.*; import org.springframework.messaging.simp.annotation.SubscribeMapping; -import org.springframework.messaging.simp.stomp.StompHeaderAccessor; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.socket.messaging.SessionDisconnectEvent; import space.space_spring.argumentResolver.userSpace.CheckUserSpace; import space.space_spring.dto.chat.request.ChatMessageRequest; import space.space_spring.dto.chat.response.ChatMessageLogResponse; import space.space_spring.dto.chat.response.ChatMessageResponse; import space.space_spring.service.ChattingService; -import space.space_spring.service.UserChatRoomService; import java.io.IOException; import java.util.Map; @@ -27,7 +21,6 @@ public class ChattingController { private final ChattingService chattingService; - private final UserChatRoomService userChatRoomService; @MessageMapping("/chat/{chatRoomId}") // {chatRoomId} 채팅방으로 보낸 메세지 매핑 @SendTo("/topic/chat/{chatRoomId}") // {chatRoomId} 채팅방을 구독한 곳들로 메세지 전송 diff --git a/src/main/java/space/space_spring/service/UserChatRoomService.java b/src/main/java/space/space_spring/service/UserChatRoomService.java deleted file mode 100644 index 08a47df8..00000000 --- a/src/main/java/space/space_spring/service/UserChatRoomService.java +++ /dev/null @@ -1,42 +0,0 @@ -package space.space_spring.service; - -import jakarta.transaction.Transactional; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import space.space_spring.dao.chat.ChatRoomDao; -import space.space_spring.dao.chat.UserChatRoomDao; -import space.space_spring.entity.ChatRoom; -import space.space_spring.entity.User; -import space.space_spring.entity.UserChatRoom; -import space.space_spring.exception.CustomException; -import space.space_spring.util.user.UserUtils; - -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.util.Optional; - -import static space.space_spring.response.status.BaseExceptionResponseStatus.CHATROOM_NOT_EXIST; - -@Service -@RequiredArgsConstructor -@Slf4j -public class UserChatRoomService { - - private final UserUtils userUtils; - - private final ChatRoomDao chatRoomDao; - private final UserChatRoomDao userChatRoomDao; - -// @Transactional -// public void saveLastReadTime(Long userId, Long chatRoomId) { -// User userByUserId = userUtils.findUserByUserId(userId); -// ChatRoom chatRoomByChatRoomId = chatRoomDao.findById(chatRoomId) -// .orElseThrow(() -> new CustomException(CHATROOM_NOT_EXIST)); -// -// UserChatRoom targetChatRoom = userChatRoomDao.findByUserAndChatRoom(userByUserId, chatRoomByChatRoomId); -// targetChatRoom.setLastReadTime(LocalDateTime.now()); -//// userChatRoomDao.save(targetChatRoom); -// log.info("socket disconnect 시 마지막으로 읽은 시간" + targetChatRoom.getLastReadTime()); -// } -}