-
Notifications
You must be signed in to change notification settings - Fork 0
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 #6 from woorifisa-service-dev-4th/develop
🚀 Merge 'develop' branch into 'main' branch
- Loading branch information
Showing
23 changed files
with
1,227 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package site.haruhana.www.base; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonPropertyOrder; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@JsonPropertyOrder({"isSuccess", "statusCode", "message", "data"}) | ||
@ToString | ||
public class BaseResponse<T> { | ||
|
||
private Boolean isSuccess; | ||
|
||
private int statusCode; | ||
|
||
private String message; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
private T data; | ||
|
||
public static <T> BaseResponse<T> onSuccess(String message, T data) { | ||
return new BaseResponse<>(true, 200, message, data); | ||
} | ||
|
||
public static <T> BaseResponse<T> onCreate(String message, T data) { | ||
return new BaseResponse<>(true, 201, message, data); | ||
} | ||
|
||
public static <T> BaseResponse<T> onBadRequest(String message) { | ||
return new BaseResponse<>(false, 400, message, null); | ||
} | ||
|
||
public static <T> BaseResponse<T> onUnauthorized(String message) { | ||
return new BaseResponse<>(false, 401, message, null); | ||
} | ||
|
||
public static <T> BaseResponse<T> onForbidden(String message) { | ||
return new BaseResponse<>(false, 403, message, null); | ||
} | ||
|
||
public static <T> BaseResponse<T> onNotFound(String message) { | ||
return new BaseResponse<>(false, 404, message, null); | ||
} | ||
|
||
public static <T> BaseResponse<T> onConflict(String message) { | ||
return new BaseResponse<>(false, 409, message, null); | ||
} | ||
|
||
public static <T> BaseResponse<T> onInternalServerError(String message) { | ||
return new BaseResponse<>(false, 500, message, null); | ||
} | ||
|
||
} |
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 site.haruhana.www.base; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import site.haruhana.www.entity.Role; | ||
|
||
import java.util.Date; | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
public class TokenDto { | ||
|
||
private String tokenType; | ||
|
||
private Role role; | ||
|
||
private String accessToken; | ||
|
||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||
private Date accessTokenExpiresAt; | ||
|
||
private String refreshToken; | ||
|
||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||
private Date refreshTokenExpiresAt; | ||
} |
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,30 @@ | ||
package site.haruhana.www.config; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; | ||
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; | ||
import software.amazon.awssdk.regions.Region; | ||
import software.amazon.awssdk.services.s3.S3Client; | ||
|
||
@Configuration | ||
public class S3Config { | ||
|
||
@Value("${aws.s3.access-key}") | ||
private String accessKey; | ||
|
||
@Value("${aws.s3.secret-key}") | ||
private String secretKey; | ||
|
||
@Value("${aws.s3.region}") | ||
private String region; | ||
|
||
@Bean | ||
public S3Client s3Client() { | ||
return S3Client.builder() | ||
.credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create(accessKey, secretKey))) | ||
.region(Region.of(region)) | ||
.build(); | ||
} | ||
} |
Oops, something went wrong.