diff --git a/src/main/java/umc/haruchi/web/controller/MemberApiController.java b/src/main/java/umc/haruchi/web/controller/MemberApiController.java index 15d43dd..11cb934 100644 --- a/src/main/java/umc/haruchi/web/controller/MemberApiController.java +++ b/src/main/java/umc/haruchi/web/controller/MemberApiController.java @@ -3,6 +3,9 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import jakarta.validation.constraints.Email; @@ -29,6 +32,11 @@ public class MemberApiController { @PostMapping("/signup") @Operation(summary = "회원가입 API", description = "이메일 인증으로 회원가입을 진행하는 API (액세스 토큰 필요 없음)") + @ApiResponses({ + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "COMMON200",description = "OK, 성공"), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "MEMBER4005", description = "존재하지 않는 회원입니다.",content = @Content(schema = @Schema(implementation = ApiResponse.class))), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "MONTHBUDGET4001", description = "한 달 예산이 존재하지 않습니다.",content = @Content(schema = @Schema(implementation = ApiResponse.class))), + }) public ApiResponse join(@Valid @RequestBody MemberRequestDTO.MemberJoinDTO request) throws Exception { Member member = memberService.joinMember(request); memberService.connectToDayBudget(member.getId()); @@ -41,6 +49,10 @@ public ApiResponse join(@Valid @RequestBo @Parameter(name = "password", description = "회원가입을 진행할 비밀번호"), @Parameter(name = "checkPassword", description = "확인용 비밀번호") }) + @ApiResponses({ + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "COMMON200",description = "OK, 성공"), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "MEMBER4006", description = "비밀번호가 일치하지 않습니다.",content = @Content(schema = @Schema(implementation = ApiResponse.class))), + }) public ApiResponse verifyPassword(@RequestParam("password") String password, @RequestParam("checkPassword") String verifyPassword) throws Exception { memberService.checkPassword(password, verifyPassword); @@ -52,6 +64,10 @@ public ApiResponse verifyPassword(@RequestParam("password") S @Parameters({ @Parameter(name = "email", description = "인증을 받을 메일 주소") }) + @ApiResponses({ + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "COMMON200",description = "OK, 성공"), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "MEMBER4002",description = "이미 있는 이메일입니다."), + }) public ApiResponse sendEmail(@Email(message = "이메일 형식이 올바르지 않습니다.") @RequestParam("email") String email) throws Exception { memberService.sendSimpleMessage(email); @@ -64,6 +80,10 @@ public ApiResponse sendEmail(@Email(message = "이메일 형 @Parameter(name = "email", description = "인증을 받은 메일 주소"), @Parameter(name = "code", description = "받은 인증 코드") }) + @ApiResponses({ + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "COMMON200",description = "OK, 성공"), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "MEMBER4004",description = "인증 번호가 일치하지 않습니다.") + }) public ApiResponse verifyEmail(@Email(message = "이메일 형식이 올바르지 않습니다.") @RequestParam("email") String email, @RequestParam("code") String code) throws Exception { @@ -82,6 +102,11 @@ public ApiResponse verifyEmail(@Email(message = "이메일 @PostMapping("/login") @Operation(summary = "로그인 API", description = "로그인을 진행하는 API (토큰 방급; 액세스 토큰 필요 없음)") + @ApiResponses({ + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "COMMON200",description = "OK, 성공"), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "MEMBER4005", description = "존재하지 않는 회원입니다.",content = @Content(schema = @Schema(implementation = ApiResponse.class))), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "MEMBER4006", description = "비밀번호가 일치하지 않습니다.",content = @Content(schema = @Schema(implementation = ApiResponse.class))), + }) public ApiResponse login(@Valid @RequestBody MemberRequestDTO.MemberLoginDTO request) { MemberResponseDTO.NewLoginJwtTokenDTO token = memberService.newLogin(request); return ApiResponse.onSuccess(token); @@ -105,6 +130,10 @@ public String loginTest() { @PostMapping("/logout") @Operation(summary = "로그아웃 API", description = "로그아웃을 진행하는 API (토큰 만료 및 블랙리스트화)") + @ApiResponses({ + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "COMMON200",description = "OK, 성공"), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "MEMBER4022",description = "해당 토큰은 유효한 토큰이 아닙니다."), + }) public ApiResponse logout(@RequestHeader("Authorization") String accessToken) { memberService.newLogout(accessToken.substring(7)); return ApiResponse.onSuccess(null); @@ -125,6 +154,11 @@ public ApiResponse logout(@RequestHeader("Authorization") Str @PostMapping("/delete") @Operation(summary = "회원탈퇴 API", description = "회원탈퇴를 진행하는 API (토큰 만료 및 회원 영구 삭제)") + @ApiResponses({ + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "COMMON200",description = "OK, 성공"), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "MEMBER4005", description = "존재하지 않는 회원입니다.",content = @Content(schema = @Schema(implementation = ApiResponse.class))), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "MEMBER4022",description = "해당 토큰은 유효한 토큰이 아닙니다."), + }) public ApiResponse deleteMember(@RequestHeader("Authorization") String accessToken, @RequestParam String reason) { memberService.newWithdrawer(reason,accessToken.substring(7)); @@ -143,6 +177,9 @@ public ApiResponse deleteMember(@RequestHeader("Authorization @GetMapping("/") @Operation(summary = "회원정보조회 API", description = "헤더에 있는 토큰으로 회원을 식별하고, 더보기 화면에서 회원의 정보를 조회하는 API") + @ApiResponses({ + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "COMMON200",description = "OK, 성공"), + }) public ApiResponse getMemberDetail(@AuthenticationPrincipal MemberDetail memberDetail) { String email = memberDetail.getMember().getEmail(); return ApiResponse.onSuccess(memberService.getMemberDetail(email)); @@ -150,6 +187,9 @@ public ApiResponse getMemberDetail(@Aut @GetMapping("/safebox") @Operation(summary = "회원 세이프박스 조회 API", description = "헤더에 있는 토큰으로 회원을 식별하고, 회원의 세이프박스 금액 조회하는 API") + @ApiResponses({ + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "COMMON200",description = "OK, 성공"), + }) public ApiResponse getMemberSafeBox(@AuthenticationPrincipal MemberDetail memberDetail) { Long safeBox = memberDetail.getMember().getSafeBox(); return ApiResponse.onSuccess(MemberConverter.toSafeBoxResultDTO(safeBox));