diff --git a/src/main/java/com/example/gtable/global/security/exception/GlobalExceptionHandler.java b/src/main/java/com/example/gtable/global/security/exception/GlobalExceptionHandler.java index fd6269d..8c606f3 100644 --- a/src/main/java/com/example/gtable/global/security/exception/GlobalExceptionHandler.java +++ b/src/main/java/com/example/gtable/global/security/exception/GlobalExceptionHandler.java @@ -19,10 +19,11 @@ import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.multipart.MultipartException; +import io.swagger.v3.oas.annotations.Hidden; import lombok.extern.slf4j.Slf4j; @Slf4j -@Profile("!swagger") // 또는 커스텀 조건 +@Hidden @RestControllerAdvice public class GlobalExceptionHandler { diff --git a/src/main/java/com/example/gtable/store/controller/StoreController.java b/src/main/java/com/example/gtable/store/controller/StoreController.java index 807db2f..0d97bfe 100644 --- a/src/main/java/com/example/gtable/store/controller/StoreController.java +++ b/src/main/java/com/example/gtable/store/controller/StoreController.java @@ -18,9 +18,12 @@ import com.example.gtable.store.dto.StoreUpdateRequest; import com.example.gtable.store.service.StoreService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; - +@Tag(name = "Store API", description = "주점 API") @RestController @RequestMapping("/stores") @RequiredArgsConstructor @@ -29,6 +32,8 @@ public class StoreController { private final StoreService storeService; @PostMapping + @Operation(summary = "주점 등록", description = "관리자의 주점 등록") + @ApiResponse(responseCode = "201", description = "주점 생성/등록") public ResponseEntity createStore(@Valid @RequestBody StoreCreateRequest request) { StoreCreateResponse response = storeService.createStore(request); @@ -42,6 +47,8 @@ public ResponseEntity createStore(@Valid @RequestBody StoreCreateRequest requ } @GetMapping("/all-stores") + @Operation(summary = "모든 주점 리스트 조회", description = "등록된 모든 주점 리스트 조회") + @ApiResponse(responseCode = "200", description = "전체 주점 리스트 조회") public ResponseEntity getAllStores() { return ResponseEntity .status(HttpStatus.OK) @@ -53,6 +60,8 @@ public ResponseEntity getAllStores() { } @GetMapping("/{storeId}") + @Operation(summary = "특정 주점 조회", description = "특정 주점 정보 개별 조회") + @ApiResponse(responseCode = "200", description = "주점 조회") public ResponseEntity getStoreById(@PathVariable Long storeId) { return ResponseEntity .status(HttpStatus.OK) @@ -64,6 +73,8 @@ public ResponseEntity getStoreById(@PathVariable Long storeId) { } @PatchMapping("/{storeId}") + @Operation(summary = "주점 수정", description = "관리자의 주점 정보 수정") + @ApiResponse(responseCode = "200", description = "주점 수정") public ResponseEntity updateStore( @PathVariable Long storeId, @Valid @RequestBody StoreUpdateRequest request @@ -78,6 +89,8 @@ public ResponseEntity updateStore( } @DeleteMapping("/{storeId}") + @Operation(summary = "주점 삭제", description = "관리자의 주점 삭제") + @ApiResponse(responseCode = "200", description = "주점 삭제") public ResponseEntity deleteStore(@PathVariable Long storeId) { return ResponseEntity .ok() @@ -89,6 +102,8 @@ public ResponseEntity deleteStore(@PathVariable Long storeId) { } @GetMapping("/search") + @Operation(summary = "주점 검색", description = "등록된 주점 중 검색") + @ApiResponse(responseCode = "200", description = "주점 검색") public ResponseEntity searchStores(@RequestParam("name") String name) { return ResponseEntity .ok() diff --git a/src/main/java/com/example/gtable/user/controller/UserController.java b/src/main/java/com/example/gtable/user/controller/UserController.java index 111df01..2ad84a9 100644 --- a/src/main/java/com/example/gtable/user/controller/UserController.java +++ b/src/main/java/com/example/gtable/user/controller/UserController.java @@ -17,10 +17,13 @@ import com.example.gtable.user.entity.User; import com.example.gtable.user.service.UserService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; - +@Tag(name = "User API", description = "사용자 API") @RestController @RequestMapping("/api/users") @RequiredArgsConstructor @@ -30,6 +33,8 @@ public class UserController { // 관리자 회원가입 @PostMapping("/signup") + @Operation(summary = "회원가입", description = "관리자 회원가입 / 실제로는 화면 구현X") + @ApiResponse(responseCode = "201", description = "회원가입") public ResponseEntity signup(@RequestBody @Valid ManagerSignupRequestDto managerSignupRequestDto) { return ResponseEntity .status(HttpStatus.CREATED) @@ -42,6 +47,8 @@ public ResponseEntity signup(@RequestBody @Valid ManagerSignupRequestDto mana // 로그인된 유저 정보를 확인하는 api @GetMapping("/me") + @Operation(summary = "내 정보 조회", description = "관리자/사용자 내정보 조회") + @ApiResponse(responseCode = "200", description = "마이페이지에 들어갈 정보") public ResponseEntity getMyInfo(@AuthenticationPrincipal CustomOAuth2User customOAuth2User) { User user = customOAuth2User.getUser(); @@ -53,6 +60,8 @@ public ResponseEntity getMyInfo(@AuthenticationPrincipal Custom } @PostMapping("/login") + @Operation(summary = "관리자 로그인", description = "관리자 로그인") + @ApiResponse(responseCode = "200", description = "관리자 로그인") public ResponseEntity login(@RequestBody @Valid ManagerLoginRequestDto managerLoginRequestDto) { return ResponseEntity .ok()