Skip to content

Commit

Permalink
hotfix/chatroom-delete-backHoldAt-1: (#289)
Browse files Browse the repository at this point in the history
채팅 불러오기 시에 실행되는 LastHoldAt이 중복으로 실행되는 엔드포인트 PUT :/chatrooms/{roomId}/hold 삭제
  • Loading branch information
KooSuYeon authored Nov 17, 2024
1 parent 0a5d2a3 commit dd213f1
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 37 deletions.
7 changes: 0 additions & 7 deletions src/main/java/com/dife/api/controller/ChatroomController.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,6 @@ public ResponseEntity<Void> chatroomReEnter(
return new ResponseEntity<>(OK);
}

@PutMapping("/{roomId}/hold")
public ResponseEntity<Void> chatroomHold(
@PathVariable(name = "roomId") Long roomId, Authentication auth) {
chatroomService.chatroomHold(roomId, auth.getName());
return new ResponseEntity<>(OK);
}

@GetMapping("/{roomId}/{memberId}")
public ResponseEntity<Void> kickoutMember(
@PathVariable(name = "roomId") Long roomId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,6 @@ ResponseEntity<List<ChatroomResponseDto>> getChatrooms(
ResponseEntity<ChatroomResponseDto> 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<Void> chatroomHold(
@PathVariable(name = "roomId") Long roomId, Authentication auth);

@Operation(
summary = "채팅방 재입장 생성 API",
description = "서버 측에서 채팅방 Id와 Auth로 퇴장한 채팅방 재입장 허가를 해주는 API입니다.")
Expand Down
16 changes: 0 additions & 16 deletions src/main/java/com/dife/api/service/ChatroomService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Chat> chats =
chatroom.getChats().stream()
Expand Down

0 comments on commit dd213f1

Please sign in to comment.