-
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.
* [refac] move AuthController.java to another package * [refac] move SuccessMessage.java, ErrorMessage.java * [refac] change name of SuccessMessage.java, ErrorMessage.java * [refac] move AuthController.java, AuthService.java * [refac] move dtos related with auth * [refac] move exceptions * [refac] move GlobalExceptionHandler.java * [refac] move ApiResponse.java, BaseResponse.java * [refac] move SuccessCode.java and ErrorCode.java * [refac] move package oauth to external/openfeign * [refac] move JwtAuthenticationEntryPoint.java * [refac] move GlobalExceptionHandler.java * [refac] move SuccessCode.java, ErrorCode.java * [refac] move ApiResponse.java, BaseResponse.java
- Loading branch information
Showing
45 changed files
with
242 additions
and
242 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
src/main/java/org/hankki/hankkiserver/api/advice/GlobalExceptionHandler.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,4 @@ | ||
package org.hankki.hankkiserver.api.advice; | ||
|
||
public class GlobalExceptionHandler { | ||
} |
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
2 changes: 1 addition & 1 deletion
2
...service/dto/request/UserLoginRequest.java → .../controller/request/UserLoginRequest.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
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
2 changes: 1 addition & 1 deletion
2
...rvice/dto/response/UserLoginResponse.java → ...h/service/response/UserLoginResponse.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
2 changes: 1 addition & 1 deletion
2
...ice/dto/response/UserReissueResponse.java → ...service/response/UserReissueResponse.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
23 changes: 23 additions & 0 deletions
23
src/main/java/org/hankki/hankkiserver/api/dto/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,23 @@ | ||
package org.hankki.hankkiserver.api.dto; | ||
|
||
import org.hankki.hankkiserver.common.code.ErrorCode; | ||
import org.hankki.hankkiserver.common.code.SuccessCode; | ||
import org.springframework.http.ResponseEntity; | ||
|
||
public interface ApiResponse { | ||
|
||
static ResponseEntity<BaseResponse<?>> success(SuccessCode successCode) { | ||
return ResponseEntity.status(successCode.getHttpStatus()) | ||
.body(BaseResponse.of(successCode)); | ||
} | ||
|
||
static <T> ResponseEntity<BaseResponse<?>> success(SuccessCode successCode, T data) { | ||
return org.springframework.http.ResponseEntity.status(successCode.getHttpStatus()) | ||
.body(BaseResponse.of(successCode, data)); | ||
} | ||
|
||
static ResponseEntity<BaseResponse<?>> failure(ErrorCode errorCode) { | ||
return ResponseEntity.status(errorCode.getHttpStatus()) | ||
.body(BaseResponse.of(errorCode)); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/org/hankki/hankkiserver/api/dto/BaseResponse.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,42 @@ | ||
package org.hankki.hankkiserver.api.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import org.hankki.hankkiserver.common.code.ErrorCode; | ||
import org.hankki.hankkiserver.common.code.SuccessCode; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder(access = AccessLevel.PRIVATE) | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class BaseResponse<T> { | ||
|
||
private final int status; | ||
private final String message; | ||
@JsonInclude(value = JsonInclude.Include.NON_NULL) | ||
private final T data; | ||
|
||
public static BaseResponse<?> of(SuccessCode successCode) { | ||
return builder() | ||
.status(successCode.getHttpStatus().value()) | ||
.message(successCode.getMessage()) | ||
.build(); | ||
} | ||
|
||
public static <T> BaseResponse<?> of(SuccessCode successCode, T data) { | ||
return builder() | ||
.status(successCode.getHttpStatus().value()) | ||
.message(successCode.getMessage()) | ||
.data(data) | ||
.build(); | ||
} | ||
|
||
public static BaseResponse<?> of(ErrorCode errorCode) { | ||
return builder() | ||
.status(errorCode.getHttpStatus().value()) | ||
.message(errorCode.getMessage()) | ||
.build(); | ||
} | ||
} |
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.