From d98f07e2ca7fa3344e87c40ea917e407218aa45c Mon Sep 17 00:00:00 2001 From: Bombo Date: Thu, 30 Nov 2023 13:51:12 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[SIX-274]=20fix=20:=20=EC=B1=84=ED=8C=85?= =?UTF-8?q?=EB=B0=A9=EC=9D=B4=20=EC=A4=91=EB=B3=B5=EB=90=98=EC=96=B4?= =?UTF-8?q?=EC=84=9C=20=EC=83=9D=EC=84=B1=EB=90=98=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=ED=95=98=EA=B3=A0,=20=EC=9D=B8=EB=8D=B1?= =?UTF-8?q?=EC=8A=A4=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=98=EC=98=80?= =?UTF-8?q?=EC=8A=B5=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chatroom/ChatRoomService.java | 3 ++ .../chatroom/MissionChatRoomValidator.java | 28 ++++++++++++++++++ .../chatroom/ChatRoomServiceTest.java | 29 +++++++++++++++++-- .../onedayherocommon/error/ErrorCode.java | 3 +- .../missionchatroom/UserMissionChatRoom.java | 5 +++- .../UserMissionChatRoomRepository.java | 2 ++ 6 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 onedayhero-application/src/main/java/com/sixheroes/onedayheroapplication/chatroom/MissionChatRoomValidator.java diff --git a/onedayhero-application/src/main/java/com/sixheroes/onedayheroapplication/chatroom/ChatRoomService.java b/onedayhero-application/src/main/java/com/sixheroes/onedayheroapplication/chatroom/ChatRoomService.java index d8e383f9..6705da08 100644 --- a/onedayhero-application/src/main/java/com/sixheroes/onedayheroapplication/chatroom/ChatRoomService.java +++ b/onedayhero-application/src/main/java/com/sixheroes/onedayheroapplication/chatroom/ChatRoomService.java @@ -31,6 +31,7 @@ public class ChatRoomService { private static final int MAX_CAPACITY = 2; + private final MissionChatRoomValidator missionChatRoomValidator; private final MissionChatRoomReader missionChatRoomReader; private final MissionChatRoomRepository missionChatRoomRepository; private final UserMissionChatRoomRepository userMissionChatRoomRepository; @@ -42,7 +43,9 @@ public class ChatRoomService { public MissionChatRoomCreateResponse createChatRoom( CreateMissionChatRoomServiceRequest request ) { + missionChatRoomValidator.duplicateMissionChatRoom(request.userIds(), request.missionId()); var missionChatRoom = MissionChatRoom.createMissionChatRoom(request.missionId(), request.userIds()); + var savedMissionChatRoom = missionChatRoomRepository.save(missionChatRoom); missionChatRoomRedisRepository.create(MissionChatRoomRedisRequest.from(missionChatRoom)); diff --git a/onedayhero-application/src/main/java/com/sixheroes/onedayheroapplication/chatroom/MissionChatRoomValidator.java b/onedayhero-application/src/main/java/com/sixheroes/onedayheroapplication/chatroom/MissionChatRoomValidator.java new file mode 100644 index 00000000..1ddd2d65 --- /dev/null +++ b/onedayhero-application/src/main/java/com/sixheroes/onedayheroapplication/chatroom/MissionChatRoomValidator.java @@ -0,0 +1,28 @@ +package com.sixheroes.onedayheroapplication.chatroom; + +import com.sixheroes.onedayherocommon.error.ErrorCode; +import com.sixheroes.onedayherocommon.exception.BusinessException; +import com.sixheroes.onedayherodomain.missionchatroom.repository.UserMissionChatRoomRepository; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.List; + +@Slf4j +@RequiredArgsConstructor +@Component +public class MissionChatRoomValidator { + + private final UserMissionChatRoomRepository userMissionChatRoomRepository; + + public void duplicateMissionChatRoom( + List userIds, + Long missionId + ) { + if (!userMissionChatRoomRepository.findByUserIdInAndMissionChatRoom_MissionId(userIds, missionId).isEmpty()) { + log.warn("이미 존재하는 채팅방입니다. userId : {}, missionId : {}", userIds, missionId); + throw new BusinessException(ErrorCode.DUPLICATE_MISSION_CHATROOM); + } + } +} diff --git a/onedayhero-application/src/test/java/com/sixheroes/onedayheroapplication/chatroom/ChatRoomServiceTest.java b/onedayhero-application/src/test/java/com/sixheroes/onedayheroapplication/chatroom/ChatRoomServiceTest.java index f5d5594a..96fc1697 100644 --- a/onedayhero-application/src/test/java/com/sixheroes/onedayheroapplication/chatroom/ChatRoomServiceTest.java +++ b/onedayhero-application/src/test/java/com/sixheroes/onedayheroapplication/chatroom/ChatRoomServiceTest.java @@ -3,6 +3,7 @@ import com.sixheroes.onedayheroapplication.IntegrationApplicationTest; import com.sixheroes.onedayheroapplication.chatroom.request.CreateMissionChatRoomServiceRequest; import com.sixheroes.onedayherochat.application.repository.request.MissionChatRoomRedisRequest; +import com.sixheroes.onedayherocommon.exception.BusinessException; import com.sixheroes.onedayherodomain.mission.Mission; import com.sixheroes.onedayherodomain.mission.MissionInfo; import com.sixheroes.onedayherodomain.mission.MissionStatus; @@ -19,8 +20,7 @@ import java.util.List; import java.util.UUID; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; +import static org.assertj.core.api.Assertions.*; import static org.mockito.ArgumentMatchers.anyList; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.any; @@ -53,6 +53,31 @@ void createChatRoom() { assertThat(chatRoom.missionId()).isEqualTo(missionId); } + @DisplayName("유저는 동일한 채팅방을 생성 할 수 없다.") + @Test + void createChatRoomWithDuplicate() { + // given + var missionId = 1L; + var userIds = List.of(1L, 2L); + + var request = CreateMissionChatRoomServiceRequest.builder() + .missionId(missionId) + .userIds(userIds) + .build(); + + var missionChatRoom = MissionChatRoom.createMissionChatRoom(request.missionId(), request.userIds()); + var redisRequest = MissionChatRoomRedisRequest.from(missionChatRoom); + + given(missionChatRoomRedisRepository.create(any(MissionChatRoomRedisRequest.class))) + .willReturn(redisRequest); + + chatRoomService.createChatRoom(request); + + // when & then + assertThatThrownBy(() -> chatRoomService.createChatRoom(request)) + .isInstanceOf(BusinessException.class); + } + @DisplayName("유저가 둘 다 나가있지 않은 상태에서 채팅방을 나갈 수 있다.") @Test void exitChatRoomWithMaxConnection() { diff --git a/onedayhero-common/src/main/java/com/sixheroes/onedayherocommon/error/ErrorCode.java b/onedayhero-common/src/main/java/com/sixheroes/onedayherocommon/error/ErrorCode.java index 35440420..9de017fb 100644 --- a/onedayhero-common/src/main/java/com/sixheroes/onedayherocommon/error/ErrorCode.java +++ b/onedayhero-common/src/main/java/com/sixheroes/onedayherocommon/error/ErrorCode.java @@ -94,8 +94,7 @@ public enum ErrorCode { ABORT_CHATROOM_EXIT("MCR_001", "채팅방에 입장한 상태에서만 채팅방 나가기가 가능합니다."), INVALID_CREATE_CHAT("MCR_002", "채팅방을 생성하기 위한 적절한 인원이 들어오지 않았습니다."), NOT_FOUND_CHAT_TOPIC("MCR_003", "저장되어있는 레디스 채팅 토픽을 찾지 못했습니다."), - - // USER_MISSION_CHATROOM + DUPLICATE_MISSION_CHATROOM("MCR_004", "이미 생성되어 있는 채팅방입니다."), // CHAT NOT_FOUND_CHAT_TYPE("CC_000", "존재하지 않는 채팅타입입니다."), diff --git a/onedayhero-domain/src/main/java/com/sixheroes/onedayherodomain/missionchatroom/UserMissionChatRoom.java b/onedayhero-domain/src/main/java/com/sixheroes/onedayherodomain/missionchatroom/UserMissionChatRoom.java index 3fdf612d..678ce0a3 100644 --- a/onedayhero-domain/src/main/java/com/sixheroes/onedayherodomain/missionchatroom/UserMissionChatRoom.java +++ b/onedayhero-domain/src/main/java/com/sixheroes/onedayherodomain/missionchatroom/UserMissionChatRoom.java @@ -13,7 +13,10 @@ @Slf4j @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) -@Table(name = "user_mission_chat_rooms") +@Table(name = "user_mission_chat_rooms", + uniqueConstraints = { + @UniqueConstraint(columnNames = {"mission_chat_room_id", "user_id"}) + }) @Entity public class UserMissionChatRoom extends BaseEntity { diff --git a/onedayhero-domain/src/main/java/com/sixheroes/onedayherodomain/missionchatroom/repository/UserMissionChatRoomRepository.java b/onedayhero-domain/src/main/java/com/sixheroes/onedayherodomain/missionchatroom/repository/UserMissionChatRoomRepository.java index b33c899b..0f91e206 100644 --- a/onedayhero-domain/src/main/java/com/sixheroes/onedayherodomain/missionchatroom/repository/UserMissionChatRoomRepository.java +++ b/onedayhero-domain/src/main/java/com/sixheroes/onedayherodomain/missionchatroom/repository/UserMissionChatRoomRepository.java @@ -28,4 +28,6 @@ public interface UserMissionChatRoomRepository extends JpaRepository findReceiverChatRoomInfoInChatRoomIdsAndUserId(List chatRoomIds, Long userId); List findByUserIdAndIsJoinedTrue(Long userId); + + List findByUserIdInAndMissionChatRoom_MissionId(List userIds, Long missionId); } \ No newline at end of file From e477a505804fcf3f9efa17692f8f9b56af7ac647 Mon Sep 17 00:00:00 2001 From: Bombo Date: Thu, 30 Nov 2023 14:03:22 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[SIX-274]=20fix=20:=20=EC=A4=91=EB=B3=B5?= =?UTF-8?q?=EB=90=9C=20=EC=B1=84=ED=8C=85=EB=B0=A9=20=EC=83=9D=EC=84=B1=20?= =?UTF-8?q?=EA=B2=80=EC=A6=9D=20=EB=A1=9C=EC=A7=81=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/static/docs/index.html | 132 +++++++++--------- .../chatroom/MissionChatRoomValidator.java | 2 +- 2 files changed, 67 insertions(+), 67 deletions(-) diff --git a/onedayhero-api/src/main/resources/static/docs/index.html b/onedayhero-api/src/main/resources/static/docs/index.html index 15d695cd..5f7b3c9c 100644 --- a/onedayhero-api/src/main/resources/static/docs/index.html +++ b/onedayhero-api/src/main/resources/static/docs/index.html @@ -606,7 +606,7 @@

HTTP Response
HTTP/1.1 201 Created
-Set-Cookie: refreshToken=e9512560-c782-45f6-8b8d-9eab64edd6b9; HttpOnly
+Set-Cookie: refreshToken=4167ef33-4fb1-452d-8c71-24bc2c6abe72; HttpOnly
 Location:
 Content-Type: application/json;charset=UTF-8
 Content-Length: 134
@@ -617,7 +617,7 @@ 

HTTP Response "userId" : 1, "accessToken" : "accessToken" }, - "serverDateTime" : "2023-11-30T01:23:19" + "serverDateTime" : "2023-11-30T14:01:26" }

@@ -733,7 +733,7 @@

HTTP Response @@ -885,7 +885,7 @@

HTTP Response "heroScore" : 30, "isHeroMode" : false }, - "serverDateTime" : "2023-11-30T01:23:22" + "serverDateTime" : "2023-11-30T14:01:31" } @@ -1205,7 +1205,7 @@

HTTP Response "data" : { "id" : 1 }, - "serverDateTime" : "2023-11-30T01:23:22" + "serverDateTime" : "2023-11-30T14:01:31" } @@ -1323,7 +1323,7 @@

HTTP Response { "status" : 204, "data" : null, - "serverDateTime" : "2023-11-30T01:23:23" + "serverDateTime" : "2023-11-30T14:01:31" } @@ -1525,7 +1525,7 @@

HTTP Response "empty" : false } }, - "serverDateTime" : "2023-11-30T01:23:23" + "serverDateTime" : "2023-11-30T14:01:31" } @@ -1903,7 +1903,7 @@

HTTP Response "starScore" : 3, "senderNickname" : "리뷰 작성자 닉네임", "profileImage" : [ "s3 프로필 이미지 주소" ], - "createdAt" : "2023-11-30T01:23:22" + "createdAt" : "2023-11-30T14:01:31" }, { "reviewId" : 2, "categoryName" : "청소", @@ -1911,7 +1911,7 @@

HTTP Response "starScore" : 4, "senderNickname" : "리뷰 작성자 닉네임", "profileImage" : [ "s3 프로필 이미지 주소" ], - "createdAt" : "2023-11-30T01:23:22" + "createdAt" : "2023-11-30T14:01:31" } ], "pageable" : { "pageNumber" : 0, @@ -1937,7 +1937,7 @@

HTTP Response "numberOfElements" : 2, "empty" : false }, - "serverDateTime" : "2023-11-30T01:23:22" + "serverDateTime" : "2023-11-30T14:01:31" } @@ -2253,7 +2253,7 @@

HTTP Response "categoryName" : "청소", "missionTitle" : "청소 미션", "starScore" : 4, - "createdAt" : "2023-11-30T01:23:22" + "createdAt" : "2023-11-30T14:01:31" }, { "reviewId" : 2, "senderId" : 8, @@ -2262,7 +2262,7 @@

HTTP Response "categoryName" : "심부름", "missionTitle" : "심부름 미션", "starScore" : 3, - "createdAt" : "2023-11-30T01:23:22" + "createdAt" : "2023-11-30T14:01:31" } ], "pageable" : { "pageNumber" : 0, @@ -2288,7 +2288,7 @@

HTTP Response "numberOfElements" : 2, "empty" : false }, - "serverDateTime" : "2023-11-30T01:23:22" + "serverDateTime" : "2023-11-30T14:01:31" } @@ -2578,7 +2578,7 @@

HTTP Response "data" : { "id" : 1 }, - "serverDateTime" : "2023-11-30T01:23:22" + "serverDateTime" : "2023-11-30T14:01:31" } @@ -2679,7 +2679,7 @@

HTTP Respon "data" : { "id" : 1 }, - "serverDateTime" : "2023-11-30T01:23:22" + "serverDateTime" : "2023-11-30T14:01:31" } @@ -2796,7 +2796,7 @@

HTTP Respon }, "heroScore" : 60 }, - "serverDateTime" : "2023-11-30T01:23:22" + "serverDateTime" : "2023-11-30T14:01:31" } @@ -2988,7 +2988,7 @@

HTTP Respon } ], "heroScore" : 60 }, - "serverDateTime" : "2023-11-30T01:23:22" + "serverDateTime" : "2023-11-30T14:01:31" } @@ -3292,7 +3292,7 @@

HTTP Respon "numberOfElements" : 3, "empty" : false }, - "serverDateTime" : "2023-11-30T01:23:22" + "serverDateTime" : "2023-11-30T14:01:31" } @@ -3696,7 +3696,7 @@

HTTP Respon "data" : { "id" : 1 }, - "serverDateTime" : "2023-11-30T01:23:20" + "serverDateTime" : "2023-11-30T14:01:28" } @@ -3849,7 +3849,7 @@

Http Respon } ], "isBookmarked" : true }, - "serverDateTime" : "2023-11-30T01:23:20" + "serverDateTime" : "2023-11-30T14:01:28" } @@ -4263,7 +4263,7 @@

Http Respon "numberOfElements" : 2, "empty" : false }, - "serverDateTime" : "2023-11-30T01:23:20" + "serverDateTime" : "2023-11-30T14:01:28" } @@ -4725,7 +4725,7 @@

Http Respon "numberOfElements" : 1, "empty" : false }, - "serverDateTime" : "2023-11-30T01:23:20" + "serverDateTime" : "2023-11-30T14:01:28" } @@ -5096,7 +5096,7 @@

Http Respon "numberOfElements" : 1, "empty" : false }, - "serverDateTime" : "2023-11-30T01:23:20" + "serverDateTime" : "2023-11-30T14:01:28" } @@ -5474,7 +5474,7 @@

Http Respon "isBookmarked" : true } ] }, - "serverDateTime" : "2023-11-30T01:23:20" + "serverDateTime" : "2023-11-30T14:01:28" } @@ -5822,7 +5822,7 @@

HTTP Respon "data" : { "id" : 1 }, - "serverDateTime" : "2023-11-30T01:23:20" + "serverDateTime" : "2023-11-30T14:01:28" } @@ -5998,7 +5998,7 @@

HTTP Respon "data" : { "id" : 1 }, - "serverDateTime" : "2023-11-30T01:23:21" + "serverDateTime" : "2023-11-30T14:01:28" } @@ -6115,7 +6115,7 @@

HTTP Respon "data" : { "id" : 1 }, - "serverDateTime" : "2023-11-30T01:23:20" + "serverDateTime" : "2023-11-30T14:01:28" } @@ -6233,7 +6233,7 @@

HTTP Respon { "status" : 204, "data" : null, - "serverDateTime" : "2023-11-30T01:23:21" + "serverDateTime" : "2023-11-30T14:01:28" } @@ -6426,7 +6426,7 @@

Http Respon "numberOfElements" : 2, "empty" : false }, - "serverDateTime" : "2023-11-30T01:23:20" + "serverDateTime" : "2023-11-30T14:01:28" } @@ -6803,7 +6803,7 @@

HTTP Respon { "status" : 204, "data" : null, - "serverDateTime" : "2023-11-30T01:23:21" + "serverDateTime" : "2023-11-30T14:01:28" } @@ -6937,7 +6937,7 @@

HTTP Respon "data" : { "id" : 1 }, - "serverDateTime" : "2023-11-30T01:23:20" + "serverDateTime" : "2023-11-30T14:01:27" } @@ -7071,7 +7071,7 @@

HTTP Respon { "status" : 204, "data" : null, - "serverDateTime" : "2023-11-30T01:23:20" + "serverDateTime" : "2023-11-30T14:01:27" } @@ -7169,7 +7169,7 @@

HTTP Respon "data" : { "id" : 1 }, - "serverDateTime" : "2023-11-30T01:23:21" + "serverDateTime" : "2023-11-30T14:01:29" } @@ -7305,7 +7305,7 @@

HTTP Respon "data" : { "id" : 1 }, - "serverDateTime" : "2023-11-30T01:23:21" + "serverDateTime" : "2023-11-30T14:01:29" } @@ -7455,7 +7455,7 @@

HTTP Respon "data" : { "id" : 1 }, - "serverDateTime" : "2023-11-30T01:23:21" + "serverDateTime" : "2023-11-30T14:01:29" } @@ -7574,7 +7574,7 @@

HTTP Respon "data" : { "id" : 1 }, - "serverDateTime" : "2023-11-30T01:23:21" + "serverDateTime" : "2023-11-30T14:01:29" } @@ -7674,7 +7674,7 @@

HTTP Respon "data" : { "id" : 1 }, - "serverDateTime" : "2023-11-30T01:23:21" + "serverDateTime" : "2023-11-30T14:01:29" } @@ -7807,7 +7807,7 @@

HTTP Respon "status" : "MATCHING", "bookmarkCount" : 5, "isBookmarked" : true, - "createdAt" : "2023-11-30T01:23:21", + "createdAt" : "2023-11-30T14:01:29", "region" : { "si" : "서울시", "gu" : "프로구", @@ -7834,7 +7834,7 @@

HTTP Respon "status" : "MATCHING", "bookmarkCount" : 5, "isBookmarked" : true, - "createdAt" : "2023-11-29T01:23:21", + "createdAt" : "2023-11-29T14:01:29", "region" : { "si" : "서울시", "gu" : "프로구", @@ -7861,7 +7861,7 @@

HTTP Respon "status" : "MATCHING_COMPLETED", "bookmarkCount" : 5, "isBookmarked" : true, - "createdAt" : "2023-11-27T01:23:21", + "createdAt" : "2023-11-27T14:01:29", "region" : { "si" : "서울시", "gu" : "프로구", @@ -7888,7 +7888,7 @@

HTTP Respon "status" : "MISSION_COMPLETED", "bookmarkCount" : 5, "isBookmarked" : true, - "createdAt" : "2023-11-28T01:23:21", + "createdAt" : "2023-11-28T14:01:29", "region" : { "si" : "서울시", "gu" : "프로구", @@ -7915,7 +7915,7 @@

HTTP Respon "status" : "EXPIRED", "bookmarkCount" : 5, "isBookmarked" : true, - "createdAt" : "2023-11-27T01:23:21", + "createdAt" : "2023-11-27T14:01:29", "region" : { "si" : "서울시", "gu" : "프로구", @@ -7959,7 +7959,7 @@

HTTP Respon "numberOfElements" : 5, "empty" : false }, - "serverDateTime" : "2023-11-30T01:23:21" + "serverDateTime" : "2023-11-30T14:01:29" } @@ -8404,7 +8404,7 @@

HTTP Respon "data" : { "id" : 1 }, - "serverDateTime" : "2023-11-30T01:23:22" + "serverDateTime" : "2023-11-30T14:01:30" } @@ -8526,7 +8526,7 @@

HTTP Respon "data" : { "id" : 1 }, - "serverDateTime" : "2023-11-30T01:23:22" + "serverDateTime" : "2023-11-30T14:01:30" } @@ -8648,9 +8648,9 @@

HTTP Respon "uniqueName" : "B", "path" : "S3 이미지 주소B" } ], - "createdAt" : "2023-11-30T01:23:22" + "createdAt" : "2023-11-30T14:01:30" }, - "serverDateTime" : "2023-11-30T01:23:22" + "serverDateTime" : "2023-11-30T14:01:30" } @@ -8861,7 +8861,7 @@

HTTP Respon { "status" : 204, "data" : null, - "serverDateTime" : "2023-11-30T01:23:22" + "serverDateTime" : "2023-11-30T14:01:30" } @@ -8945,7 +8945,7 @@

HTTP Respon "categoryName" : "청소", "missionTitle" : "청소 미션", "starScore" : 4, - "createdAt" : "2023-11-30T01:23:22" + "createdAt" : "2023-11-30T14:01:30" }, { "reviewId" : 2, "senderId" : 8, @@ -8954,7 +8954,7 @@

HTTP Respon "categoryName" : "심부름", "missionTitle" : "심부름 미션", "starScore" : 3, - "createdAt" : "2023-11-30T01:23:22" + "createdAt" : "2023-11-30T14:01:30" } ], "pageable" : { "pageNumber" : 0, @@ -8980,7 +8980,7 @@

HTTP Respon "numberOfElements" : 2, "empty" : false }, - "serverDateTime" : "2023-11-30T01:23:22" + "serverDateTime" : "2023-11-30T14:01:30" } @@ -9287,7 +9287,7 @@

HTTP Respon { "status" : 204, "data" : null, - "serverDateTime" : "2023-11-30T01:23:22" + "serverDateTime" : "2023-11-30T14:01:30" } @@ -9467,7 +9467,7 @@

HTTP Respon "isBookmarked" : false } ] }, - "serverDateTime" : "2023-11-30T01:23:20" + "serverDateTime" : "2023-11-30T14:01:27" } @@ -9804,22 +9804,22 @@

HTTP Respon "status" : 200, "data" : { "content" : [ { - "id" : "a624dea6-d0f4-4bd9-aef6-7b2d608cb4ca", + "id" : "d8085649-8871-4f59-b5e1-8327f1bfb67d", "title" : "알림 제목", "content" : "알림 내용", "createdAt" : "2023-11-21T12:00:00" }, { - "id" : "53ebcf3d-d464-4b84-8642-bd3fab90d041", + "id" : "6ab96e33-a954-4e3a-8193-034f9a6175b4", "title" : "알림 제목", "content" : "알림 내용", "createdAt" : "2023-11-21T10:00:00" }, { - "id" : "bb90ac5c-bf53-4103-b966-13e010552a0d", + "id" : "aa76fb7c-11e2-4e82-af63-ffb1505202e0", "title" : "알림 제목", "content" : "알림 내용", "createdAt" : "2023-11-20T12:00:00" }, { - "id" : "ec0c92b4-a4e2-4397-92b9-8e7c495fa9d8", + "id" : "2d09ba30-bd2a-400f-b4ba-22fa3b0145f0", "title" : "알림 제목", "content" : "알림 내용", "createdAt" : "2023-11-14T12:00:00" @@ -9848,7 +9848,7 @@

HTTP Respon "numberOfElements" : 4, "empty" : false }, - "serverDateTime" : "2023-11-30T01:23:19" + "serverDateTime" : "2023-11-30T14:01:26" } @@ -10072,7 +10072,7 @@

알림 삭제

HTTP Request

-
DELETE /api/v1/alarms/b5a3a6a1-4edb-4813-9951-de35f1dbf7fb HTTP/1.1
+
DELETE /api/v1/alarms/ebaea16e-e3a5-4d1b-ad2d-e587b569416f HTTP/1.1
 Content-Type: application/json;charset=UTF-8
 Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwicm9sZSI6Ik1FTUJFUiIsImlhdCI6MTY5OTk0MDA5NiwiZXhwIjoxNzU5OTQwMDk2fQ.7xyZyQIzbkp-FLxNOLXpSI3Yg0CZ8tAJvlHrgATzZB4
 Host: localhost:8080
@@ -10127,7 +10127,7 @@

HTTP Respon { "status" : 204, "data" : null, - "serverDateTime" : "2023-11-30T01:23:19" + "serverDateTime" : "2023-11-30T14:01:26" }

@@ -10254,7 +10254,7 @@

HTTP Respon "missionId" : 1, "headCount" : 2 }, - "serverDateTime" : "2023-11-30T01:23:19" + "serverDateTime" : "2023-11-30T14:01:27" } @@ -10389,7 +10389,7 @@

HTTP Respon "headCount" : 2, "lastSentMessageTime" : "2023-11-12T12:00:00" } ], - "serverDateTime" : "2023-11-30T01:23:19" + "serverDateTime" : "2023-11-30T14:01:27" } @@ -10580,7 +10580,7 @@

HTTP Respon "message" : "안녕하세요! 미션 내용 확인하고자합니다!", "sentMessageTime" : "2023-11-26T19:27:00" } ], - "serverDateTime" : "2023-11-30T01:23:19" + "serverDateTime" : "2023-11-30T14:01:27" } @@ -10705,7 +10705,7 @@

HTTP Respon "userId" : 1, "missionId" : 1 }, - "serverDateTime" : "2023-11-30T01:23:19" + "serverDateTime" : "2023-11-30T14:01:27" } @@ -10825,7 +10825,7 @@

HTTP Respon } ] } ] } ], - "serverDateTime" : "2023-11-30T01:23:22" + "serverDateTime" : "2023-11-30T14:01:30" } diff --git a/onedayhero-application/src/main/java/com/sixheroes/onedayheroapplication/chatroom/MissionChatRoomValidator.java b/onedayhero-application/src/main/java/com/sixheroes/onedayheroapplication/chatroom/MissionChatRoomValidator.java index 1ddd2d65..f0fcab9f 100644 --- a/onedayhero-application/src/main/java/com/sixheroes/onedayheroapplication/chatroom/MissionChatRoomValidator.java +++ b/onedayhero-application/src/main/java/com/sixheroes/onedayheroapplication/chatroom/MissionChatRoomValidator.java @@ -20,7 +20,7 @@ public void duplicateMissionChatRoom( List userIds, Long missionId ) { - if (!userMissionChatRoomRepository.findByUserIdInAndMissionChatRoom_MissionId(userIds, missionId).isEmpty()) { + if (userMissionChatRoomRepository.findByUserIdInAndMissionChatRoom_MissionId(userIds, missionId).size() == 2) { log.warn("이미 존재하는 채팅방입니다. userId : {}, missionId : {}", userIds, missionId); throw new BusinessException(ErrorCode.DUPLICATE_MISSION_CHATROOM); }