From dd213f153ea34bfc9b988c5b144a4acb3c9387aa Mon Sep 17 00:00:00 2001 From: sooyeon_nine <124496650+KooSuYeon@users.noreply.github.com> Date: Sun, 17 Nov 2024 15:56:02 +0900 Subject: [PATCH] hotfix/chatroom-delete-backHoldAt-1: (#289) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 채팅 불러오기 시에 실행되는 LastHoldAt이 중복으로 실행되는 엔드포인트 PUT :/chatrooms/{roomId}/hold 삭제 --- .../dife/api/controller/ChatroomController.java | 7 ------- .../controller/SwaggerChatroomController.java | 14 -------------- .../com/dife/api/service/ChatroomService.java | 16 ---------------- 3 files changed, 37 deletions(-) diff --git a/src/main/java/com/dife/api/controller/ChatroomController.java b/src/main/java/com/dife/api/controller/ChatroomController.java index adafe7d2..60806072 100644 --- a/src/main/java/com/dife/api/controller/ChatroomController.java +++ b/src/main/java/com/dife/api/controller/ChatroomController.java @@ -121,13 +121,6 @@ public ResponseEntity chatroomReEnter( return new ResponseEntity<>(OK); } - @PutMapping("/{roomId}/hold") - public ResponseEntity chatroomHold( - @PathVariable(name = "roomId") Long roomId, Authentication auth) { - chatroomService.chatroomHold(roomId, auth.getName()); - return new ResponseEntity<>(OK); - } - @GetMapping("/{roomId}/{memberId}") public ResponseEntity kickoutMember( @PathVariable(name = "roomId") Long roomId, diff --git a/src/main/java/com/dife/api/controller/SwaggerChatroomController.java b/src/main/java/com/dife/api/controller/SwaggerChatroomController.java index 9f002ffd..379b6e01 100644 --- a/src/main/java/com/dife/api/controller/SwaggerChatroomController.java +++ b/src/main/java/com/dife/api/controller/SwaggerChatroomController.java @@ -109,20 +109,6 @@ ResponseEntity> getChatrooms( ResponseEntity getChatroom( @PathVariable(name = "id") Long id, Authentication auth) throws IOException; - @Operation( - summary = "채팅방 뒤로가기(hold) 생성 API", - description = "서버 측에서 사용자가 채팅방 뒤로가기를 했음을 인식하게 해주는 API입니다. 해당 API를 이용해 채팅 수를 계산하게 됩니다.") - @ApiResponse( - responseCode = "200", - description = "채팅방 뒤로가기 성공 예시", - content = { - @Content( - mediaType = "application/json", - schema = @Schema(implementation = ChatroomResponseDto.class)) - }) - ResponseEntity chatroomHold( - @PathVariable(name = "roomId") Long roomId, Authentication auth); - @Operation( summary = "채팅방 재입장 생성 API", description = "서버 측에서 채팅방 Id와 Auth로 퇴장한 채팅방 재입장 허가를 해주는 API입니다.") diff --git a/src/main/java/com/dife/api/service/ChatroomService.java b/src/main/java/com/dife/api/service/ChatroomService.java index e7d92f1c..ed33e36e 100644 --- a/src/main/java/com/dife/api/service/ChatroomService.java +++ b/src/main/java/com/dife/api/service/ChatroomService.java @@ -444,22 +444,6 @@ public void chatroomReEnter(Long chatroomId, String memberEmail) { throw new ChatroomReEnterException("채팅방 재입장에 실패했습니다"); } - public void chatroomHold(Long chatroomId, String memberEmail) { - Chatroom chatroom = - chatroomRepository.findById(chatroomId).orElseThrow(ChatroomNotFoundException::new); - - Member member = - memberRepository.findByEmail(memberEmail).orElseThrow(MemberNotFoundException::new); - - ChatroomMember chatroomMember = - chatroomMemberRepository - .findByChatroomAndMember(chatroom, member) - .orElseThrow(ChatroomNotFoundException::new); - - chatroomMember.setLastHoldAt(LocalDateTime.now()); - chatroomMemberRepository.save(chatroomMember); - } - private String getLastChat(Chatroom chatroom) { List chats = chatroom.getChats().stream()