From fc388e9d272007774d0f3792e3af9e8d30ba1694 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=80=EC=9C=A4?= Date: Thu, 7 Aug 2025 11:13:14 +0900 Subject: [PATCH 1/9] =?UTF-8?q?[Feat]=20Swagger=EC=97=90=20Authorization?= =?UTF-8?q?=20=ED=97=A4=EB=8D=94=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/example/studylog/config/SwaggerConfig.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/example/studylog/config/SwaggerConfig.java b/src/main/java/org/example/studylog/config/SwaggerConfig.java index 53509a0..f519571 100644 --- a/src/main/java/org/example/studylog/config/SwaggerConfig.java +++ b/src/main/java/org/example/studylog/config/SwaggerConfig.java @@ -1,5 +1,7 @@ package org.example.studylog.config; +import io.swagger.v3.oas.models.security.SecurityRequirement; +import io.swagger.v3.oas.models.security.SecurityScheme; import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.info.Info; @@ -10,8 +12,15 @@ public class SwaggerConfig { @Bean public OpenAPI openAPI(){ + SecurityScheme securityScheme = new SecurityScheme() + .type(SecurityScheme.Type.HTTP) + .scheme("bearer") + .bearerFormat("JWT"); + SecurityRequirement securityRequirement = new SecurityRequirement().addList("bearerAuth"); + return new OpenAPI() - .components(new Components()) + .components(new Components().addSecuritySchemes("bearerAuth", securityScheme)) + .addSecurityItem(securityRequirement) .info(apiInfo()); } From ae8f92119656bf16354894f76c4e45cc6c377308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=80=EC=9C=A4?= Date: Thu, 7 Aug 2025 11:15:03 +0900 Subject: [PATCH 2/9] =?UTF-8?q?[Docs]=20=20TokenDTO=EC=97=90=20Swagger=20?= =?UTF-8?q?=EC=8A=A4=ED=82=A4=EB=A7=88=20=EC=9D=B4=EB=A6=84=20=EB=AA=85?= =?UTF-8?q?=EC=8B=9C=EB=A5=BC=20=EC=9C=84=ED=95=9C=20@Schema=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/org/example/studylog/dto/oauth/TokenDTO.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/org/example/studylog/dto/oauth/TokenDTO.java b/src/main/java/org/example/studylog/dto/oauth/TokenDTO.java index 9583aae..49ba2c9 100644 --- a/src/main/java/org/example/studylog/dto/oauth/TokenDTO.java +++ b/src/main/java/org/example/studylog/dto/oauth/TokenDTO.java @@ -1,11 +1,14 @@ package org.example.studylog.dto.oauth; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Getter; + @Getter @Builder +@Schema(name = "TokenDTO") public class TokenDTO { private String refreshToken; @@ -15,6 +18,7 @@ public class TokenDTO { @Getter @Builder + @Schema(name = "TokenResponseDTO") public static class ResponseDTO { private String accessToken; private String code; From e3bf6ffa02252a7a05caf3a3aea7e2fe750c974b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=80=EC=9C=A4?= Date: Thu, 7 Aug 2025 11:17:12 +0900 Subject: [PATCH 3/9] =?UTF-8?q?[Docs]=20@Operation=20=EB=B0=8F=20@ApiRepon?= =?UTF-8?q?se=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refresh 토큰을 cookie 파라미터로 명시 200 응답에 대한 TokenDTO.ResponseDTO 스키마 명시 --- .../controller/jwt/AuthController.java | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/example/studylog/controller/jwt/AuthController.java b/src/main/java/org/example/studylog/controller/jwt/AuthController.java index 4747988..91d105f 100644 --- a/src/main/java/org/example/studylog/controller/jwt/AuthController.java +++ b/src/main/java/org/example/studylog/controller/jwt/AuthController.java @@ -1,15 +1,20 @@ package org.example.studylog.controller.jwt; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +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 jakarta.servlet.http.Cookie; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; +import org.example.studylog.dto.ResponseDTO; import org.example.studylog.dto.oauth.TokenDTO; -import org.example.studylog.entity.user.User; import org.example.studylog.jwt.JWTUtil; import org.example.studylog.service.TokenService; import org.example.studylog.util.CookieUtil; import org.example.studylog.util.ResponseUtil; -import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -27,6 +32,25 @@ public AuthController(JWTUtil jwtUtil, TokenService tokenService) { this.tokenService = tokenService; } + @Operation(summary = "AccessToken 재발급 API", + parameters = { + @Parameter( + in = ParameterIn.COOKIE, + name = "refresh", + required = true, + description = "리프레시 토큰" + ) + }) + @ApiResponse( + responseCode = "200", + description = "토큰 재발급 완료", + content = @Content( + mediaType = "application/json", + schema = @Schema( + name = "TokenResponseDTO", + implementation = TokenDTO.ResponseDTO.class + )) + ) @PostMapping("/token-reissue") public ResponseEntity reissue(HttpServletRequest request, HttpServletResponse response){ From f19cbfeb422ca906b7a65ba02b8b5d2a2da631e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=80=EC=9C=A4?= Date: Thu, 7 Aug 2025 14:10:27 +0900 Subject: [PATCH 4/9] =?UTF-8?q?[Docs]=20Swagger=20=EB=AC=B8=EC=84=9C?= =?UTF-8?q?=EC=9A=A9=20@Operation=20=EB=B0=8F=20@ApiResponse=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../studylog/controller/UserController.java | 39 +++++++++++++++---- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/example/studylog/controller/UserController.java b/src/main/java/org/example/studylog/controller/UserController.java index 0a33c33..ab1bc2d 100644 --- a/src/main/java/org/example/studylog/controller/UserController.java +++ b/src/main/java/org/example/studylog/controller/UserController.java @@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j; import org.example.studylog.dto.*; import org.example.studylog.dto.oauth.CustomOAuth2User; +import org.example.studylog.dto.oauth.TokenDTO; import org.example.studylog.service.UserService; import org.example.studylog.util.ResponseUtil; import org.springframework.http.MediaType; @@ -28,18 +29,33 @@ public class UserController { private final UserService userService; - @Operation(summary = "프로필 업데이트 api", description = "프로필 생성을 위한 api") - @PostMapping("/profile") + @Operation(summary = "프로필 생성 api", description = "프로필 생성을 위한 api") + @ApiResponse( + responseCode = "200", + description = "사용자 프로필 생성 완료", + content = @Content( + mediaType = "application/json", + schema = @Schema( + implementation = ProfileResponseDTO.class + ))) + @PostMapping(path = "/profile", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public ResponseEntity createProfile(@Valid @ModelAttribute ProfileCreateRequestDTO request) { // 로그인한 사용자 oauthId 가져오기 Authentication auth = SecurityContextHolder.getContext().getAuthentication(); String oauthId = auth.getName(); + log.info("사용자 프로필 생성 시작: oauthId = {}", oauthId); ProfileResponseDTO dto = userService.createUserProfile(request, oauthId); + log.info("사용자 프로필 생성 완료: profileImage = {}, nickname = {}, intro = {}", + dto.getProfileImage(), dto.getNickname(), dto.getIntro()); return ResponseUtil.buildResponse(200, "사용자 프로필 생성 완료", dto); } @Operation(summary = "프로필 수정 api", description = "프로필 수정을 위한 api") + @ApiResponse(responseCode = "200", description = "사용자 프로필 수정 완료", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ProfileResponseDTO.class))) @PatchMapping(path = "/profile", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public ResponseEntity updateProfile(@ModelAttribute ProfileUpdateRequestDTO request) { // 로그인한 사용자 oauthId 가져오기 @@ -52,8 +68,10 @@ public ResponseEntity updateProfile(@ModelAttribute ProfileUpdateRequestDTO r @Operation(summary = "프로필 조회 api") @GetMapping("/profile") - @ApiResponse(responseCode = "200", description = "성공 시 data 필드는 다음과 같습니다", - content = @Content(schema = @Schema(implementation = ProfileResponseDTO.class))) + @ApiResponse(responseCode = "200", description = "사용자 프로필 조회 성공", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ProfileResponseDTO.class))) public ResponseEntity getProfile() { // 로그인한 사용자 oauthId 가져오기 Authentication auth = SecurityContextHolder.getContext().getAuthentication(); @@ -64,6 +82,10 @@ public ResponseEntity getProfile() { } @Operation(summary = "로그인 유저의 마이페이지 조회 api") + @ApiResponse(responseCode = "200", description = "사용자 정보 조회 성공", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = UserInfoResponseDTO.class))) @GetMapping public ResponseEntity getUserInfo() { // 로그인한 사용자 oauthId 가져오기 @@ -75,9 +97,12 @@ public ResponseEntity getUserInfo() { } @Operation(summary = "배경화면 수정 api") - @PatchMapping("/background") - @ApiResponse(responseCode = "200", description = "성공 시 data 필드는 다음과 같습니다", - content = @Content(schema = @Schema(implementation = BackgroundDTO.ResponseDTO.class))) + @PatchMapping(path = "/background", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) +// @PatchMapping("/background") + @ApiResponse(responseCode = "200", description = "사용자 배경화면 수정 완료", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = BackgroundDTO.ResponseDTO.class))) public ResponseEntity updateBackground( @AuthenticationPrincipal CustomOAuth2User currentUser, @Valid @ModelAttribute BackgroundDTO.RequestDTO dto) { From 5b7ad84e2c5fd348bd5b1c1d3db56a69ba5bc54e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=80=EC=9C=A4?= Date: Thu, 7 Aug 2025 14:14:13 +0900 Subject: [PATCH 5/9] =?UTF-8?q?[Fix]=20=ED=94=84=EB=A1=9C=ED=95=84=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=EA=B2=BD=EB=A1=9C=20=EB=A6=AC=EB=8B=A4?= =?UTF-8?q?=EC=9D=B4=EB=A0=89=ED=8A=B8=20=EB=AC=B8=EC=A0=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/example/studylog/oauth2/ProfileCheckFilter.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/example/studylog/oauth2/ProfileCheckFilter.java b/src/main/java/org/example/studylog/oauth2/ProfileCheckFilter.java index 983d1c0..429b180 100644 --- a/src/main/java/org/example/studylog/oauth2/ProfileCheckFilter.java +++ b/src/main/java/org/example/studylog/oauth2/ProfileCheckFilter.java @@ -4,6 +4,7 @@ import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; +import lombok.extern.slf4j.Slf4j; import org.example.studylog.dto.oauth.CustomOAuth2User; import org.example.studylog.entity.user.User; import org.example.studylog.repository.UserRepository; @@ -14,6 +15,7 @@ import java.io.IOException; +@Slf4j public class ProfileCheckFilter extends OncePerRequestFilter { private final UserRepository userRepository; @@ -38,7 +40,8 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse // /signup, /users/profile의 PUT 요청은 허용, 그 외는 막음 if(!isProfileCompleted && !requestURI.startsWith("/signup")&& - !(requestURI.equals("/users/profile") && method.equalsIgnoreCase("PUT"))) { + !(requestURI.equals("/users/profile") && method.equalsIgnoreCase("POST"))) { + log.info("ProfileCheckFilter로 인해 /signup으로 리다이렉션"); response.sendRedirect("/signup"); return; } From 2a6b19ac1b391f922896c8869936ee54a46688ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=80=EC=9C=A4?= Date: Thu, 7 Aug 2025 14:29:38 +0900 Subject: [PATCH 6/9] =?UTF-8?q?[Docs]=20Swagger=20=EB=AC=B8=EC=84=9C?= =?UTF-8?q?=EC=9A=A9=20@Operation=20=EB=B0=8F=20@ApiResponse=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../studylog/controller/NotificationController.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/org/example/studylog/controller/NotificationController.java b/src/main/java/org/example/studylog/controller/NotificationController.java index fad50e2..b853628 100644 --- a/src/main/java/org/example/studylog/controller/NotificationController.java +++ b/src/main/java/org/example/studylog/controller/NotificationController.java @@ -1,6 +1,12 @@ package org.example.studylog.controller; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; +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 lombok.RequiredArgsConstructor; +import org.example.studylog.dto.ProfileResponseDTO; import org.example.studylog.dto.notification.NotificationListResponseDTO; import org.example.studylog.service.NotificationService; import org.example.studylog.util.ResponseUtil; @@ -20,6 +26,8 @@ public class NotificationController { private final NotificationService notificationService; + @Operation(summary = "SSE 구독") + @ApiResponse(content = @Content(schema = @Schema(implementation = SseEmitter.class))) @GetMapping(value = "/subscribe", produces = MediaType.TEXT_EVENT_STREAM_VALUE) public SseEmitter subscribe() { // 로그인한 사용자 oauthId 가져오기 @@ -29,6 +37,11 @@ public SseEmitter subscribe() { return notificationService.createEmitter(oauthId); } + @Operation(summary = "알림 목록 조회") + @ApiResponse(responseCode = "200", description = "알림 목록 조회 완료", + content = @Content( + mediaType = "application/json", + array = @ArraySchema(schema = @Schema(implementation = NotificationListResponseDTO.class)))) @GetMapping("/notifications") public ResponseEntity getNotificationList() { // 로그인한 사용자 oauthId 가져오기 From d0a5f53e349030d1fe86591836f86912cb7841ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=80=EC=9C=A4?= Date: Thu, 7 Aug 2025 14:56:43 +0900 Subject: [PATCH 7/9] =?UTF-8?q?[Docs]=20Swagger=20=EB=AC=B8=EC=84=9C?= =?UTF-8?q?=EC=9A=A9=20@Operation=20=EB=B0=8F=20@ApiResponse=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../studylog/controller/FriendController.java | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/example/studylog/controller/FriendController.java b/src/main/java/org/example/studylog/controller/FriendController.java index 272131e..77aad7f 100644 --- a/src/main/java/org/example/studylog/controller/FriendController.java +++ b/src/main/java/org/example/studylog/controller/FriendController.java @@ -1,9 +1,14 @@ package org.example.studylog.controller; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; +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 jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.example.studylog.dto.ProfileResponseDTO; import org.example.studylog.dto.friend.FriendNameDTO; import org.example.studylog.dto.friend.FriendRequestDTO; import org.example.studylog.dto.friend.FriendResponseDTO; @@ -24,8 +29,12 @@ public class FriendController { private final FriendService friendService; - @Operation(summary = "code로 친구 조회", description = "친구 추가 시, code로 친구 조회 API") - @GetMapping(params = "code") + @Operation(summary = "code로 친구 조회", description = "친구 추가 시, code로 친구 조회하는 API") + @ApiResponse(responseCode = "200", description = "사용자 이름 조회 완료", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = FriendNameDTO.class))) + @GetMapping("by-code") public ResponseEntity findUserByCode(@RequestParam String code) { // 로그인한 사용자 oauthId 가져오기 Authentication auth = SecurityContextHolder.getContext().getAuthentication(); @@ -36,6 +45,10 @@ public ResponseEntity findUserByCode(@RequestParam String code) { } @Operation(summary = "친구 목록 조회", description = "로그인한 사용자의 친구 목록 조회 API") + @ApiResponse(responseCode = "200", description = "친구 목록 조회 완료", + content = @Content( + mediaType = "application/json", + array = @ArraySchema(schema = @Schema(implementation = FriendResponseDTO.class)))) @GetMapping public ResponseEntity getFriendList(){ // 로그인한 사용자 oauthId 가져오기 @@ -47,6 +60,10 @@ public ResponseEntity getFriendList(){ } @Operation(summary = "친구 검색", description = "친구 목록에서 이름으로 친구 조회 API") + @ApiResponse(responseCode = "200", description = "{query}에 대한 친구 검색 완료", + content = @Content( + mediaType = "application/json", + array = @ArraySchema(schema = @Schema(implementation = FriendResponseDTO.class)))) @GetMapping("/search") public ResponseEntity getFriendByQuery(@RequestParam String query){ // 로그인한 사용자 oauthId 가져오기 @@ -57,7 +74,10 @@ public ResponseEntity getFriendByQuery(@RequestParam String query){ return ResponseUtil.buildResponse(200, String.format("\'%s\'에 대한 친구 검색 완료", query), friends); } - @Operation(summary = "code로 친구 추가", description = "코드로 친구 추가 API") + @Operation(summary = "code로 친구 추가", description = "code로 친구 추가 API") + @ApiResponse(responseCode = "201", description = "친구 추가 완료", + content = @Content( + mediaType = "application/json")) @PostMapping public ResponseEntity addFriend(@RequestBody @Valid FriendRequestDTO request) { // 로그인한 사용자 oauthId 가져오기 @@ -69,6 +89,10 @@ public ResponseEntity addFriend(@RequestBody @Valid FriendRequestDTO request) } @Operation(summary = "친구 삭제", description = "friendId로 친구 삭제 API") + @ApiResponse(responseCode = "200", description = "친구 삭제 완료", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = FriendResponseDTO.class))) @DeleteMapping("/{friendId}") public ResponseEntity deleteFriend(@PathVariable Long friendId){ // 로그인한 사용자 oauthId 가져오기 From f836b1cb5fbd354cd61123338fb6d4c3111f15d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=80=EC=9C=A4?= Date: Thu, 7 Aug 2025 15:05:08 +0900 Subject: [PATCH 8/9] =?UTF-8?q?[Docs]=20@Operation=EC=9D=98=20summary=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/studylog/controller/UserController.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/example/studylog/controller/UserController.java b/src/main/java/org/example/studylog/controller/UserController.java index ab1bc2d..7943d29 100644 --- a/src/main/java/org/example/studylog/controller/UserController.java +++ b/src/main/java/org/example/studylog/controller/UserController.java @@ -29,7 +29,7 @@ public class UserController { private final UserService userService; - @Operation(summary = "프로필 생성 api", description = "프로필 생성을 위한 api") + @Operation(summary = "프로필 생성", description = "프로필 생성을 위한 api") @ApiResponse( responseCode = "200", description = "사용자 프로필 생성 완료", @@ -51,7 +51,7 @@ public ResponseEntity createProfile(@Valid @ModelAttribute ProfileCreateReque return ResponseUtil.buildResponse(200, "사용자 프로필 생성 완료", dto); } - @Operation(summary = "프로필 수정 api", description = "프로필 수정을 위한 api") + @Operation(summary = "프로필 수정", description = "프로필 수정을 위한 api") @ApiResponse(responseCode = "200", description = "사용자 프로필 수정 완료", content = @Content( mediaType = "application/json", @@ -66,7 +66,7 @@ public ResponseEntity updateProfile(@ModelAttribute ProfileUpdateRequestDTO r return ResponseUtil.buildResponse(200, "사용자 프로필 수정 완료", dto); } - @Operation(summary = "프로필 조회 api") + @Operation(summary = "프로필 조회") @GetMapping("/profile") @ApiResponse(responseCode = "200", description = "사용자 프로필 조회 성공", content = @Content( @@ -81,7 +81,7 @@ public ResponseEntity getProfile() { return ResponseUtil.buildResponse(200, "사용자 프로필 조회 성공", dto); } - @Operation(summary = "로그인 유저의 마이페이지 조회 api") + @Operation(summary = "로그인 유저의 마이페이지 조회") @ApiResponse(responseCode = "200", description = "사용자 정보 조회 성공", content = @Content( mediaType = "application/json", @@ -96,9 +96,8 @@ public ResponseEntity getUserInfo() { return ResponseUtil.buildResponse(200, "사용자 정보 조회 성공", dto); } - @Operation(summary = "배경화면 수정 api") + @Operation(summary = "배경화면 수정") @PatchMapping(path = "/background", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) -// @PatchMapping("/background") @ApiResponse(responseCode = "200", description = "사용자 배경화면 수정 완료", content = @Content( mediaType = "application/json", From 3b1c08f4560d898a3367979f4915da6c658f6424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=80=EC=9C=A4?= Date: Fri, 8 Aug 2025 00:32:12 +0900 Subject: [PATCH 9/9] =?UTF-8?q?[Docs]=20Swagger=20=EB=AC=B8=EC=84=9C?= =?UTF-8?q?=EC=9A=A9=20@Operation=20=EB=B0=8F=20@ApiResponse=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../studylog/controller/QuizController.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/example/studylog/controller/QuizController.java b/src/main/java/org/example/studylog/controller/QuizController.java index 6231487..119316f 100644 --- a/src/main/java/org/example/studylog/controller/QuizController.java +++ b/src/main/java/org/example/studylog/controller/QuizController.java @@ -1,9 +1,14 @@ package org.example.studylog.controller; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; +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 jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.example.studylog.dto.BackgroundDTO; import org.example.studylog.dto.oauth.CustomOAuth2User; import org.example.studylog.dto.quiz.CreateQuizRequestDTO; import org.example.studylog.dto.quiz.QuizListResponseDTO; @@ -30,6 +35,10 @@ public class QuizController { private final QuizService quizService; @Operation(summary = "퀴즈 생성", description = "recordId로 친구 생성 API") + @ApiResponse(responseCode = "200", description = "퀴즈 생성 완료", + content = @Content( + mediaType = "application/json", + array = @ArraySchema(schema = @Schema(implementation = QuizResponseDTO.class)))) @PostMapping("/{recordId}") public ResponseEntity createQuiz( @AuthenticationPrincipal CustomOAuth2User currentUser, @@ -55,6 +64,10 @@ public ResponseEntity createQuiz( } @Operation(summary = "퀴즈 상세 조회", description = "quizId로 퀴즈 상세 조회 API") + @ApiResponse(responseCode = "200", description = "퀴즈 상세 조회 완료", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = QuizResponseDTO.class))) @GetMapping("/{quizId}") public ResponseEntity getQuiz(@AuthenticationPrincipal CustomOAuth2User currentUser, @PathVariable Long quizId){ @@ -73,7 +86,11 @@ public ResponseEntity getQuiz(@AuthenticationPrincipal CustomOAuth2User curre } } - @Operation(summary = "퀴즈 상세 조회", description = "quizId로 퀴즈 상세 조회 API") + @Operation(summary = "퀴즈 목록 조회", description = "query, date, categoryId로 퀴즈 상세 조회 API") + @ApiResponse(responseCode = "200", description = "퀴즈 목록 조회 완료", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = QuizListResponseDTO.class))) @GetMapping public ResponseEntity getQuizList( @AuthenticationPrincipal CustomOAuth2User currentUser,