-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from Central-MakeUs/dev
docs: 스웨거 명세 보완
- Loading branch information
Showing
23 changed files
with
787 additions
and
264 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
api/src/main/java/com/mm/api/common/swaggerAnnotation/SwaggerResponseAuth.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.mm.api.common.swaggerAnnotation; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
import com.mm.api.exception.ErrorResponse; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
|
||
@Target({ElementType.TYPE}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Operation() | ||
@ApiResponses({ | ||
@ApiResponse(responseCode = "200", description = "성공"), | ||
@ApiResponse(responseCode = "400/0001", description = "잘못된 요청입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "404/0002", description = "존재하지 않는 회원입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "401/0001", description = "리퀘스트 토큰이 만료되었으니 다시 로그인 해주세요.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "401/0002", description = "어세스 토큰이 만료되었으니 재발급 해주세요.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "500", description = "서버 에러 발생", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
}) | ||
public @interface SwaggerResponseAuth { | ||
} |
30 changes: 30 additions & 0 deletions
30
api/src/main/java/com/mm/api/common/swaggerAnnotation/SwaggerResponseBuy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.mm.api.common.swaggerAnnotation; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
import com.mm.api.exception.ErrorResponse; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
|
||
@Target({ElementType.TYPE}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Operation() | ||
@ApiResponses({ | ||
@ApiResponse(responseCode = "200", description = "성공"), | ||
@ApiResponse(responseCode = "400/0001", description = "잘못된 요청입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "404/0001", description = "존재하지 않는 상품입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "404/0002", description = "존재하지 않는 회원입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "404/0003", description = "존재하지 않는 구매인증입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "401/0001", description = "리퀘스트 토큰이 만료되었으니 다시 로그인 해주세요.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "401/0002", description = "어세스 토큰이 만료되었으니 재발급 해주세요.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "500", description = "서버 에러 발생", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
}) | ||
public @interface SwaggerResponseBuy { | ||
} |
31 changes: 31 additions & 0 deletions
31
api/src/main/java/com/mm/api/common/swaggerAnnotation/SwaggerResponseDib.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.mm.api.common.swaggerAnnotation; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
import com.mm.api.exception.ErrorResponse; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
|
||
@Target({ElementType.TYPE}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Operation() | ||
@ApiResponses({ | ||
@ApiResponse(responseCode = "200", description = "성공"), | ||
@ApiResponse(responseCode = "400/0001", description = "잘못된 요청입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "400/0002", description = "이미 찜하기를 했습니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "404/0001", description = "존재하지 않는 상품입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "404/0002", description = "존재하지 않는 회원입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "404/0004", description = "존재하지 않는 찜하기입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "401/0001", description = "리퀘스트 토큰이 만료되었으니 다시 로그인 해주세요.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "401/0002", description = "어세스 토큰이 만료되었으니 재발급 해주세요.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "500", description = "서버 에러 발생"), | ||
}) | ||
public @interface SwaggerResponseDib { | ||
} |
29 changes: 29 additions & 0 deletions
29
api/src/main/java/com/mm/api/common/swaggerAnnotation/SwaggerResponseItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.mm.api.common.swaggerAnnotation; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
import com.mm.api.exception.ErrorResponse; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
|
||
@Target({ElementType.TYPE}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Operation() | ||
@ApiResponses({ | ||
@ApiResponse(responseCode = "200", description = "성공"), | ||
@ApiResponse(responseCode = "400/0001", description = "잘못된 요청입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "404/0001", description = "존재하지 않는 상품입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "404/0002", description = "존재하지 않는 회원입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "401/0001", description = "리퀘스트 토큰이 만료되었으니 다시 로그인 해주세요.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "401/0002", description = "어세스 토큰이 만료되었으니 재발급 해주세요.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "500", description = "서버 에러 발생", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
}) | ||
public @interface SwaggerResponseItem { | ||
} |
28 changes: 28 additions & 0 deletions
28
api/src/main/java/com/mm/api/common/swaggerAnnotation/SwaggerResponseMember.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.mm.api.common.swaggerAnnotation; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
import com.mm.api.exception.ErrorResponse; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
|
||
@Target({ElementType.TYPE}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Operation() | ||
@ApiResponses({ | ||
@ApiResponse(responseCode = "200", description = "성공"), | ||
@ApiResponse(responseCode = "400/0001", description = "잘못된 요청입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "404/0002", description = "존재하지 않는 회원입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "401/0001", description = "리퀘스트 토큰이 만료되었으니 다시 로그인 해주세요.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "401/0002", description = "어세스 토큰이 만료되었으니 재발급 해주세요.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "500", description = "서버 에러 발생", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
}) | ||
public @interface SwaggerResponseMember { | ||
} |
30 changes: 30 additions & 0 deletions
30
api/src/main/java/com/mm/api/common/swaggerAnnotation/SwaggerResponsePoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.mm.api.common.swaggerAnnotation; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
import com.mm.api.exception.ErrorResponse; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
|
||
@Target({ElementType.TYPE}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Operation() | ||
@ApiResponses({ | ||
@ApiResponse(responseCode = "200", description = "성공"), | ||
@ApiResponse(responseCode = "400/0001", description = "잘못된 요청입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "404/0001", description = "존재하지 않는 상품입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "404/0002", description = "존재하지 않는 회원입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "404/0003", description = "존재하지 않는 구매인증입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "401/0001", description = "리퀘스트 토큰이 만료되었으니 다시 로그인 해주세요.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "401/0002", description = "어세스 토큰이 만료되었으니 재발급 해주세요.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "500", description = "서버 에러 발생", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
}) | ||
public @interface SwaggerResponsePoint { | ||
} |
29 changes: 29 additions & 0 deletions
29
api/src/main/java/com/mm/api/common/swaggerAnnotation/SwaggerResponseSearch.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.mm.api.common.swaggerAnnotation; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
import com.mm.api.exception.ErrorResponse; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
|
||
@Target({ElementType.TYPE}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Operation() | ||
@ApiResponses({ | ||
@ApiResponse(responseCode = "200", description = "성공"), | ||
@ApiResponse(responseCode = "400/0001", description = "잘못된 요청입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "404/0001", description = "존재하지 않는 상품입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "404/0002", description = "존재하지 않는 회원입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "401/0001", description = "리퀘스트 토큰이 만료되었으니 다시 로그인 해주세요.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "401/0002", description = "어세스 토큰이 만료되었으니 재발급 해주세요.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "500", description = "서버 에러 발생", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
}) | ||
public @interface SwaggerResponseSearch { | ||
} |
68 changes: 36 additions & 32 deletions
68
api/src/main/java/com/mm/api/domain/auth/controller/AuthController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,53 @@ | ||
package com.mm.api.domain.auth.controller; | ||
|
||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.mm.api.common.response.CommonResponse; | ||
import com.mm.api.common.swaggerAnnotation.SwaggerResponseAuth; | ||
import com.mm.api.domain.auth.dto.request.RefreshTokenRequest; | ||
import com.mm.api.domain.auth.dto.response.TokenResponse; | ||
import com.mm.api.domain.auth.service.AuthService; | ||
import com.mm.api.domain.member.dto.response.MemberInfoResponse; | ||
import com.mm.coresecurity.oauth.OAuth2UserDetails; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@Tag(name = "회원 인증", description = "회원 인증 관련 API 입니다.") | ||
@SwaggerResponseAuth | ||
@RestController | ||
@RequiredArgsConstructor | ||
public class AuthController { | ||
private final AuthService authService; | ||
|
||
@Operation(summary = "(실사용 X, 명세용) 로그인 url: /oauth2/authorization/{provider}", description = "provider는 kakao 혹은 apple, 현재는 kakao만 있음") | ||
@GetMapping("/dummy/login") | ||
public void dummy() { | ||
} | ||
|
||
@Operation(summary = "로그아웃 합니다.") | ||
@PostMapping("/api/v1/auth/logout") | ||
public CommonResponse<?> logout(@RequestBody RefreshTokenRequest request) { | ||
authService.logout(request); | ||
return CommonResponse.noContent(); | ||
} | ||
|
||
@Operation(summary = "로그인된 사용자 정보를 가져옵니다.") | ||
@GetMapping("/api/v1/auth/me") | ||
public CommonResponse<?> getMe(@AuthenticationPrincipal OAuth2UserDetails userDetails) { | ||
MemberInfoResponse response = authService.getMe(userDetails); | ||
return CommonResponse.ok(response); | ||
} | ||
|
||
@Operation(summary = "access token을 갱신합니다.", description = "Bearer 를 붙이지 말아주세요") | ||
@PostMapping("/api/v1/auth/refresh-access-token") | ||
public CommonResponse<?> refreshAccessToken(@RequestBody RefreshTokenRequest request) { | ||
TokenResponse tokenResponse = authService.refreshAccessToken(request); | ||
return CommonResponse.created(tokenResponse); | ||
} | ||
private final AuthService authService; | ||
|
||
@Operation(summary = "(실사용 X, 명세용) 로그인 url: /oauth2/authorization/{provider}", description = "/oauth2/authorization/{provider} , provider는 kakao 혹은 apple, 현재는 kakao만 있음") | ||
@GetMapping("/dummy/login") | ||
public void dummy() { | ||
} | ||
|
||
@Operation(summary = "로그아웃 합니다.") | ||
@PostMapping("/api/v1/auth/logout") | ||
public CommonResponse<?> logout(@RequestBody RefreshTokenRequest request) { | ||
authService.logout(request); | ||
return CommonResponse.noContent(); | ||
} | ||
|
||
@Operation(summary = "로그인된 사용자 정보를 가져옵니다.") | ||
@GetMapping("/api/v1/auth/me") | ||
public CommonResponse<MemberInfoResponse> getMe(@AuthenticationPrincipal OAuth2UserDetails userDetails) { | ||
MemberInfoResponse response = authService.getMe(userDetails); | ||
return CommonResponse.ok(response); | ||
} | ||
|
||
@Operation(summary = "access token을 갱신합니다.", description = "Bearer 를 붙이지 말아주세요") | ||
@PostMapping("/api/v1/auth/refresh-access-token") | ||
public CommonResponse<TokenResponse> refreshAccessToken(@RequestBody RefreshTokenRequest request) { | ||
TokenResponse tokenResponse = authService.refreshAccessToken(request); | ||
return CommonResponse.created(tokenResponse); | ||
} | ||
} |
Oops, something went wrong.