-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
78 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
backend/core/src/main/java/site/timecapsulearchive/core/global/common/response/ApiSpec.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package site.timecapsulearchive.core.global.common.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
@Schema(description = "api 공통 응답 ") | ||
public record ApiSpec<T>( | ||
|
||
@Schema(description = "응답 코드") | ||
String code, | ||
|
||
@Schema(description = "응답 메시지") | ||
String message, | ||
|
||
@Schema(description = "응답 데이터") | ||
T result | ||
) { | ||
|
||
public static <T> ApiSpec<T> empty(SuccessCode code) { | ||
return new ApiSpec<>(code.getMessage(), code.getCode(), null); | ||
} | ||
|
||
public static <T> ApiSpec<T> success(SuccessCode code, T result) { | ||
return new ApiSpec<>(code.getCode(), code.getMessage(), result); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...d/core/src/main/java/site/timecapsulearchive/core/global/common/response/SuccessCode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package site.timecapsulearchive.core.global.common.response; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum SuccessCode { | ||
//success handle | ||
SUCCESS("00", "요청 처리에 성공했습니다."); | ||
|
||
private final String code; | ||
private final String message; | ||
} |