-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from kakao-tech-campus-2nd-step3/develop
Develop - Master 병합
- Loading branch information
Showing
24 changed files
with
316 additions
and
148 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/main/java/com/helpmeCookies/global/ApiResponse/ApiResponse.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,29 @@ | ||
package com.helpmeCookies.global.ApiResponse; | ||
|
||
import jakarta.annotation.Nullable; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@RequiredArgsConstructor | ||
public class ApiResponse<T> { | ||
|
||
private final int code; | ||
private final String message; | ||
private T data; | ||
|
||
public static<T> ApiResponse<T> success(SuccessCode successCode, T data) { | ||
return new ApiResponse<T>(successCode.getCode(), successCode.getMessage(),data); | ||
} | ||
|
||
public static ApiResponse<Void> success(SuccessCode successCode) { | ||
return new ApiResponse<>(successCode.getCode(), successCode.getMessage(),null); | ||
} | ||
|
||
public static ApiResponse<Void> error(HttpStatus errorCode, String message) { | ||
return new ApiResponse<>(errorCode.value(), message,null); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/helpmeCookies/global/ApiResponse/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,16 @@ | ||
package com.helpmeCookies.global.ApiResponse; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import org.springframework.http.HttpStatus; | ||
|
||
@AllArgsConstructor | ||
@Getter | ||
public enum SuccessCode { | ||
OK(200, "OK"), | ||
CREATED_SUCCESS(201, "저장에 성공했습니다"); | ||
|
||
private final int code; | ||
private final String message; | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/helpmeCookies/global/config/ProPertyConfig.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,12 @@ | ||
package com.helpmeCookies.global.config; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationPropertiesScan; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import com.helpmeCookies.global.jwt.JwtProperties; | ||
|
||
@Configuration | ||
@EnableConfigurationProperties(JwtProperties.class) | ||
public class ProPertyConfig { | ||
} |
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
20 changes: 20 additions & 0 deletions
20
src/main/java/com/helpmeCookies/global/jwt/JwtProperties.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,20 @@ | ||
package com.helpmeCookies.global.jwt; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.stereotype.Component; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Component | ||
@ConfigurationProperties(prefix = "jwt") | ||
@Getter | ||
@Setter | ||
public class JwtProperties { | ||
private String secret; | ||
private long accessTokenExpireTime; | ||
private long refreshTokenExpireTime; | ||
|
||
public JwtProperties() { | ||
} | ||
} |
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
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
Oops, something went wrong.