diff --git a/smeem-api/src/main/java/com/smeem/api/auth/api/AuthApi.java b/smeem-api/src/main/java/com/smeem/api/auth/api/AuthApi.java index 92777064..f556981e 100644 --- a/smeem-api/src/main/java/com/smeem/api/auth/api/AuthApi.java +++ b/smeem-api/src/main/java/com/smeem/api/auth/api/AuthApi.java @@ -1,9 +1,14 @@ package com.smeem.api.auth.api; import com.smeem.api.auth.api.dto.request.SignInRequest; -import com.smeem.api.common.BaseResponse; +import com.smeem.api.auth.api.dto.response.SignInResponse; +import com.smeem.api.auth.api.dto.response.token.TokenResponse; +import com.smeem.api.common.dto.FailureResponse; +import com.smeem.api.common.dto.SuccessResponse; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; +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; import io.swagger.v3.oas.annotations.tags.Tag; @@ -24,39 +29,39 @@ public interface AuthApi { @Parameter(name = "Authorization", description = "Bearer ${Social Platform Access Token}", in = HEADER, required = true) @ApiResponses(value = { @ApiResponse(responseCode = "201", description = "소셜로그인 성공"), - @ApiResponse(responseCode = "4xx", description = "유효하지 않은 요청"), - @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰입니다"), - @ApiResponse(responseCode = "500", description = "서버 내부 오류") + @ApiResponse(responseCode = "4xx", description = "유효하지 않은 요청", content = @Content(schema = @Schema(implementation = FailureResponse.class))), + @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰입니다", content = @Content(schema = @Schema(implementation = FailureResponse.class))), + @ApiResponse(responseCode = "500", description = "서버 내부 오류", content = @Content(schema = @Schema(implementation = FailureResponse.class))) }) - ResponseEntity> signIn(@RequestHeader("Authorization") final String socialAccessToken, @RequestBody SignInRequest request) throws NoSuchAlgorithmException, InvalidKeySpecException; + ResponseEntity> signIn(@RequestHeader("Authorization") final String socialAccessToken, @RequestBody SignInRequest request) throws NoSuchAlgorithmException, InvalidKeySpecException; @Operation(summary = "토큰 재발급 API") @Parameter(name = "Authorization", description = "Bearer ${Smeme Refresh Token}", in = HEADER, required = true) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "토큰 재발급 성공"), - @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰입니다"), - @ApiResponse(responseCode = "500", description = "서버 내부 오류") + @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰입니다", content = @Content(schema = @Schema(implementation = FailureResponse.class))), + @ApiResponse(responseCode = "500", description = "서버 내부 오류", content = @Content(schema = @Schema(implementation = FailureResponse.class))) }) - ResponseEntity> reissueToken(Principal principal); + ResponseEntity> reissueToken(Principal principal); @Operation(summary = "사용자 로그아웃 API") @Parameter(name = "Authorization", description = "Bearer ${Smeme Access Token}", in = HEADER, required = true) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "로그아웃 성공"), - @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰입니다"), - @ApiResponse(responseCode = "500", description = "서버 내부 오류") + @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰입니다", content = @Content(schema = @Schema(implementation = FailureResponse.class))), + @ApiResponse(responseCode = "500", description = "서버 내부 오류", content = @Content(schema = @Schema(implementation = FailureResponse.class))) }) - ResponseEntity> signOut(Principal principal); + ResponseEntity> signOut(Principal principal); @Operation(summary = "회원 탈퇴 API") @Parameter(name = "Authorization", description = "Bearer ${Smeme Access Token}", in = HEADER, required = true) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "회원 탈퇴 성공"), - @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰입니다"), - @ApiResponse(responseCode = "500", description = "서버 내부 오류") + @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰입니다", content = @Content(schema = @Schema(implementation = FailureResponse.class))), + @ApiResponse(responseCode = "500", description = "서버 내부 오류", content = @Content(schema = @Schema(implementation = FailureResponse.class))) }) - ResponseEntity> withDrawl(Principal principal); + ResponseEntity> withDrawl(Principal principal); } diff --git a/smeem-api/src/main/java/com/smeem/api/auth/api/AuthController.java b/smeem-api/src/main/java/com/smeem/api/auth/api/AuthController.java index 3ac1bc4a..ea924e8e 100644 --- a/smeem-api/src/main/java/com/smeem/api/auth/api/AuthController.java +++ b/smeem-api/src/main/java/com/smeem/api/auth/api/AuthController.java @@ -7,7 +7,7 @@ import com.smeem.api.auth.service.TokenService; import com.smeem.api.auth.service.dto.request.SignInServiceRequest; import com.smeem.api.common.ApiResponseUtil; -import com.smeem.api.common.BaseResponse; +import com.smeem.api.common.dto.SuccessResponse; import com.smeem.common.util.Util; import lombok.RequiredArgsConstructor; import lombok.val; @@ -31,29 +31,29 @@ public class AuthController implements AuthApi { @Override @PostMapping - public ResponseEntity> signIn(@RequestHeader("Authorization") final String socialAccessToken, - @RequestBody SignInRequest request) throws NoSuchAlgorithmException, InvalidKeySpecException { + public ResponseEntity> signIn(@RequestHeader("Authorization") final String socialAccessToken, + @RequestBody SignInRequest request) throws NoSuchAlgorithmException, InvalidKeySpecException { val response = SignInResponse.from(authService.signIn(socialAccessToken, SignInServiceRequest.of(request))); return ApiResponseUtil.success(SUCCESS_SIGNIN, response); } @Override @PostMapping("/token") - public ResponseEntity> reissueToken(Principal principal) { + public ResponseEntity> reissueToken(Principal principal) { val response = TokenResponse.from(tokenService.issueToken(Util.getMemberId(principal))); return ApiResponseUtil.success(SUCCESS_ISSUE_TOKEN, response); } @Override @PostMapping("/sign-out") - public ResponseEntity> signOut(Principal principal) { + public ResponseEntity> signOut(Principal principal) { authService.signOut(Util.getMemberId(principal)); return ApiResponseUtil.success(SUCCESS_SIGNOUT); } @Override @DeleteMapping - public ResponseEntity> withDrawl(Principal principal) { + public ResponseEntity> withDrawl(Principal principal) { authService.withdraw(Util.getMemberId(principal)); return ApiResponseUtil.success(SUCCESS_WITHDRAW); } diff --git a/smeem-api/src/main/java/com/smeem/api/auth/jwt/CustomJwtAuthenticationEntryPoint.java b/smeem-api/src/main/java/com/smeem/api/auth/jwt/CustomJwtAuthenticationEntryPoint.java index df4e1499..c84715ea 100644 --- a/smeem-api/src/main/java/com/smeem/api/auth/jwt/CustomJwtAuthenticationEntryPoint.java +++ b/smeem-api/src/main/java/com/smeem/api/auth/jwt/CustomJwtAuthenticationEntryPoint.java @@ -2,7 +2,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.smeem.api.common.ApiResponseUtil; -import com.smeem.api.common.BaseResponse; +import com.smeem.api.common.dto.FailureResponse; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import org.springframework.http.MediaType; @@ -32,7 +32,7 @@ private void setResponse(HttpServletResponse response) throws IOException { response.getWriter().println(objectMapper.writeValueAsString(getFailureResponse())); } - private ResponseEntity> getFailureResponse() { + private ResponseEntity getFailureResponse() { return ApiResponseUtil.failure(INVALID_TOKEN); } } diff --git a/smeem-api/src/main/java/com/smeem/api/badge/api/BadgeApi.java b/smeem-api/src/main/java/com/smeem/api/badge/api/BadgeApi.java index f30aed04..39e72911 100644 --- a/smeem-api/src/main/java/com/smeem/api/badge/api/BadgeApi.java +++ b/smeem-api/src/main/java/com/smeem/api/badge/api/BadgeApi.java @@ -1,8 +1,12 @@ package com.smeem.api.badge.api; -import com.smeem.api.common.BaseResponse; +import com.smeem.api.badge.api.dto.response.BadgeListResponse; +import com.smeem.api.common.dto.FailureResponse; +import com.smeem.api.common.dto.SuccessResponse; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; +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; import io.swagger.v3.oas.annotations.tags.Tag; @@ -20,9 +24,9 @@ public interface BadgeApi { @Parameter(name = "Authorization", description = "Bearer ${Smeme Access Token}", in = HEADER, required = true) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "뱃지 리스트 조회 성공"), - @ApiResponse(responseCode = "4011", description = "유효하지 않은 토큰입니다"), - @ApiResponse(responseCode = "500", description = "서버 내부 오류") + @ApiResponse(responseCode = "4011", description = "유효하지 않은 토큰입니다", content = @Content(schema = @Schema(implementation = FailureResponse.class))), + @ApiResponse(responseCode = "500", description = "서버 내부 오류", content = @Content(schema = @Schema(implementation = FailureResponse.class))) }) - ResponseEntity> getBadges(Principal principal); + ResponseEntity> getBadges(Principal principal); } diff --git a/smeem-api/src/main/java/com/smeem/api/badge/api/BadgeController.java b/smeem-api/src/main/java/com/smeem/api/badge/api/BadgeController.java index d2aa7595..c097dc94 100644 --- a/smeem-api/src/main/java/com/smeem/api/badge/api/BadgeController.java +++ b/smeem-api/src/main/java/com/smeem/api/badge/api/BadgeController.java @@ -3,7 +3,7 @@ import com.smeem.api.badge.api.dto.response.BadgeListResponse; import com.smeem.api.badge.service.BadgeService; import com.smeem.api.common.ApiResponseUtil; -import com.smeem.api.common.BaseResponse; +import com.smeem.api.common.dto.SuccessResponse; import com.smeem.common.util.Util; import lombok.RequiredArgsConstructor; import lombok.val; @@ -25,7 +25,7 @@ public class BadgeController implements BadgeApi { @Override @GetMapping - public ResponseEntity> getBadges(Principal principal) { + public ResponseEntity> getBadges(Principal principal) { val response = BadgeListResponse.from(badgeService.getBadges(Util.getMemberId(principal))); return ApiResponseUtil.success(SUCCESS_GET_BADGES, response); } diff --git a/smeem-api/src/main/java/com/smeem/api/common/ApiResponseUtil.java b/smeem-api/src/main/java/com/smeem/api/common/ApiResponseUtil.java index 86b34e23..a462c3a6 100644 --- a/smeem-api/src/main/java/com/smeem/api/common/ApiResponseUtil.java +++ b/smeem-api/src/main/java/com/smeem/api/common/ApiResponseUtil.java @@ -1,5 +1,7 @@ package com.smeem.api.common; +import com.smeem.api.common.dto.FailureResponse; +import com.smeem.api.common.dto.SuccessResponse; import com.smeem.common.code.failure.FailureCode; import com.smeem.common.code.success.SuccessCode; import org.springframework.http.ResponseEntity; @@ -8,28 +10,28 @@ public interface ApiResponseUtil { - static ResponseEntity> success(SuccessCode code) { + static ResponseEntity> success(SuccessCode code) { return ResponseEntity .status(code.getStatus()) - .body(BaseResponse.of(true, code.getMessage())); + .body(SuccessResponse.of(code.getMessage())); } - static ResponseEntity> success(SuccessCode code, T data) { + static ResponseEntity> success(SuccessCode code, T data) { return ResponseEntity .status(code.getStatus()) - .body(BaseResponse.of(code.getMessage(), data)); + .body(SuccessResponse.of(code.getMessage(), data)); } - static ResponseEntity> success(SuccessCode code, URI uri, T data) { + static ResponseEntity> success(SuccessCode code, URI uri, T data) { return ResponseEntity .status(code.getStatus()) .location(uri) - .body(BaseResponse.of(code.getMessage(), data)); + .body(SuccessResponse.of(code.getMessage(), data)); } - static ResponseEntity> failure(FailureCode code) { + static ResponseEntity failure(FailureCode code) { return ResponseEntity .status(code.getStatus()) - .body(BaseResponse.of(false, code.getMessage())); + .body(FailureResponse.of(code.getMessage())); } } diff --git a/smeem-api/src/main/java/com/smeem/api/common/advicer/ErrorHandler.java b/smeem-api/src/main/java/com/smeem/api/common/advicer/ErrorHandler.java index ca0f1637..f36bbdd9 100644 --- a/smeem-api/src/main/java/com/smeem/api/common/advicer/ErrorHandler.java +++ b/smeem-api/src/main/java/com/smeem/api/common/advicer/ErrorHandler.java @@ -1,7 +1,7 @@ package com.smeem.api.common.advicer; import com.smeem.api.common.ApiResponseUtil; -import com.smeem.api.common.BaseResponse; +import com.smeem.api.common.dto.FailureResponse; import com.smeem.common.exception.*; import com.smeem.external.discord.DiscordAlarmSender; import lombok.RequiredArgsConstructor; @@ -19,57 +19,57 @@ public class ErrorHandler { private final DiscordAlarmSender discordAlarmSender; @ExceptionHandler(TrainingTimeException.class) - public ResponseEntity> trainingTimeException(TrainingTimeException exception) { + public ResponseEntity trainingTimeException(TrainingTimeException exception) { return ApiResponseUtil.failure(exception.getFailureCode()); } @ExceptionHandler(TokenException.class) - public ResponseEntity> tokenException(TokenException exception) { + public ResponseEntity tokenException(TokenException exception) { return ApiResponseUtil.failure(exception.getFailureCode()); } @ExceptionHandler(BadgeException.class) - public ResponseEntity> badgeException(BadgeException exception) { + public ResponseEntity badgeException(BadgeException exception) { return ApiResponseUtil.failure(exception.getFailureCode()); } @ExceptionHandler(DiaryException.class) - public ResponseEntity> diaryException(DiaryException exception) { + public ResponseEntity diaryException(DiaryException exception) { return ApiResponseUtil.failure(exception.getFailureCode()); } @ExceptionHandler(MemberException.class) - public ResponseEntity> memberException(MemberException exception) { + public ResponseEntity memberException(MemberException exception) { return ApiResponseUtil.failure(exception.getFailureCode()); } @ExceptionHandler(GoalException.class) - public ResponseEntity> goalException(GoalException exception) { + public ResponseEntity goalException(GoalException exception) { return ApiResponseUtil.failure(exception.getFailureCode()); } @ExceptionHandler(TopicException.class) - public ResponseEntity> topicException(TopicException exception) { + public ResponseEntity topicException(TopicException exception) { return ApiResponseUtil.failure(exception.getFailureCode()); } @ExceptionHandler(AppleException.class) - public ResponseEntity> appleException(AppleException exception) { + public ResponseEntity appleException(AppleException exception) { return ApiResponseUtil.failure(exception.getFailureCode()); } @ExceptionHandler(FcmException.class) - public ResponseEntity> fcmException(FcmException exception) { + public ResponseEntity fcmException(FcmException exception) { return ApiResponseUtil.failure(exception.getFailureCode()); } @ExceptionHandler(AuthException.class) - public ResponseEntity> authException(AuthException exception) { + public ResponseEntity authException(AuthException exception) { return ApiResponseUtil.failure(exception.getFailureCode()); } @ExceptionHandler(RuntimeException.class) - public ResponseEntity> baseException(RuntimeException exception) { + public ResponseEntity baseException(RuntimeException exception) { sendDiscordAlarm(exception); return ApiResponseUtil.failure(SERVER_ERROR); } diff --git a/smeem-api/src/main/java/com/smeem/api/common/dto/FailureResponse.java b/smeem-api/src/main/java/com/smeem/api/common/dto/FailureResponse.java new file mode 100644 index 00000000..e8168a32 --- /dev/null +++ b/smeem-api/src/main/java/com/smeem/api/common/dto/FailureResponse.java @@ -0,0 +1,19 @@ +package com.smeem.api.common.dto; + +import lombok.Builder; + +import static lombok.AccessLevel.PRIVATE; + +@Builder(access = PRIVATE) +public record FailureResponse( + boolean success, + String message +) { + + public static FailureResponse of(String message) { + return FailureResponse.builder() + .success(false) + .message(message) + .build(); + } +} diff --git a/smeem-api/src/main/java/com/smeem/api/common/BaseResponse.java b/smeem-api/src/main/java/com/smeem/api/common/dto/SuccessResponse.java similarity index 62% rename from smeem-api/src/main/java/com/smeem/api/common/BaseResponse.java rename to smeem-api/src/main/java/com/smeem/api/common/dto/SuccessResponse.java index b72b470f..ee551e2c 100644 --- a/smeem-api/src/main/java/com/smeem/api/common/BaseResponse.java +++ b/smeem-api/src/main/java/com/smeem/api/common/dto/SuccessResponse.java @@ -1,4 +1,4 @@ -package com.smeem.api.common; +package com.smeem.api.common.dto; import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Builder; @@ -7,24 +7,24 @@ import static lombok.AccessLevel.PRIVATE; @Builder(access = PRIVATE) -public record BaseResponse( +public record SuccessResponse( boolean success, String message, @JsonInclude(value = NON_NULL) T data ) { - public static BaseResponse of(String message, T data) { - return BaseResponse.builder() + public static SuccessResponse of(String message, T data) { + return SuccessResponse.builder() .success(true) .message(message) .data(data) .build(); } - public static BaseResponse of(boolean isSuccess, String message) { - return BaseResponse.builder() - .success(isSuccess) + public static SuccessResponse of(String message) { + return SuccessResponse.builder() + .success(true) .message(message) .build(); } diff --git a/smeem-api/src/main/java/com/smeem/api/diary/api/DiaryApi.java b/smeem-api/src/main/java/com/smeem/api/diary/api/DiaryApi.java index c222892d..ecab02e2 100644 --- a/smeem-api/src/main/java/com/smeem/api/diary/api/DiaryApi.java +++ b/smeem-api/src/main/java/com/smeem/api/diary/api/DiaryApi.java @@ -1,10 +1,16 @@ package com.smeem.api.diary.api; -import com.smeem.api.common.BaseResponse; +import com.smeem.api.common.dto.FailureResponse; +import com.smeem.api.common.dto.SuccessResponse; import com.smeem.api.diary.api.dto.request.DiaryCreateRequest; import com.smeem.api.diary.api.dto.request.DiaryModifyRequest; +import com.smeem.api.diary.api.dto.response.DiaryCreateResponse; +import com.smeem.api.diary.api.dto.response.DiaryGetResponse; +import com.smeem.api.diary.api.dto.response.DiaryListGetResponse; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; +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; import io.swagger.v3.oas.annotations.tags.Tag; @@ -24,51 +30,114 @@ public interface DiaryApi { @Parameter(name = "Authorization", description = "Bearer ${Smeem Access Token}", in = HEADER, required = true) @ApiResponses(value = { @ApiResponse(responseCode = "201", description = "성공"), - @ApiResponse(responseCode = "4xx", description = "유효하지 않은 요청"), - @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰"), - @ApiResponse(responseCode = "500", description = "서버 내부 오류") + @ApiResponse( + responseCode = "4xx", + description = "유효하지 않은 요청", + content = @Content(schema = @Schema(implementation = FailureResponse.class)) + ), + @ApiResponse( + responseCode = "401", + description = "유효하지 않은 토큰", + content = @Content(schema = @Schema(implementation = FailureResponse.class)) + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류", + content = @Content(schema = @Schema(implementation = FailureResponse.class)) + ) }) - ResponseEntity> createDiary(Principal principal, @RequestBody DiaryCreateRequest request); + ResponseEntity> createDiary( + Principal principal, + @RequestBody DiaryCreateRequest request + ); @Operation(summary = "일기 상세 조회 API") @Parameter(name = "Authorization", description = "Bearer ${Smeem Access Token}", in = HEADER, required = true) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "성공"), - @ApiResponse(responseCode = "4xx", description = "유효하지 않은 요청"), - @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰"), - @ApiResponse(responseCode = "500", description = "서버 내부 오류") + @ApiResponse(responseCode = "201", description = "성공"), + @ApiResponse( + responseCode = "4xx", + description = "유효하지 않은 요청", + content = @Content(schema = @Schema(implementation = FailureResponse.class)) + ), + @ApiResponse( + responseCode = "401", + description = "유효하지 않은 토큰", + content = @Content(schema = @Schema(implementation = FailureResponse.class)) + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류", + content = @Content(schema = @Schema(implementation = FailureResponse.class)) + ) }) - ResponseEntity> getDiaryDetail(@PathVariable long diaryId); + ResponseEntity> getDiaryDetail(@PathVariable long diaryId); @Operation(summary = "일기 수정 API") @Parameter(name = "Authorization", description = "Bearer ${Smeem Access Token}", in = HEADER, required = true) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "성공"), - @ApiResponse(responseCode = "4xx", description = "유효하지 않은 요청"), - @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰"), - @ApiResponse(responseCode = "500", description = "서버 내부 오류") + @ApiResponse( + responseCode = "4xx", + description = "유효하지 않은 요청", + content = @Content(schema = @Schema(implementation = FailureResponse.class)) + ), + @ApiResponse( + responseCode = "401", + description = "유효하지 않은 토큰", + content = @Content(schema = @Schema(implementation = FailureResponse.class)) + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류", + content = @Content(schema = @Schema(implementation = FailureResponse.class)) + ) }) - ResponseEntity> modifyDiary(@PathVariable long diaryId, @RequestBody DiaryModifyRequest request); + ResponseEntity> modifyDiary(@PathVariable long diaryId, @RequestBody DiaryModifyRequest request); @Operation(summary = "일기 삭제 API") @Parameter(name = "Authorization", description = "Bearer ${Smeem Access Token}", in = HEADER, required = true) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "성공"), - @ApiResponse(responseCode = "4xx", description = "유효하지 않은 요청"), - @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰"), - @ApiResponse(responseCode = "500", description = "서버 내부 오류") + @ApiResponse( + responseCode = "4xx", + description = "유효하지 않은 요청", + content = @Content(schema = @Schema(implementation = FailureResponse.class)) + ), + @ApiResponse( + responseCode = "401", + description = "유효하지 않은 토큰", + content = @Content(schema = @Schema(implementation = FailureResponse.class)) + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류", + content = @Content(schema = @Schema(implementation = FailureResponse.class)) + ) }) - ResponseEntity> deleteDiary(@PathVariable long diaryId); + ResponseEntity> deleteDiary(@PathVariable long diaryId); @Operation(summary = "기간 내 일기 목록 조회 API") @Parameter(name = "Authorization", description = "Bearer ${Smeem Access Token}", in = HEADER, required = true) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "성공"), - @ApiResponse(responseCode = "4xx", description = "유효하지 않은 요청"), - @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰"), - @ApiResponse(responseCode = "500", description = "서버 내부 오류") + @ApiResponse( + responseCode = "4xx", + description = "유효하지 않은 요청", + content = @Content(schema = @Schema(implementation = FailureResponse.class)) + ), + @ApiResponse( + responseCode = "401", + description = "유효하지 않은 토큰", + content = @Content(schema = @Schema(implementation = FailureResponse.class)) + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류", + content = @Content(schema = @Schema(implementation = FailureResponse.class)) + ) }) - ResponseEntity> getDiaries( + ResponseEntity> getDiaries( Principal principal, @RequestParam String start, @RequestParam String end diff --git a/smeem-api/src/main/java/com/smeem/api/diary/api/DiaryApiController.java b/smeem-api/src/main/java/com/smeem/api/diary/api/DiaryApiController.java index 7192fe4c..7a8df23b 100644 --- a/smeem-api/src/main/java/com/smeem/api/diary/api/DiaryApiController.java +++ b/smeem-api/src/main/java/com/smeem/api/diary/api/DiaryApiController.java @@ -3,7 +3,7 @@ import java.security.Principal; import com.smeem.api.common.ApiResponseUtil; -import com.smeem.api.common.BaseResponse; +import com.smeem.api.common.dto.SuccessResponse; import com.smeem.api.diary.api.dto.request.DiaryCreateRequest; import com.smeem.api.diary.api.dto.request.DiaryModifyRequest; import com.smeem.api.diary.api.dto.response.DiaryCreateResponse; @@ -39,7 +39,7 @@ public class DiaryApiController implements DiaryApi { private final DiaryQueryService diaryQueryService; @PostMapping - public ResponseEntity> createDiary(Principal principal, @RequestBody DiaryCreateRequest request) { + public ResponseEntity> createDiary(Principal principal, @RequestBody DiaryCreateRequest request) { val memberId = Util.getMemberId(principal); val response = DiaryCreateResponse.from( diaryCommandService.createDiary(DiaryCreateServiceRequest.of(memberId, request))); @@ -48,26 +48,26 @@ public ResponseEntity> createDiary(Principal principal, @Request } @GetMapping("/{diaryId}") - public ResponseEntity> getDiaryDetail(@PathVariable long diaryId) { + public ResponseEntity> getDiaryDetail(@PathVariable long diaryId) { val response = DiaryGetResponse.from( diaryQueryService.getDiaryDetail(DiaryGetServiceRequest.of(diaryId))); return ApiResponseUtil.success(SUCCESS_GET_DIARY, response); } @PatchMapping("/{diaryId}") - public ResponseEntity> modifyDiary(@PathVariable long diaryId, @RequestBody DiaryModifyRequest request) { + public ResponseEntity> modifyDiary(@PathVariable long diaryId, @RequestBody DiaryModifyRequest request) { diaryCommandService.modifyDiary(DiaryModifyServiceRequest.of(diaryId, request)); return ApiResponseUtil.success(SUCCESS_UPDATE_DAIRY); } @DeleteMapping("/{diaryId}") - public ResponseEntity> deleteDiary(@PathVariable long diaryId) { + public ResponseEntity> deleteDiary(@PathVariable long diaryId) { diaryCommandService.deleteDiary(DiaryDeleteServiceRequest.of(diaryId)); return ApiResponseUtil.success(SUCCESS_DELETE_DIARY); } @GetMapping - public ResponseEntity> getDiaries( + public ResponseEntity> getDiaries( Principal principal, @RequestParam String start, @RequestParam String end diff --git a/smeem-api/src/main/java/com/smeem/api/goal/api/GoalApi.java b/smeem-api/src/main/java/com/smeem/api/goal/api/GoalApi.java index 830965c0..5712b295 100644 --- a/smeem-api/src/main/java/com/smeem/api/goal/api/GoalApi.java +++ b/smeem-api/src/main/java/com/smeem/api/goal/api/GoalApi.java @@ -1,8 +1,13 @@ package com.smeem.api.goal.api; -import com.smeem.api.common.BaseResponse; +import com.smeem.api.common.dto.FailureResponse; +import com.smeem.api.common.dto.SuccessResponse; +import com.smeem.api.goal.api.dto.response.GoalGetResponse; +import com.smeem.api.goal.api.dto.response.GoalListGetResponse; import com.smeem.domain.goal.model.GoalType; 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; import io.swagger.v3.oas.annotations.tags.Tag; @@ -15,16 +20,32 @@ public interface GoalApi { @Operation(summary = "목표 전체 목록 조회 API") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "성공"), - @ApiResponse(responseCode = "4xx", description = "유효하지 않은 요청"), - @ApiResponse(responseCode = "500", description = "서버 내부 오류") + @ApiResponse( + responseCode = "4xx", + description = "유효하지 않은 요청", + content = @Content(schema = @Schema(implementation = FailureResponse.class)) + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류", + content = @Content(schema = @Schema(implementation = FailureResponse.class)) + ) }) - ResponseEntity> getAllGoals(); + ResponseEntity> getAllGoals(); @Operation(summary = "목표 상세 조회 API") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "성공"), - @ApiResponse(responseCode = "4xx", description = "유효하지 않은 요청"), - @ApiResponse(responseCode = "500", description = "서버 내부 오류") + @ApiResponse( + responseCode = "4xx", + description = "유효하지 않은 요청", + content = @Content(schema = @Schema(implementation = FailureResponse.class)) + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류", + content = @Content(schema = @Schema(implementation = FailureResponse.class)) + ) }) - ResponseEntity> getGoalByType(@PathVariable GoalType type); + ResponseEntity> getGoalByType(@PathVariable GoalType type); } diff --git a/smeem-api/src/main/java/com/smeem/api/goal/api/GoalApiController.java b/smeem-api/src/main/java/com/smeem/api/goal/api/GoalApiController.java index 539f7e27..109fbb0c 100644 --- a/smeem-api/src/main/java/com/smeem/api/goal/api/GoalApiController.java +++ b/smeem-api/src/main/java/com/smeem/api/goal/api/GoalApiController.java @@ -1,7 +1,7 @@ package com.smeem.api.goal.api; import com.smeem.api.common.ApiResponseUtil; -import com.smeem.api.common.BaseResponse; +import com.smeem.api.common.dto.SuccessResponse; import com.smeem.api.goal.api.dto.response.GoalGetResponse; import com.smeem.api.goal.api.dto.response.GoalListGetResponse; @@ -28,13 +28,13 @@ public class GoalApiController implements GoalApi { private final GoalService goalService; @GetMapping - public ResponseEntity> getAllGoals() { + public ResponseEntity> getAllGoals() { val response = GoalListGetResponse.from(goalService.getAllGoals()); return ApiResponseUtil.success(SUCCESS_GET_GOALS, response); } @GetMapping("/{type}") - public ResponseEntity> getGoalByType(@PathVariable GoalType type) { + public ResponseEntity> getGoalByType(@PathVariable GoalType type) { val response = GoalGetResponse.from(goalService.getByType(GoalGetServiceRequest.of(type))); return ApiResponseUtil.success(SUCCESS_GET_GOAL, response); } diff --git a/smeem-api/src/main/java/com/smeem/api/member/api/MemberApi.java b/smeem-api/src/main/java/com/smeem/api/member/api/MemberApi.java index 6761ca11..a4a8a8a6 100644 --- a/smeem-api/src/main/java/com/smeem/api/member/api/MemberApi.java +++ b/smeem-api/src/main/java/com/smeem/api/member/api/MemberApi.java @@ -1,12 +1,17 @@ package com.smeem.api.member.api; -import com.smeem.api.common.BaseResponse; +import com.smeem.api.common.dto.FailureResponse; +import com.smeem.api.common.dto.SuccessResponse; import com.smeem.api.member.api.dto.request.MemberPlanUpdateRequest; import com.smeem.api.member.api.dto.request.MemberPushUpdateRequest; import com.smeem.api.member.api.dto.request.MemberUpdateRequest; +import com.smeem.api.member.api.dto.response.MemberGetResponse; +import com.smeem.api.member.api.dto.response.MemberNameResponse; +import com.smeem.api.member.api.dto.response.MemberUpdateResponse; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; 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; import io.swagger.v3.oas.annotations.tags.Tag; @@ -25,47 +30,47 @@ public interface MemberApi { @Parameter(name = "Authorization", description = "Bearer ${Smeme Access Token}", in = HEADER, required = true) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "회원 정보 조회 성공"), - @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰입니다"), - @ApiResponse(responseCode = "4xx", description = "유효하지 않은 요청"), - @ApiResponse(responseCode = "500", description = "서버 오류") + @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰입니다", content = @Content(schema = @Schema(implementation = FailureResponse.class))), + @ApiResponse(responseCode = "4xx", description = "유효하지 않은 요청", content = @Content(schema = @Schema(implementation = FailureResponse.class))), + @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content(schema = @Schema(implementation = FailureResponse.class))) }) - ResponseEntity> updateProfile(Principal principal, @RequestBody MemberUpdateRequest request); + ResponseEntity> updateProfile(Principal principal, @RequestBody MemberUpdateRequest request); @Operation(summary = "사용자 프로필 조회 API") @Parameter(name = "Authorization", description = "Bearer ${Smeme Access Token}", in = HEADER, required = true) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "회원 정보 조회 성공"), - @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰입니다"), - @ApiResponse(responseCode = "500", description = "서버 내부 오류") + @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰입니다", content = @Content(schema = @Schema(implementation = FailureResponse.class))), + @ApiResponse(responseCode = "500", description = "서버 내부 오류", content = @Content(schema = @Schema(implementation = FailureResponse.class))) }) - ResponseEntity> getProfile(Principal principal); + ResponseEntity> getProfile(Principal principal); @Operation(summary = "사용자 학습 계획 수정 API") @Parameter(name = "Authorization", description = "Bearer ${Smeme Access Token}", in = HEADER, required = true) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "회원 학습 계획 업데이트 성공"), @ApiResponse(responseCode = "4xx", description = "유효하지 않은 요청"), - @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰입니다"), - @ApiResponse(responseCode = "500", description = "서버 내부 오류") + @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰입니다", content = @Content(schema = @Schema(implementation = FailureResponse.class))), + @ApiResponse(responseCode = "500", description = "서버 내부 오류", content = @Content(schema = @Schema(implementation = FailureResponse.class))) }) - ResponseEntity> updateUserPlan(Principal principal, @Valid @RequestBody MemberPlanUpdateRequest request); + ResponseEntity> updateUserPlan(Principal principal, @Valid @RequestBody MemberPlanUpdateRequest request); @Operation(summary = "사용자 닉네임 중복체크 수정 API") @Parameter(name = "Authorization", description = "Bearer ${Smeme Access Token}", in = HEADER, required = true) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "닉네임 중복 검사 성공"), - @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰입니다"), - @ApiResponse(responseCode = "500", description = "서버 내부 오류") + @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰입니다", content = @Content(schema = @Schema(implementation = FailureResponse.class))), + @ApiResponse(responseCode = "500", description = "서버 내부 오류", content = @Content(schema = @Schema(implementation = FailureResponse.class))) }) - ResponseEntity> checkDuplicatedName(@Parameter(description = "유저 닉네임") @RequestParam String name); + ResponseEntity> checkDuplicatedName(@Parameter(description = "유저 닉네임") @RequestParam String name); @Operation(summary = "사용자 학습 계획 수정 API") @Parameter(name = "Authorization", description = "Bearer ${Smeme Access Token}", in = HEADER, required = true) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "회원 푸시알람 동의여부 업데이트 성공"), - @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰입니다"), - @ApiResponse(responseCode = "500", description = "서버 내부 오류") + @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰입니다", content = @Content(schema = @Schema(implementation = FailureResponse.class))), + @ApiResponse(responseCode = "500", description = "서버 내부 오류", content = @Content(schema = @Schema(implementation = FailureResponse.class))) }) - ResponseEntity> updateUserPush(Principal principal, @RequestBody MemberPushUpdateRequest request); + ResponseEntity> updateUserPush(Principal principal, @RequestBody MemberPushUpdateRequest request); } diff --git a/smeem-api/src/main/java/com/smeem/api/member/api/MemberController.java b/smeem-api/src/main/java/com/smeem/api/member/api/MemberController.java index f8bc4bf2..78a0b4e7 100644 --- a/smeem-api/src/main/java/com/smeem/api/member/api/MemberController.java +++ b/smeem-api/src/main/java/com/smeem/api/member/api/MemberController.java @@ -1,7 +1,7 @@ package com.smeem.api.member.api; import com.smeem.api.common.ApiResponseUtil; -import com.smeem.api.common.BaseResponse; +import com.smeem.api.common.dto.SuccessResponse; import com.smeem.api.member.api.dto.request.MemberPlanUpdateRequest; import com.smeem.api.member.api.dto.request.MemberPushUpdateRequest; import com.smeem.api.member.api.dto.request.MemberUpdateRequest; @@ -33,7 +33,7 @@ public class MemberController implements MemberApi { @Override @PatchMapping - public ResponseEntity> updateProfile(Principal principal, @RequestBody MemberUpdateRequest request) { + public ResponseEntity> updateProfile(Principal principal, @RequestBody MemberUpdateRequest request) { val response = MemberUpdateResponse.from(memberService.updateUserProfile( Util.getMemberId(principal), MemberServiceUpdateUserProfileRequest.of(request))); @@ -42,28 +42,28 @@ public ResponseEntity> updateProfile(Principal principal, @Reque @Override @GetMapping("/me") - public ResponseEntity> getProfile(Principal principal) { + public ResponseEntity> getProfile(Principal principal) { val response = MemberGetResponse.from(memberService.getMemberProfile(Util.getMemberId(principal))); return ApiResponseUtil.success(SUCCESS_GET_USER, response); } @Override @PatchMapping("/plan") - public ResponseEntity> updateUserPlan(Principal principal, @Valid @RequestBody MemberPlanUpdateRequest request) { + public ResponseEntity> updateUserPlan(Principal principal, @Valid @RequestBody MemberPlanUpdateRequest request) { memberService.updateLearningPlan(Util.getMemberId(principal), MemberUpdatePlanServiceRequest.of(request)); return ApiResponseUtil.success(SUCCESS_UPDATE_USER_PLAN); } @Override @GetMapping("/nickname/check") - public ResponseEntity> checkDuplicatedName(@Parameter(description = "유저 닉네임", required = true) @RequestParam String name) { + public ResponseEntity> checkDuplicatedName(@Parameter(description = "유저 닉네임", required = true) @RequestParam String name) { val response = MemberNameResponse.from(memberService.checkDuplicatedName(name)); return ApiResponseUtil.success(SUCCESS_CHECK_DUPLICATED_NAME, response); } @Override @PatchMapping("/push") - public ResponseEntity> updateUserPush(Principal principal, @RequestBody MemberPushUpdateRequest request) { + public ResponseEntity> updateUserPush(Principal principal, @RequestBody MemberPushUpdateRequest request) { memberService.updateHasAlarm(Util.getMemberId(principal), MemberPushUpdateServiceRequest.of(request)); return ApiResponseUtil.success(SUCCESS_UPDATE_USER_PUSH); } diff --git a/smeem-api/src/main/java/com/smeem/api/test/api/TestApi.java b/smeem-api/src/main/java/com/smeem/api/test/api/TestApi.java index a0af99d1..a9e41cc7 100644 --- a/smeem-api/src/main/java/com/smeem/api/test/api/TestApi.java +++ b/smeem-api/src/main/java/com/smeem/api/test/api/TestApi.java @@ -1,6 +1,6 @@ package com.smeem.api.test.api; -import com.smeem.api.common.BaseResponse; +import com.smeem.api.common.dto.SuccessResponse; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.responses.ApiResponse; @@ -21,7 +21,7 @@ public interface TestApi { @ApiResponse(responseCode = "4xx", description = "유효하지 않은 요청"), @ApiResponse(responseCode = "500", description = "서버 내부 오류") }) - ResponseEntity> test(); + ResponseEntity> test(); @Operation(summary = "푸시알림 테스트 API") @Parameter(name = "Authorization", description = "Bearer ${Smeem Access Token}", in = HEADER, required = true) @@ -31,5 +31,5 @@ public interface TestApi { @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰"), @ApiResponse(responseCode = "500", description = "서버 내부 오류") }) - ResponseEntity> alarmTest(Principal principal); + ResponseEntity> alarmTest(Principal principal); } diff --git a/smeem-api/src/main/java/com/smeem/api/test/api/TestApiController.java b/smeem-api/src/main/java/com/smeem/api/test/api/TestApiController.java index a08c9276..ef269a45 100644 --- a/smeem-api/src/main/java/com/smeem/api/test/api/TestApiController.java +++ b/smeem-api/src/main/java/com/smeem/api/test/api/TestApiController.java @@ -3,7 +3,7 @@ import java.security.Principal; import com.smeem.api.common.ApiResponseUtil; -import com.smeem.api.common.BaseResponse; +import com.smeem.api.common.dto.SuccessResponse; import com.smeem.api.test.service.TestService; import com.smeem.api.test.service.dto.request.TestPushAlarmServiceRequest; import com.smeem.common.util.Util; @@ -26,12 +26,12 @@ public class TestApiController implements TestApi { private final TestService testService; @GetMapping - public ResponseEntity> test() { + public ResponseEntity> test() { return ApiResponseUtil.success(SUCCESS_SERVER_CONNECT); } @GetMapping("/alarm") - public ResponseEntity> alarmTest(Principal principal) { + public ResponseEntity> alarmTest(Principal principal) { val memberId = Util.getMemberId(principal); testService.pushTest(TestPushAlarmServiceRequest.of(memberId)); return ApiResponseUtil.success(SUCCESS_SEND_PUSH_ALARM); diff --git a/smeem-api/src/main/java/com/smeem/api/topic/api/TopicApi.java b/smeem-api/src/main/java/com/smeem/api/topic/api/TopicApi.java index 84351294..063815c3 100644 --- a/smeem-api/src/main/java/com/smeem/api/topic/api/TopicApi.java +++ b/smeem-api/src/main/java/com/smeem/api/topic/api/TopicApi.java @@ -1,8 +1,12 @@ package com.smeem.api.topic.api; -import com.smeem.api.common.BaseResponse; +import com.smeem.api.common.dto.FailureResponse; +import com.smeem.api.common.dto.SuccessResponse; +import com.smeem.api.topic.api.dto.response.RandomTopicGetResponse; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; +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; import io.swagger.v3.oas.annotations.tags.Tag; @@ -17,9 +21,21 @@ public interface TopicApi { @Parameter(name = "Authorization", description = "Bearer ${Smeem Access Token}", in = HEADER, required = true) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "성공"), - @ApiResponse(responseCode = "4xx", description = "유효하지 않은 요청"), - @ApiResponse(responseCode = "401", description = "유효하지 않은 토큰"), - @ApiResponse(responseCode = "500", description = "서버 내부 오류") + @ApiResponse( + responseCode = "4xx", + description = "유효하지 않은 요청", + content = @Content(schema = @Schema(implementation = FailureResponse.class)) + ), + @ApiResponse( + responseCode = "401", + description = "유효하지 않은 토큰", + content = @Content(schema = @Schema(implementation = FailureResponse.class)) + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류", + content = @Content(schema = @Schema(implementation = FailureResponse.class)) + ) }) - ResponseEntity> getTopicByRandom(); + ResponseEntity> getTopicByRandom(); } diff --git a/smeem-api/src/main/java/com/smeem/api/topic/api/TopicApiController.java b/smeem-api/src/main/java/com/smeem/api/topic/api/TopicApiController.java index 9a779a44..a68221fa 100644 --- a/smeem-api/src/main/java/com/smeem/api/topic/api/TopicApiController.java +++ b/smeem-api/src/main/java/com/smeem/api/topic/api/TopicApiController.java @@ -1,7 +1,7 @@ package com.smeem.api.topic.api; import com.smeem.api.common.ApiResponseUtil; -import com.smeem.api.common.BaseResponse; +import com.smeem.api.common.dto.SuccessResponse; import com.smeem.api.topic.api.dto.response.RandomTopicGetResponse; import com.smeem.api.topic.service.TopicService; import lombok.val; @@ -22,7 +22,7 @@ public class TopicApiController implements TopicApi { private final TopicService topicService; @GetMapping("/random") - public ResponseEntity> getTopicByRandom() { + public ResponseEntity> getTopicByRandom() { val response = RandomTopicGetResponse.from(topicService.getTopicByRandom()); return ApiResponseUtil.success(SUCCESS_GET_RANDOM_TOPIC, response); } diff --git a/smeem-api/src/main/java/com/smeem/api/version/api/VersionApi.java b/smeem-api/src/main/java/com/smeem/api/version/api/VersionApi.java index 02199143..ea4bb764 100644 --- a/smeem-api/src/main/java/com/smeem/api/version/api/VersionApi.java +++ b/smeem-api/src/main/java/com/smeem/api/version/api/VersionApi.java @@ -1,7 +1,11 @@ package com.smeem.api.version.api; -import com.smeem.api.common.BaseResponse; +import com.smeem.api.common.dto.FailureResponse; +import com.smeem.api.common.dto.SuccessResponse; +import com.smeem.api.version.api.dto.response.ClientVersionGetResponse; 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; import io.swagger.v3.oas.annotations.tags.Tag; @@ -13,7 +17,11 @@ public interface VersionApi { @Operation(summary = "클라이언트 앱 버전 조회 API") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "성공"), - @ApiResponse(responseCode = "500", description = "서버 내부 오류") + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류", + content = @Content(schema = @Schema(implementation = FailureResponse.class)) + ) }) - ResponseEntity> getClientVersion(); + ResponseEntity> getClientVersion(); } diff --git a/smeem-api/src/main/java/com/smeem/api/version/api/VersionApiController.java b/smeem-api/src/main/java/com/smeem/api/version/api/VersionApiController.java index 112c5f0f..3fafd8cb 100644 --- a/smeem-api/src/main/java/com/smeem/api/version/api/VersionApiController.java +++ b/smeem-api/src/main/java/com/smeem/api/version/api/VersionApiController.java @@ -1,7 +1,7 @@ package com.smeem.api.version.api; import com.smeem.api.common.ApiResponseUtil; -import com.smeem.api.common.BaseResponse; +import com.smeem.api.common.dto.SuccessResponse; import com.smeem.api.version.api.dto.response.ClientVersionGetResponse; import com.smeem.api.version.service.VersionService; import lombok.RequiredArgsConstructor; @@ -21,7 +21,7 @@ public class VersionApiController implements VersionApi { private final VersionService versionService; @GetMapping("/client/app") - public ResponseEntity> getClientVersion() { + public ResponseEntity> getClientVersion() { val response = ClientVersionGetResponse.of(versionService.getClientVersion()); return ApiResponseUtil.success(SUCCESS_GET_APP_VERSION, response); } diff --git a/smeem-api/src/main/resources/application-prod.yml b/smeem-api/src/main/resources/application-prod.yml index ad9cecb5..1814eb1d 100644 --- a/smeem-api/src/main/resources/application-prod.yml +++ b/smeem-api/src/main/resources/application-prod.yml @@ -48,7 +48,7 @@ smeem: title: "업데이트 알림" content: "보다 나아진 스밈의 최신 버전을 준비했어요! 새로운 버전으로 업데이트 후 이용해주세요." ios: - app: 2.0.0 + app: 2.0.1 force: 2.0.0 # 심사 통과 후 3.0.0 업데이트 필요 discord: diff --git a/smeem-api/src/test/java/com/smeem/api/controller/DiaryControllerTest.java b/smeem-api/src/test/java/com/smeem/api/controller/DiaryControllerTest.java index 0be52f44..0e97b40e 100644 --- a/smeem-api/src/test/java/com/smeem/api/controller/DiaryControllerTest.java +++ b/smeem-api/src/test/java/com/smeem/api/controller/DiaryControllerTest.java @@ -3,7 +3,7 @@ //import com.epages.restdocs.apispec.ResourceSnippetParameters; //import com.smeem.api.badge.controller.dto.response.AcquiredBadgeResponse; //import com.smeem.api.common.ApiResponseUtil; -//import com.smeem.api.common.BaseResponse; +//import com.smeem.api.common.dto.BaseResponse; //import com.smeem.api.diary.controller.DiaryController; //import com.smeem.api.diary.api.dto.request.DiaryCreateRequest; //import com.smeem.api.diary.api.dto.request.DiaryModifyRequest;