Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#127] Refactor: Swagger API 명세 리팩토링 #128

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class AuthController {


@PutMapping(value = "/signup", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "회원가입 [jwt O]",
@Operation(summary = "회원가입 Page - 회원가입 [JWT O]",
description = """
- 사진 변경 X : imageFile == null && signupRequestDto.getIsImageChange() == 0
- 사진 변경 O : imageFile != null && signupRequestDto.getIsImageChange() == 1
Expand All @@ -43,14 +43,14 @@ public ResponseEntity<ResponseData<SignupResponseDto>> signup(
}

@PostMapping("/reissue")
@Operation(summary = "JWT Access Token 재발급(로그인 유지) [jwt X]")
@Operation(summary = "JWT Access Token 재발급 [JWT X]")
public ResponseEntity<ResponseData<TokenDto>> reissue(@RequestBody ReissueRequestDto reissueRequestDto) {
TokenDto tokenDto = tokenService.reissue(reissueRequestDto);
return ResponseData.toResponseEntity(ResponseCode.REISSUE_SUCCESS, tokenDto);
}

@DeleteMapping("/users")
@Operation(summary = "회원 탈퇴 [jwt O]")
@Operation(summary = "마이 Page - 회원탈퇴 [JWT O]")
public ResponseEntity<ResponseData> withdrawal() {
authService.withdrawal();
return ResponseData.toResponseEntity(ResponseCode.DELETE_USER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class ChatController {


@GetMapping("/rooms/{roomId}/chats")
@Operation(summary = "채팅 내역 조회 [jwt O]", description = "- URI : /rooms/{roomId}/chats?page={페이지번호 int} \nsize,sort 필요X (기본값 : size=10 & sort=createdTime,desc)")
@Operation(summary = "문제풀이 Page - 채팅 내역 조회 [JWT O]", description = "- URI : /rooms/{roomId}/chats?page={페이지번호 int} \nsize,sort 필요X (기본값 : size=10 & sort=createdTime,desc)")
public ResponseEntity<ResponseData<Slice<ChatResponseDto>>> findChatsByRoom(
@PathVariable(value = "roomId") Long roomId, // value=""를 작성해주어야만, Swagger에서 api테스트할때 이름값이 뜸.
@PageableDefault(size=10, sort="createdTime", direction = Sort.Direction.DESC) Pageable pageable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,42 +35,42 @@ public class RoomController {


@PostMapping("/rooms")
@Operation(summary = "방생성 Page - 방 생성 [jwt O]")
@Operation(summary = "방생성 Page - 방 생성 [JWT O]")
public ResponseEntity<ResponseData<RoomResponseDto>> createRoom(@RequestBody ProblemSaveRequestDto problemSaveRequestDto) throws IOException {
RoomResponseDto roomResponseDto = roomService.createRoom(problemSaveRequestDto);
return ResponseData.toResponseEntity(ResponseCode.CREATED_ROOM, roomResponseDto);
}

@GetMapping("/rooms")
@Operation(summary = "초대링크 방 조회 [jwt O]", description = "URI : /rooms?link={방링크 string}")
@Operation(summary = "초대링크 방 조회 [JWT O]", description = "URI : /rooms?link={방링크 string}")
public ResponseEntity<ResponseData<RoomResponseDto>> findRoomByLink(@RequestParam(value = "link", required = true) String link) {
RoomResponseDto roomResponseDto = roomService.findRoomByLink(link);
return ResponseData.toResponseEntity(ResponseCode.READ_ROOM, roomResponseDto);
}

@GetMapping("/rooms/{roomId}")
@Operation(summary = "문제풀이 Page - 문제풀이 페이지 정보 조회 [jwt O]")
@Operation(summary = "문제풀이 Page - 문제풀이 페이지 정보 조회 [JWT O]")
public ResponseEntity<ResponseData<SolvingPageResponseDto>> loadSolvingPage(@PathVariable(value = "roomId") Long roomId) { // value=""를 작성해주어야만, Swagger에서 api테스트할때 이름값이 뜸.
SolvingPageResponseDto solvingPageResponseDto = userRoomService.loadSolvingPage(roomId);
return ResponseData.toResponseEntity(ResponseCode.READ_USERROOM, solvingPageResponseDto);
}

@GetMapping("/rooms/{roomId}/access-check")
@Operation(summary = "문제풀이 Page - 문제풀이 페이지 접근허용 검사 [jwt O]", description = "isLeave == 0 or 1 or null")
@Operation(summary = "문제풀이 Page - 문제풀이 페이지 접근허용 검사 [JWT O]", description = "isLeave == 0 or 1 or null")
public ResponseEntity<ResponseData<RoomCheckAccessResponseDto>> checkAccess(@PathVariable(value = "roomId") Long roomId) {
RoomCheckAccessResponseDto roomCheckAccessResponseDto = userRoomService.checkAccess(roomId);
return ResponseData.toResponseEntity(ResponseCode.READ_USERROOM, roomCheckAccessResponseDto);
}

@GetMapping("/rooms/{roomId}/state-check")
@Operation(summary = "입장 Page - 방 상태 검사 [jwt O]", description = "dtoList index==0 : 방장 / dtoList index==others : 방장 외 대기자들 접속시간 기준 오름차순 정렬")
@Operation(summary = "입장 Page - 방 상태 검사 [JWT O]", description = "dtoList index==0 : 방장 / dtoList index==others : 방장 외 대기자들 접속시간 기준 오름차순 정렬")
public ResponseEntity<ResponseData<RoomCheckStateResponseDto>> checkState(@PathVariable(value = "roomId") Long roomId) {
RoomCheckStateResponseDto roomCheckStateResponseDto = roomService.checkState(roomId);
return ResponseData.toResponseEntity(ResponseCode.READ_USERROOM, roomCheckStateResponseDto);
}

@PostMapping("/rooms/{roomId}") // 의미상 PUT보단 POST가 더 적합하다고 판단했음.
@Operation(summary = "문제풀이 Page - 문제풀이 성공 및 실패/퇴장 [jwt O]", description = "isRetry==0 : 첫풀이 경우 / isRetry==1 : 재풀이 경우")
@Operation(summary = "문제풀이 Page - 문제풀이 성공 및 실패/퇴장 [JWT O]", description = "isRetry==0 : 첫풀이 경우 / isRetry==1 : 재풀이 경우")
public ResponseEntity<ResponseData> passSolvingProblem(
@PathVariable(value = "roomId") Long roomId,
@RequestBody UserPassRequestDto userPassRequestDto) {
Expand All @@ -80,7 +80,7 @@ public ResponseEntity<ResponseData> passSolvingProblem(
}

@PutMapping("/rooms/{roomId}")
@Operation(summary = "입장 Page - 방 입장 대기열 나가기 [jwt O]")
@Operation(summary = "입장 Page - 방 입장 대기열 나가기 [JWT O]")
public ResponseEntity<ResponseData> userStopWaitRoom(@PathVariable(value = "roomId") Long roomId) {
userRoomService.userStopWaitRoom(roomId);
return ResponseData.toResponseEntity(ResponseCode.UPDATE_ROOM);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class TestController {

@GetMapping("/health")
@Operation(summary = "서버 헬스체크 [jwt X]")
@Operation(summary = "서버 헬스체크 [JWT X]")
public ResponseEntity<ResponseData> healthCheck() {
return ResponseData.toResponseEntity(ResponseCode.HEALTHY_SUCCESS);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ public class UserController {


@GetMapping("/users")
@Operation(summary = "사용자 프로필 조회 [jwt O]")
@Operation(summary = "마이 Page - 사용자 프로필 조회 [JWT O]")
public ResponseEntity<ResponseData<UserResponseDto>> findUserProfile() {
UserResponseDto userResponseDto = userService.findUserProfile();
return ResponseData.toResponseEntity(ResponseCode.READ_USER, userResponseDto);
}

@PutMapping(value = "/users", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "사용자 프로필 수정 [jwt O]",
@Operation(summary = "마이 Page - 사용자 프로필 수정 [JWT O]",
description = """
- 사진 변경 X : imageFile == null && signupRequestDto.getIsImageChange() == 0
- 사진 변경 O : imageFile != null && signupRequestDto.getIsImageChange() == 1
Expand All @@ -55,7 +55,7 @@ public ResponseEntity<ResponseData> updateUserProfile(
}

@GetMapping("/users/rooms")
@Operation(summary = "코드방 목록 조회/정렬/검색 [jwt O]",
@Operation(summary = "내 코드 Page - 코드방 목록 조회/정렬/검색 [JWT O]",
description = """
- 전체 정렬 URI : /users/rooms?page={페이지번호 int}
- 성공or실패 정렬 URI : /users/rooms?isPass={풀이성공여부 int}&page={페이지번호 int}
Expand All @@ -71,14 +71,14 @@ public ResponseEntity<ResponseData<Page<CodeRoomResponseDto>>> findCodeRooms(
}

@GetMapping("/users/rooms-check")
@Operation(summary = "메인 Page - 참여중인 방 여부 검사 [jwt O]", description = "roomId == Long or null")
@Operation(summary = "메인 Page - 참여중인 방 여부 검사 [JWT O]", description = "roomId == Long or null")
public ResponseEntity<ResponseData<UserCheckRoomResponseDto>> checkCurrentRoom() {
UserCheckRoomResponseDto userCheckRoomResponseDto = userService.checkCurrentRoom();
return ResponseData.toResponseEntity(ResponseCode.READ_ROOM, userCheckRoomResponseDto);
}

@GetMapping("/users/solved-count")
@Operation(summary = "백준 solvedCount값 조회 [jwt O]")
@Operation(summary = "사용자 백준 solvedCount값 조회 [JWT O]")
public ResponseEntity<ResponseData<UserSolvedResponseDto>> checkUserSolvedCount() {
UserSolvedResponseDto userSolvedResponseDto = userService.checkUserSolvedCount();
return ResponseData.toResponseEntity(ResponseCode.READ_SOLVEDCOUNT, userSolvedResponseDto);
Expand Down
Loading