Skip to content

Commit

Permalink
Fix :: 현재 방에 있을시 안 읽은값 반환 안하도록 변경
Browse files Browse the repository at this point in the history
채팅방에서 접속해있을때 타 서비스에서 채팅방 불러오기를 시도하면 0000 after 로 찍어서 모든 메시지를 안읽음으로 처리하던걸 수정함
  • Loading branch information
yeseong0412 committed Oct 19, 2024
1 parent 5131b76 commit c417154
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import com.seugi.api.domain.chat.presentation.websocket.dto.MessageEventDto
import com.seugi.api.global.exception.CustomException
import com.seugi.api.global.infra.fcm.FCMService
import com.seugi.api.global.response.BaseResponse
import com.seugi.api.global.util.DateTimeUtil
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -112,7 +113,8 @@ class MessageServiceImpl(
val timestamp = room.joinUserInfo.find { it.userId == userId }?.timestamp
return messageRepository.findByChatRoomIdEqualsAndTimestampAfter(
chatRoomId = room.id.toString(),
timestamp = timestamp ?: LocalDateTime.now()
timestamp = if (timestamp == DateTimeUtil.localDateTime) LocalDateTime.now() else timestamp
?: LocalDateTime.now()
).count()
}

Expand Down

0 comments on commit c417154

Please sign in to comment.