Skip to content

Commit

Permalink
feat: 스웨거 설명 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
koreaioi committed Nov 11, 2024
1 parent 7dc6301 commit 62796b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.leets.X.domain.chat.dto.response.ChatRoomResponseDto;
import com.leets.X.domain.chat.service.ChatRoomService;
import com.leets.X.global.common.response.ResponseDto;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
Expand All @@ -21,6 +22,7 @@ public class ChatRoomController {
private final ChatRoomService chatRoomService;

@PostMapping
@Operation(summary = "채팅 방 생성")
public ResponseDto<ChatRoomResponseDto> createChatRoom(@RequestBody @Valid FindChatRoomRequestDto findChatRoomRequestDto){
ChatRoomResponseDto response = chatRoomService.saveChatRoom(findChatRoomRequestDto);
return ResponseDto.response(CHATROOM_CREATE_SUCCESS.getCode(), CHATROOM_CREATE_SUCCESS.getMessage(), response);
Expand All @@ -30,13 +32,15 @@ public ResponseDto<ChatRoomResponseDto> createChatRoom(@RequestBody @Valid FindC

// user1Id와 user2Id의 채팅방이 있는 지 조회
@GetMapping("/{user1Id}/{user2Id}")
@Operation(summary = "채팅방 존재 여부 확인")
public ResponseDto<ChatRoomResponseDto> existChatRoom(@PathVariable Long user1Id, @PathVariable Long user2Id){
ChatRoomResponseDto response = chatRoomService.findUser1User2ChatRoom(user1Id , user2Id);

return ResponseDto.response(ROOMID_GET.getCode(), ROOMID_GET.getMessage(), response);
}

@PostMapping("/{roomId}") // addListener 테스트 용
@Operation(summary = "채팅 방 addListener 테스트")
public void addListener(@PathVariable @NotNull Long roomId) {
chatRoomService.addListener(roomId);
log.info(roomId+":addListener");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.leets.X.domain.chat.dto.response.ChattingListResponseDto;
import com.leets.X.domain.chat.service.ChattingService;
import com.leets.X.global.common.response.ResponseDto;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

Expand All @@ -19,15 +20,16 @@ public class ChattingController {

private final ChattingService chattingService;

// 채팅방 하나를 조회해준다. (대화 내역을 돌려준다는 의미)
@GetMapping("/chatting/{roomId}/{page}/{size}")
@Operation(summary = "하나의 채팅방 + 해당 채팅 내역 조회")
public ResponseDto<ChattingDto> findChatting(@PathVariable Long roomId, @PathVariable Integer page, @PathVariable Integer size) {
ChattingDto response = chattingService.getChatRoom(roomId, page, size);
return ResponseDto.response(CHATROOM_GET.getCode(), CHATROOM_GET.getMessage(), response);
}


@GetMapping("/chattingList/{userId}")
@Operation(summary = "유저가 속한 모든 채팅방 조회")
public ResponseDto<List<ChattingListResponseDto>> findChattingList(@PathVariable Long userId){
List<ChattingListResponseDto> response = chattingService.getChattingList(userId);
return ResponseDto.response(CHATTINGLIST_GET.getCode(), CHATTINGLIST_GET.getMessage(), response);
Expand Down

0 comments on commit 62796b5

Please sign in to comment.