diff --git a/src/main/java/com/haedal/haedalweb/controller/JoinController.java b/src/main/java/com/haedal/haedalweb/controller/JoinController.java index 458359b..9c816d5 100644 --- a/src/main/java/com/haedal/haedalweb/controller/JoinController.java +++ b/src/main/java/com/haedal/haedalweb/controller/JoinController.java @@ -1,9 +1,16 @@ package com.haedal.haedalweb.controller; +import com.haedal.haedalweb.constants.ErrorCode; import com.haedal.haedalweb.constants.SuccessCode; import com.haedal.haedalweb.dto.JoinDTO; import com.haedal.haedalweb.dto.SuccessResponse; +import com.haedal.haedalweb.swagger.ApiErrorCodeExamples; +import com.haedal.haedalweb.swagger.ApiSuccessCodeExample; +import com.haedal.haedalweb.swagger.ApiSuccessCodeExamples; import com.haedal.haedalweb.util.ResponseUtil; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; @@ -14,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +@Tag(name = "회원가입 관련 API") @RestController @RequestMapping("/join") public class JoinController { @@ -23,6 +31,9 @@ public JoinController(JoinService joinService) { this.joinService = joinService; } + @Operation(summary = "회원가입") + @ApiSuccessCodeExample(SuccessCode.JOIN_SUCCESS) + @ApiErrorCodeExamples({ErrorCode.DUPLICATED_USER_ID, ErrorCode.DUPLICATED_STUDENT_NUMBER, ErrorCode.INVALID_PARAMETER}) @PostMapping public ResponseEntity resisterUser(@RequestBody @Valid JoinDTO joinDTO) { joinService.createUserAccount(joinDTO); @@ -30,6 +41,9 @@ public ResponseEntity resisterUser(@RequestBody @Valid JoinDTO return ResponseUtil.buildSuccessResponseEntity(SuccessCode.JOIN_SUCCESS); } + @Operation(summary = "ID 중복확인") + @Parameter(name = "userId", description = "중복 확인할 ID") + @ApiSuccessCodeExamples({SuccessCode.UNIQUE_USER_ID, SuccessCode.DUPLICATED_USER_ID}) @GetMapping("/check-user-id") public ResponseEntity checkUserIdDuplicate(@RequestParam String userId) { SuccessCode successCode = SuccessCode.UNIQUE_USER_ID; @@ -40,6 +54,9 @@ public ResponseEntity checkUserIdDuplicate(@RequestParam String return ResponseUtil.buildSuccessResponseEntity(successCode); } + @Operation(summary = "학번 중복확인") + @Parameter(name = "studentNumber", description = "중복 확인할 학번") + @ApiSuccessCodeExamples({SuccessCode.UNIQUE_STUDENT_NUMBER, SuccessCode.DUPLICATED_STUDENT_NUMBER}) @GetMapping("/check-student-number") public ResponseEntity checkStudentNumberDuplicate(@RequestParam Integer studentNumber) { SuccessCode successCode = SuccessCode.UNIQUE_STUDENT_NUMBER; diff --git a/src/main/java/com/haedal/haedalweb/controller/LoginController.java b/src/main/java/com/haedal/haedalweb/controller/LoginController.java new file mode 100644 index 0000000..563cefe --- /dev/null +++ b/src/main/java/com/haedal/haedalweb/controller/LoginController.java @@ -0,0 +1,31 @@ +package com.haedal.haedalweb.controller; + +import com.haedal.haedalweb.constants.ErrorCode; +import com.haedal.haedalweb.constants.SuccessCode; +import com.haedal.haedalweb.dto.LoginDTO; +import com.haedal.haedalweb.swagger.ApiErrorCodeExamples; +import com.haedal.haedalweb.swagger.ApiSuccessCodeExample; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +@Tag(name = "로그인 관련 API") +@Controller +public class LoginController { + + @Operation(summary = "로그인 API") + @ApiSuccessCodeExample(SuccessCode.LOGIN_SUCCESS) + @ApiErrorCodeExamples({ErrorCode.INVALID_LOGIN_CONTENTS_TYPE, ErrorCode.FAILED_LOGIN}) + @PostMapping("/login") + public void signIn(@RequestBody LoginDTO loginDTO) { + } + + @Operation(summary = "로그아웃 API") + @ApiSuccessCodeExample(SuccessCode.LOGOUT_SUCCESS) + @ApiErrorCodeExamples({ErrorCode.NULL_REFRESH_TOKEN, ErrorCode.INVALID_REFRESH_TOKEN, ErrorCode.EXPIRED_REFRESH_TOKEN}) + @PostMapping("/logout") + public void signIn() { + } +} diff --git a/src/main/java/com/haedal/haedalweb/controller/ReissueController.java b/src/main/java/com/haedal/haedalweb/controller/ReissueController.java index 8dea9e0..c6684d3 100644 --- a/src/main/java/com/haedal/haedalweb/controller/ReissueController.java +++ b/src/main/java/com/haedal/haedalweb/controller/ReissueController.java @@ -1,8 +1,13 @@ package com.haedal.haedalweb.controller; +import com.haedal.haedalweb.constants.ErrorCode; import com.haedal.haedalweb.constants.SuccessCode; import com.haedal.haedalweb.service.IssueService; +import com.haedal.haedalweb.swagger.ApiErrorCodeExamples; +import com.haedal.haedalweb.swagger.ApiSuccessCodeExample; import com.haedal.haedalweb.util.ResponseUtil; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; @@ -10,11 +15,15 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; +@Tag(name = "토큰 재발급") @RequiredArgsConstructor @RestController public class ReissueController { private final IssueService issueService; + @Operation(summary = "JWT 재발급") + @ApiSuccessCodeExample(SuccessCode.REISSUE_SUCCESS) + @ApiErrorCodeExamples({ErrorCode.NULL_REFRESH_TOKEN, ErrorCode.EXPIRED_REFRESH_TOKEN, ErrorCode.INVALID_REFRESH_TOKEN}) @PostMapping("/reissue") public ResponseEntity reissue(HttpServletRequest request, HttpServletResponse response) { issueService.reissueToken(request, response);