From 80971a9d5b96f933833216ce957c3bab31c4136b Mon Sep 17 00:00:00 2001 From: gardening-y <60008786@naver.com> Date: Tue, 16 Jan 2024 07:07:33 +0900 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20=ED=9A=8C=EC=9B=90=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20API=20Swagger=20=EC=84=A4=EC=A0=95=20(#90)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/doorip/user/api/UserApi.java | 364 ++++++++++++++++++ 1 file changed, 364 insertions(+) create mode 100644 doorip-api/src/main/java/org/doorip/user/api/UserApi.java diff --git a/doorip-api/src/main/java/org/doorip/user/api/UserApi.java b/doorip-api/src/main/java/org/doorip/user/api/UserApi.java new file mode 100644 index 0000000..07b2897 --- /dev/null +++ b/doorip-api/src/main/java/org/doorip/user/api/UserApi.java @@ -0,0 +1,364 @@ +package org.doorip.user.api; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.doorip.auth.UserId; +import org.doorip.common.BaseResponse; +import org.doorip.user.dto.request.ResultUpdateRequest; +import org.doorip.user.dto.request.UserReissueRequest; +import org.doorip.user.dto.request.UserSignInRequest; +import org.doorip.user.dto.request.UserSignUpRequest; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; + +import static org.doorip.common.Constants.AUTHORIZATION; + +@Tag(name = "회원 관련 API") +public interface UserApi { + + @Operation( + summary = "스플래쉬 분기 처리 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "요청이 성공했습니다."), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 형식이 올바르지 않습니다. Bearer 타입을 확인해 주세요.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 값이 올바르지 않습니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰이 만료되었습니다. 재발급 받아주세요.", + content = @Content), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 회원입니다.", + content = @Content), + @ApiResponse( + responseCode = "404", + description = "유저의 성향 결과 값을 찾을 수 없습니다.", + content = @Content), + @ApiResponse( + responseCode = "405", + description = "잘못된 HTTP method 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류입니다.", + content = @Content)}) + ResponseEntity> splash(@Parameter(hidden = true) + @UserId final Long userId); + + @Operation( + summary = "로그인 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "요청이 성공했습니다."), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "400", + description = "유효하지 않은 플랫폼 타입입니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "애플 아이덴티티 토큰의 형식이 올바르지 않습니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "애플 아이덴티티 토큰의 값이 올바르지 않습니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "애플 로그인 중 퍼블릭 키 생성에 문제가 발생했습니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "애플 로그인 중 아이덴티티 토큰의 유효 기간이 만료되었습니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "애플 아이덴터티 토큰의 클레임 값이 올바르지 않습니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "카카오 액세스 토큰의 정보를 조회하는 과정에서 오류가 발생하였습니다.", + content = @Content), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 회원입니다.", + content = @Content), + @ApiResponse( + responseCode = "405", + description = "잘못된 HTTP method 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류입니다.", + content = @Content)}) + ResponseEntity> signIn(@RequestHeader(AUTHORIZATION) final String token, + @RequestBody final UserSignInRequest request); + + @Operation( + summary = "회원가입 API", + responses = { + @ApiResponse( + responseCode = "201", + description = "요청이 성공했습니다."), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "400", + description = "유효하지 않은 플랫폼 타입입니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "애플 아이덴티티 토큰의 형식이 올바르지 않습니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "애플 아이덴티티 토큰의 값이 올바르지 않습니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "애플 로그인 중 퍼블릭 키 생성에 문제가 발생했습니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "애플 로그인 중 아이덴티티 토큰의 유효 기간이 만료되었습니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "애플 아이덴터티 토큰의 클레임 값이 올바르지 않습니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "카카오 액세스 토큰의 정보를 조회하는 과정에서 오류가 발생하였습니다.", + content = @Content), + @ApiResponse( + responseCode = "405", + description = "잘못된 HTTP method 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "409", + description = "이미 존재하는 회입니다.", + content = @Content), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류입니다.", + content = @Content)}) + ResponseEntity> signUp(@RequestHeader(AUTHORIZATION) final String token, + @RequestBody final UserSignUpRequest request); + + @Operation( + summary = "로그아웃 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "요청이 성공했습니다."), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 형식이 올바르지 않습니다. Bearer 타입을 확인해 주세요.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 값이 올바르지 않습니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰이 만료되었습니다. 재발급 받아주세요.", + content = @Content), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 회원입니다.", + content = @Content), + @ApiResponse( + responseCode = "405", + description = "잘못된 HTTP method 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류입니다.", + content = @Content)}) + @SecurityRequirement(name = "Authorization") + ResponseEntity> signOut(@Parameter(hidden = true) + @UserId final Long userId); + + @Operation( + summary = "회원 탈퇴 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "요청이 성공했습니다."), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 형식이 올바르지 않습니다. Bearer 타입을 확인해 주세요.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 값이 올바르지 않습니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰이 만료되었습니다. 재발급 받아주세요.", + content = @Content), + @ApiResponse( + responseCode = "405", + description = "잘못된 HTTP method 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류입니다.", + content = @Content)}) + @SecurityRequirement(name = "Authorization") + ResponseEntity> withdraw(@Parameter(hidden = true) + @UserId final Long userId); + + @Operation( + summary = "JWT 재발급 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "요청이 성공했습니다."), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 형식이 올바르지 않습니다. Bearer 타입을 확인해 주세요.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 값이 올바르지 않습니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰이 만료되었습니다. 재발급 받아주세요.", + content = @Content), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 회원입니다.", + content = @Content), + @ApiResponse( + responseCode = "404", + description = "리프레쉬 토큰을 찾을 수 없습니다.", + content = @Content), + @ApiResponse( + responseCode = "405", + description = "잘못된 HTTP method 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류입니다.", + content = @Content)}) + ResponseEntity> reissue(@RequestHeader(AUTHORIZATION) final String refreshtoken, + @RequestBody final UserReissueRequest request); + + @Operation( + summary = "프로필 조회 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "요청이 성공했습니다."), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 형식이 올바르지 않습니다. Bearer 타입을 확인해 주세요.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 값이 올바르지 않습니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰이 만료되었습니다. 재발급 받아주세요.", + content = @Content), + @ApiResponse( + responseCode = "405", + description = "잘못된 HTTP method 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류입니다.", + content = @Content)}) + @SecurityRequirement(name = "Authorization") + ResponseEntity> getProfile(@Parameter(hidden = true) + @UserId final Long userId); + + @Operation( + summary = "프로필 성향 테스트 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "요청이 성공했습니다."), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "400", + description = "유효하지 않은 성향 입력 값입니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 형식이 올바르지 않습니다. Bearer 타입을 확인해 주세요.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 값이 올바르지 않습니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰이 만료되었습니다. 재발급 받아주세요.", + content = @Content), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 회원입니다.", + content = @Content), + @ApiResponse( + responseCode = "404", + description = "대상을 찾을 수 없습니다.", + content = @Content), + @ApiResponse( + responseCode = "405", + description = "잘못된 HTTP method 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류입니다.", + content = @Content)}) + @SecurityRequirement(name = "Authorization") + ResponseEntity> updateResult(@Parameter(hidden = true) + @UserId final Long userId, + @RequestBody final ResultUpdateRequest request); +} From 1a676bb94a5f8454991d22b8f7d070423a4498e9 Mon Sep 17 00:00:00 2001 From: gardening-y <60008786@naver.com> Date: Tue, 16 Jan 2024 07:08:06 +0900 Subject: [PATCH 2/5] =?UTF-8?q?feat:=20=EC=97=AC=ED=96=89=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20API=20Swagger=20=EC=84=A4=EC=A0=95=20(#90)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/doorip/trip/api/TripApi.java | 311 ++++++++++++++++++ 1 file changed, 311 insertions(+) create mode 100644 doorip-api/src/main/java/org/doorip/trip/api/TripApi.java diff --git a/doorip-api/src/main/java/org/doorip/trip/api/TripApi.java b/doorip-api/src/main/java/org/doorip/trip/api/TripApi.java new file mode 100644 index 0000000..9fe42c5 --- /dev/null +++ b/doorip-api/src/main/java/org/doorip/trip/api/TripApi.java @@ -0,0 +1,311 @@ +package org.doorip.trip.api; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.doorip.auth.UserId; +import org.doorip.common.BaseResponse; +import org.doorip.trip.dto.request.TripCreateRequest; +import org.doorip.trip.dto.request.TripEntryRequest; +import org.doorip.trip.dto.request.TripVerifyRequest; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +@Tag(name = "여행 관련 API") +@SecurityRequirement(name = "Authorization") +public interface TripApi { + + @Operation( + summary = "여행 생성 API", + responses = { + @ApiResponse( + responseCode = "201", + description = "요청이 성공했습니다."), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "400", + description = "유효하지 않은 날짜 타입입니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 형식이 올바르지 않습니다. Bearer 타입을 확인해 주세요.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 값이 올바르지 않습니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰이 만료되었습니다. 재발급 받아주세요.", + content = @Content), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 회원입니다.", + content = @Content), + @ApiResponse( + responseCode = "405", + description = "잘못된 HTTP method 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류입니다.", + content = @Content)}) + ResponseEntity> createTrip(@Parameter(hidden = true) + @UserId final Long userId, + @RequestBody final TripCreateRequest request); + + @Operation( + summary = "여행 대시보드 전체 조회 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "요청이 성공했습니다."), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "400", + description = "유효하지 않은 요청 파라미터 값입니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 형식이 올바르지 않습니다. Bearer 타입을 확인해 주세요.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 값이 올바르지 않습니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰이 만료되었습니다. 재발급 받아주세요.", + content = @Content), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 회원입니다.", + content = @Content), + @ApiResponse( + responseCode = "405", + description = "잘못된 HTTP method 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류입니다.", + content = @Content)}) + ResponseEntity> getTrips(@Parameter(hidden = true) + @UserId final Long userId, + @RequestParam final String progress); + + @Operation( + summary = "초대 코드 검증 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "요청이 성공했습니다."), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 형식이 올바르지 않습니다. Bearer 타입을 확인해 주세요.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 값이 올바르지 않습니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰이 만료되었습니다. 재발급 받아주세요.", + content = @Content), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 여행입니다.", + content = @Content), + @ApiResponse( + responseCode = "405", + description = "잘못된 HTTP method 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류입니다.", + content = @Content)}) + ResponseEntity> verifyCode(@RequestBody TripVerifyRequest request); + + @Operation( + summary = "여행 입장 API", + responses = { + @ApiResponse( + responseCode = "201", + description = "요청이 성공했습니다."), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 형식이 올바르지 않습니다. Bearer 타입을 확인해 주세요.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 값이 올바르지 않습니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰이 만료되었습니다. 재발급 받아주세요.", + content = @Content), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 회원입니다.", + content = @Content), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 여행입니다.", + content = @Content), + @ApiResponse( + responseCode = "405", + description = "잘못된 HTTP method 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류입니다.", + content = @Content)}) + ResponseEntity> entryTrip(@PathVariable final Long tripId, + @Parameter(hidden = true) + @UserId final Long userId, + @RequestBody final TripEntryRequest request); + + @Operation( + summary = "여행 My TODO 상세 조회 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "요청이 성공했습니다."), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 형식이 올바르지 않습니다. Bearer 타입을 확인해 주세요.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 값이 올바르지 않습니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰이 만료되었습니다. 재발급 받아주세요.", + content = @Content), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 여행입니다.", + content = @Content), + @ApiResponse( + responseCode = "404", + description = "해당 여행에 참여자로 존재하지 않습니다.", + content = @Content), + @ApiResponse( + responseCode = "405", + description = "잘못된 HTTP method 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류입니다.", + content = @Content)}) + ResponseEntity> getMyTodoDetail(@Parameter(hidden = true) + @UserId final Long userId, + @PathVariable final Long tripId); + + @Operation( + summary = "여행 Our TODO 상세 조회 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "요청이 성공했습니다."), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 형식이 올바르지 않습니다. Bearer 타입을 확인해 주세요.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 값이 올바르지 않습니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰이 만료되었습니다. 재발급 받아주세요.", + content = @Content), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 여행입니다.", + content = @Content), + @ApiResponse( + responseCode = "404", + description = "해당 여행에 참여자로 존재하지 않습니다.", + content = @Content), + @ApiResponse( + responseCode = "405", + description = "잘못된 HTTP method 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류입니다.", + content = @Content)}) + ResponseEntity> getOurTodoDetail(@Parameter(hidden = true) + @UserId final Long userId, + @PathVariable final Long tripId); + + @Operation( + summary = "여행 친구 전체 조회 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "요청이 성공했습니다."), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 형식이 올바르지 않습니다. Bearer 타입을 확인해 주세요.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰의 값이 올바르지 않습니다.", + content = @Content), + @ApiResponse( + responseCode = "401", + description = "액세스 토큰이 만료되었습니다. 재발급 받아주세요.", + content = @Content), + @ApiResponse( + responseCode = "404", + description = "존재하지 않는 여행입니다.", + content = @Content), + @ApiResponse( + responseCode = "404", + description = "해당 여행에 참여자로 존재하지 않습니다.", + content = @Content), + @ApiResponse( + responseCode = "405", + description = "잘못된 HTTP method 요청입니다.", + content = @Content), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류입니다.", + content = @Content)}) + ResponseEntity> getParticipants(@Parameter(hidden = true) + @UserId final Long userId, + @PathVariable final Long tripId); +} From 252d30b95dd0d414b801e65efa416fe9c5751600 Mon Sep 17 00:00:00 2001 From: gardening-y <60008786@naver.com> Date: Tue, 16 Jan 2024 07:08:58 +0900 Subject: [PATCH 3/5] =?UTF-8?q?feat:=20controller=20Swagger=20=EC=97=B0?= =?UTF-8?q?=EA=B2=B0=20(#90)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/doorip/trip/api/TripApiController.java | 9 ++++++++- .../java/org/doorip/user/api/UserApiController.java | 13 ++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/doorip-api/src/main/java/org/doorip/trip/api/TripApiController.java b/doorip-api/src/main/java/org/doorip/trip/api/TripApiController.java index 8e8637d..ff4ba22 100644 --- a/doorip-api/src/main/java/org/doorip/trip/api/TripApiController.java +++ b/doorip-api/src/main/java/org/doorip/trip/api/TripApiController.java @@ -18,10 +18,11 @@ @RequiredArgsConstructor @RequestMapping("/api/trips") @Controller -public class TripApiController { +public class TripApiController implements TripApi { private final TripService tripService; private final TripDetailService tripDetailService; + @Override @PostMapping public ResponseEntity> createTrip(@UserId final Long userId, @RequestBody final TripCreateRequest request) { @@ -29,6 +30,7 @@ public ResponseEntity> createTrip(@UserId final Long userId, return ApiResponseUtil.success(SuccessMessage.CREATED, response); } + @Override @GetMapping public ResponseEntity> getTrips(@UserId final Long userId, @RequestParam final String progress) { @@ -36,12 +38,14 @@ public ResponseEntity> getTrips(@UserId final Long userId, return ApiResponseUtil.success(SuccessMessage.OK, response); } + @Override @PostMapping("/verify") public ResponseEntity> verifyCode(@RequestBody TripVerifyRequest request) { final TripResponse response = tripService.verifyCode(request); return ApiResponseUtil.success(SuccessMessage.OK, response); } + @Override @PostMapping("/{tripId}/entry") public ResponseEntity> entryTrip(@PathVariable final Long tripId, @UserId final Long userId, @@ -50,6 +54,7 @@ public ResponseEntity> entryTrip(@PathVariable final Long tripId return ApiResponseUtil.success(SuccessMessage.CREATED, response); } + @Override @GetMapping("/{tripId}/my") public ResponseEntity> getMyTodoDetail(@UserId final Long userId, @PathVariable final Long tripId) { @@ -57,6 +62,7 @@ public ResponseEntity> getMyTodoDetail(@UserId final Long userId return ApiResponseUtil.success(SuccessMessage.OK, response); } + @Override @GetMapping("/{tripId}/our") public ResponseEntity> getOurTodoDetail(@UserId final Long userId, @PathVariable final Long tripId) { @@ -64,6 +70,7 @@ public ResponseEntity> getOurTodoDetail(@UserId final Long userI return ApiResponseUtil.success(SuccessMessage.OK, response); } + @Override @GetMapping("/{tripId}/participants") public ResponseEntity> getParticipants(@UserId final Long userId, @PathVariable final Long tripId) { diff --git a/doorip-api/src/main/java/org/doorip/user/api/UserApiController.java b/doorip-api/src/main/java/org/doorip/user/api/UserApiController.java index 29347b6..15c6cb9 100644 --- a/doorip-api/src/main/java/org/doorip/user/api/UserApiController.java +++ b/doorip-api/src/main/java/org/doorip/user/api/UserApiController.java @@ -22,15 +22,18 @@ @RequiredArgsConstructor @RequestMapping("/api/users") @Controller -public class UserApiController { +public class UserApiController implements UserApi { private final UserService userService; + @Override @GetMapping("/splash") public ResponseEntity> splash(@UserId final Long userId) { userService.splash(userId); return ApiResponseUtil.success(SuccessMessage.OK); } + @Override + @PostMapping("/signin") public ResponseEntity> signIn(@RequestHeader(AUTHORIZATION) final String token, @RequestBody final UserSignInRequest request) { @@ -38,6 +41,8 @@ public ResponseEntity> signIn(@RequestHeader(AUTHORIZATION) fina return ApiResponseUtil.success(SuccessMessage.OK, response); } + @Override + @PostMapping("/signup") public ResponseEntity> signUp(@RequestHeader(AUTHORIZATION) final String token, @RequestBody final UserSignUpRequest request) { @@ -45,18 +50,22 @@ public ResponseEntity> signUp(@RequestHeader(AUTHORIZATION) fina return ApiResponseUtil.success(SuccessMessage.CREATED, response); } + @Override @PatchMapping("/signout") public ResponseEntity> signOut(@UserId final Long userId) { userService.signOut(userId); return ApiResponseUtil.success(SuccessMessage.OK); } + @Override + @DeleteMapping("/withdraw") public ResponseEntity> withdraw(@UserId final Long userId) { userService.withdraw(userId); return ApiResponseUtil.success(SuccessMessage.OK); } + @Override @PostMapping("/reissue") public ResponseEntity> reissue(@RequestHeader(AUTHORIZATION) final String refreshtoken, @RequestBody final UserReissueRequest request) { @@ -64,12 +73,14 @@ public ResponseEntity> reissue(@RequestHeader(AUTHORIZATION) fin return ApiResponseUtil.success(SuccessMessage.OK, response); } + @Override @GetMapping("/profile") public ResponseEntity> getProfile(@UserId final Long userId) { final ProfileGetResponse response = userService.getProfile(userId); return ApiResponseUtil.success(SuccessMessage.OK, response); } + @Override @PatchMapping("/test") public ResponseEntity> updateResult(@UserId final Long userId, @RequestBody final ResultUpdateRequest request) { From e930225a4c1680857d276313310a22b1587c9994 Mon Sep 17 00:00:00 2001 From: gardening-y <60008786@naver.com> Date: Tue, 16 Jan 2024 21:37:23 +0900 Subject: [PATCH 4/5] =?UTF-8?q?refactor:=20Swagger=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EB=B3=80=EA=B2=BD=20(#90)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/doorip/trip/api/TodoApi.java | 1 + .../java/org/doorip/trip/api/TripApi.java | 2 +- .../doorip/trip/api/TripApiController.java | 16 +++++++++------- .../java/org/doorip/user/api/UserApi.java | 9 ++++----- .../doorip/user/api/UserApiController.java | 19 ++++++++----------- 5 files changed, 23 insertions(+), 24 deletions(-) diff --git a/doorip-api/src/main/java/org/doorip/trip/api/TodoApi.java b/doorip-api/src/main/java/org/doorip/trip/api/TodoApi.java index 0d213df..bdc83cc 100644 --- a/doorip-api/src/main/java/org/doorip/trip/api/TodoApi.java +++ b/doorip-api/src/main/java/org/doorip/trip/api/TodoApi.java @@ -102,6 +102,7 @@ ResponseEntity> getTripTodos(@Parameter(hidden = true) @UserId final Long userId, @PathVariable final Long tripId, @RequestParam final String category, + @Parameter(name = "progress", description = "complete/incomplete") @RequestParam final String progress); @Operation( diff --git a/doorip-api/src/main/java/org/doorip/trip/api/TripApi.java b/doorip-api/src/main/java/org/doorip/trip/api/TripApi.java index 9fe42c5..d354bef 100644 --- a/doorip-api/src/main/java/org/doorip/trip/api/TripApi.java +++ b/doorip-api/src/main/java/org/doorip/trip/api/TripApi.java @@ -19,7 +19,6 @@ @Tag(name = "여행 관련 API") @SecurityRequirement(name = "Authorization") public interface TripApi { - @Operation( summary = "여행 생성 API", responses = { @@ -102,6 +101,7 @@ ResponseEntity> createTrip(@Parameter(hidden = true) content = @Content)}) ResponseEntity> getTrips(@Parameter(hidden = true) @UserId final Long userId, + @Parameter(name = "progress", description = "complete/ incomplete") @RequestParam final String progress); @Operation( diff --git a/doorip-api/src/main/java/org/doorip/trip/api/TripApiController.java b/doorip-api/src/main/java/org/doorip/trip/api/TripApiController.java index ff4ba22..642b0a8 100644 --- a/doorip-api/src/main/java/org/doorip/trip/api/TripApiController.java +++ b/doorip-api/src/main/java/org/doorip/trip/api/TripApiController.java @@ -1,5 +1,6 @@ package org.doorip.trip.api; +import io.swagger.v3.oas.annotations.Parameter; import lombok.RequiredArgsConstructor; import org.doorip.auth.UserId; import org.doorip.common.BaseResponse; @@ -22,31 +23,32 @@ public class TripApiController implements TripApi { private final TripService tripService; private final TripDetailService tripDetailService; - @Override @PostMapping + @Override public ResponseEntity> createTrip(@UserId final Long userId, @RequestBody final TripCreateRequest request) { final TripCreateResponse response = tripService.createTripAndParticipant(userId, request); return ApiResponseUtil.success(SuccessMessage.CREATED, response); } - @Override @GetMapping + @Override public ResponseEntity> getTrips(@UserId final Long userId, + @Parameter(name = "progress", description = "complete/incomplete") @RequestParam final String progress) { final TripGetResponse response = tripService.getTrips(userId, progress); return ApiResponseUtil.success(SuccessMessage.OK, response); } - @Override @PostMapping("/verify") + @Override public ResponseEntity> verifyCode(@RequestBody TripVerifyRequest request) { final TripResponse response = tripService.verifyCode(request); return ApiResponseUtil.success(SuccessMessage.OK, response); } - @Override @PostMapping("/{tripId}/entry") + @Override public ResponseEntity> entryTrip(@PathVariable final Long tripId, @UserId final Long userId, @RequestBody final TripEntryRequest request) { @@ -54,24 +56,24 @@ public ResponseEntity> entryTrip(@PathVariable final Long tripId return ApiResponseUtil.success(SuccessMessage.CREATED, response); } - @Override @GetMapping("/{tripId}/my") + @Override public ResponseEntity> getMyTodoDetail(@UserId final Long userId, @PathVariable final Long tripId) { final MyTodoResponse response = tripDetailService.getMyTodoDetail(userId, tripId); return ApiResponseUtil.success(SuccessMessage.OK, response); } - @Override @GetMapping("/{tripId}/our") + @Override public ResponseEntity> getOurTodoDetail(@UserId final Long userId, @PathVariable final Long tripId) { final OurTodoResponse response = tripDetailService.getOurTodoDetail(userId, tripId); return ApiResponseUtil.success(SuccessMessage.OK, response); } - @Override @GetMapping("/{tripId}/participants") + @Override public ResponseEntity> getParticipants(@UserId final Long userId, @PathVariable final Long tripId) { final TripParticipantGetResponse response = tripDetailService.getParticipants(userId, tripId); diff --git a/doorip-api/src/main/java/org/doorip/user/api/UserApi.java b/doorip-api/src/main/java/org/doorip/user/api/UserApi.java index 07b2897..6b165cd 100644 --- a/doorip-api/src/main/java/org/doorip/user/api/UserApi.java +++ b/doorip-api/src/main/java/org/doorip/user/api/UserApi.java @@ -20,7 +20,6 @@ @Tag(name = "회원 관련 API") public interface UserApi { - @Operation( summary = "스플래쉬 분기 처리 API", responses = { @@ -169,6 +168,7 @@ ResponseEntity> signUp(@RequestHeader(AUTHORIZATION) final Strin @RequestBody final UserSignUpRequest request); @Operation( + security = @SecurityRequirement(name = "Authorization"), summary = "로그아웃 API", responses = { @ApiResponse( @@ -202,11 +202,11 @@ ResponseEntity> signUp(@RequestHeader(AUTHORIZATION) final Strin responseCode = "500", description = "서버 내부 오류입니다.", content = @Content)}) - @SecurityRequirement(name = "Authorization") ResponseEntity> signOut(@Parameter(hidden = true) @UserId final Long userId); @Operation( + security = @SecurityRequirement(name = "Authorization"), summary = "회원 탈퇴 API", responses = { @ApiResponse( @@ -236,7 +236,6 @@ ResponseEntity> signOut(@Parameter(hidden = true) responseCode = "500", description = "서버 내부 오류입니다.", content = @Content)}) - @SecurityRequirement(name = "Authorization") ResponseEntity> withdraw(@Parameter(hidden = true) @UserId final Long userId); @@ -282,6 +281,7 @@ ResponseEntity> reissue(@RequestHeader(AUTHORIZATION) final Stri @RequestBody final UserReissueRequest request); @Operation( + security = @SecurityRequirement(name = "Authorization"), summary = "프로필 조회 API", responses = { @ApiResponse( @@ -311,11 +311,11 @@ ResponseEntity> reissue(@RequestHeader(AUTHORIZATION) final Stri responseCode = "500", description = "서버 내부 오류입니다.", content = @Content)}) - @SecurityRequirement(name = "Authorization") ResponseEntity> getProfile(@Parameter(hidden = true) @UserId final Long userId); @Operation( + security = @SecurityRequirement(name = "Authorization"), summary = "프로필 성향 테스트 API", responses = { @ApiResponse( @@ -357,7 +357,6 @@ ResponseEntity> getProfile(@Parameter(hidden = true) responseCode = "500", description = "서버 내부 오류입니다.", content = @Content)}) - @SecurityRequirement(name = "Authorization") ResponseEntity> updateResult(@Parameter(hidden = true) @UserId final Long userId, @RequestBody final ResultUpdateRequest request); diff --git a/doorip-api/src/main/java/org/doorip/user/api/UserApiController.java b/doorip-api/src/main/java/org/doorip/user/api/UserApiController.java index 15c6cb9..d573ed6 100644 --- a/doorip-api/src/main/java/org/doorip/user/api/UserApiController.java +++ b/doorip-api/src/main/java/org/doorip/user/api/UserApiController.java @@ -25,63 +25,60 @@ public class UserApiController implements UserApi { private final UserService userService; - @Override @GetMapping("/splash") + @Override public ResponseEntity> splash(@UserId final Long userId) { userService.splash(userId); return ApiResponseUtil.success(SuccessMessage.OK); } - @Override - @PostMapping("/signin") + @Override public ResponseEntity> signIn(@RequestHeader(AUTHORIZATION) final String token, @RequestBody final UserSignInRequest request) { final UserSignInResponse response = userService.signIn(token, request); return ApiResponseUtil.success(SuccessMessage.OK, response); } - @Override - @PostMapping("/signup") + @Override public ResponseEntity> signUp(@RequestHeader(AUTHORIZATION) final String token, @RequestBody final UserSignUpRequest request) { final UserSignUpResponse response = userService.signUp(token, request); return ApiResponseUtil.success(SuccessMessage.CREATED, response); } - @Override @PatchMapping("/signout") + @Override public ResponseEntity> signOut(@UserId final Long userId) { userService.signOut(userId); return ApiResponseUtil.success(SuccessMessage.OK); } - @Override - @DeleteMapping("/withdraw") + @Override public ResponseEntity> withdraw(@UserId final Long userId) { userService.withdraw(userId); return ApiResponseUtil.success(SuccessMessage.OK); } - @Override @PostMapping("/reissue") + @Override public ResponseEntity> reissue(@RequestHeader(AUTHORIZATION) final String refreshtoken, @RequestBody final UserReissueRequest request) { final UserSignUpResponse response = userService.reissue(refreshtoken, request); return ApiResponseUtil.success(SuccessMessage.OK, response); } - @Override @GetMapping("/profile") + @Override public ResponseEntity> getProfile(@UserId final Long userId) { final ProfileGetResponse response = userService.getProfile(userId); return ApiResponseUtil.success(SuccessMessage.OK, response); } - @Override @PatchMapping("/test") + @Override public ResponseEntity> updateResult(@UserId final Long userId, @RequestBody final ResultUpdateRequest request) { userService.updateResult(userId, request); From 82c02f6062c720525419b28713ff49568ba09b27 Mon Sep 17 00:00:00 2001 From: gardening-y <60008786@naver.com> Date: Tue, 16 Jan 2024 21:45:23 +0900 Subject: [PATCH 5/5] =?UTF-8?q?del:=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C?= =?UTF-8?q?=20=EC=BD=94=EB=93=9C=20=EB=B3=80=EA=B2=BD=20(#90)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doorip-api/src/main/java/org/doorip/trip/api/TripApi.java | 4 ++-- .../main/java/org/doorip/trip/api/TripApiController.java | 4 +--- doorip-api/src/main/java/org/doorip/user/api/UserApi.java | 6 +++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/doorip-api/src/main/java/org/doorip/trip/api/TripApi.java b/doorip-api/src/main/java/org/doorip/trip/api/TripApi.java index d354bef..ea7465c 100644 --- a/doorip-api/src/main/java/org/doorip/trip/api/TripApi.java +++ b/doorip-api/src/main/java/org/doorip/trip/api/TripApi.java @@ -101,7 +101,7 @@ ResponseEntity> createTrip(@Parameter(hidden = true) content = @Content)}) ResponseEntity> getTrips(@Parameter(hidden = true) @UserId final Long userId, - @Parameter(name = "progress", description = "complete/ incomplete") + @Parameter(name = "progress", description = "complete/incomplete") @RequestParam final String progress); @Operation( @@ -138,7 +138,7 @@ ResponseEntity> getTrips(@Parameter(hidden = true) responseCode = "500", description = "서버 내부 오류입니다.", content = @Content)}) - ResponseEntity> verifyCode(@RequestBody TripVerifyRequest request); + ResponseEntity> verifyCode(@RequestBody final TripVerifyRequest request); @Operation( summary = "여행 입장 API", diff --git a/doorip-api/src/main/java/org/doorip/trip/api/TripApiController.java b/doorip-api/src/main/java/org/doorip/trip/api/TripApiController.java index 642b0a8..5d61f35 100644 --- a/doorip-api/src/main/java/org/doorip/trip/api/TripApiController.java +++ b/doorip-api/src/main/java/org/doorip/trip/api/TripApiController.java @@ -1,6 +1,5 @@ package org.doorip.trip.api; -import io.swagger.v3.oas.annotations.Parameter; import lombok.RequiredArgsConstructor; import org.doorip.auth.UserId; import org.doorip.common.BaseResponse; @@ -34,7 +33,6 @@ public ResponseEntity> createTrip(@UserId final Long userId, @GetMapping @Override public ResponseEntity> getTrips(@UserId final Long userId, - @Parameter(name = "progress", description = "complete/incomplete") @RequestParam final String progress) { final TripGetResponse response = tripService.getTrips(userId, progress); return ApiResponseUtil.success(SuccessMessage.OK, response); @@ -42,7 +40,7 @@ public ResponseEntity> getTrips(@UserId final Long userId, @PostMapping("/verify") @Override - public ResponseEntity> verifyCode(@RequestBody TripVerifyRequest request) { + public ResponseEntity> verifyCode(@RequestBody final TripVerifyRequest request) { final TripResponse response = tripService.verifyCode(request); return ApiResponseUtil.success(SuccessMessage.OK, response); } diff --git a/doorip-api/src/main/java/org/doorip/user/api/UserApi.java b/doorip-api/src/main/java/org/doorip/user/api/UserApi.java index 6b165cd..0125b4b 100644 --- a/doorip-api/src/main/java/org/doorip/user/api/UserApi.java +++ b/doorip-api/src/main/java/org/doorip/user/api/UserApi.java @@ -112,7 +112,7 @@ ResponseEntity> splash(@Parameter(hidden = true) description = "서버 내부 오류입니다.", content = @Content)}) ResponseEntity> signIn(@RequestHeader(AUTHORIZATION) final String token, - @RequestBody final UserSignInRequest request); + @RequestBody final UserSignInRequest request); @Operation( summary = "회원가입 API", @@ -165,7 +165,7 @@ ResponseEntity> signIn(@RequestHeader(AUTHORIZATION) final Strin description = "서버 내부 오류입니다.", content = @Content)}) ResponseEntity> signUp(@RequestHeader(AUTHORIZATION) final String token, - @RequestBody final UserSignUpRequest request); + @RequestBody final UserSignUpRequest request); @Operation( security = @SecurityRequirement(name = "Authorization"), @@ -278,7 +278,7 @@ ResponseEntity> withdraw(@Parameter(hidden = true) description = "서버 내부 오류입니다.", content = @Content)}) ResponseEntity> reissue(@RequestHeader(AUTHORIZATION) final String refreshtoken, - @RequestBody final UserReissueRequest request); + @RequestBody final UserReissueRequest request); @Operation( security = @SecurityRequirement(name = "Authorization"),