-
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.
* remove : Test용 패키지 및 컨트롤러 삭제 * style : HomeController 위치 변경 * feat : HealthCheck Controller 제작 * feat : BaseException 및 Exception Enum정의 - BaseException 생성 - Exception Enum정의 - Example용 Error - MethodArgumentError - InternalServerError - DateFormatError정의 - ErrorDetail정의 : Advice에서 반환할 객체 * feat : ExceptionHandlerAdvice 구현 - RestControllerAdvice 구현 - ControllerAdvice 구현 문제점 : 두개가 일단 동일한 작업을 하는 코드여서 추후 기능으로 따로 뺴는 작업 필요 * feat : YML에서 값을 가져오기위한 설정인 EnableConfigurationProperties추가 * feat : footer.html 구현 - Project 명칭, CopyRight,팀원 명칭 기록 - Footer Tag Css를 Style.css 정의 - Config에서 style.css 참조할 수 있도록 수정 * feat : ERD추가 - DBDocs CD 구현 - ERD파일 추가 * docs : ERD, DBDocs관련 내용 README 추가
- Loading branch information
1 parent
1d98057
commit b9d2dcf
Showing
18 changed files
with
368 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: DBDOCS_BUILD | ||
|
||
on: | ||
push: | ||
branches: [ "dev" ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
# DBDocs Install | ||
- name: Install dbdocs | ||
run: sudo npm install -g dbdocs | ||
|
||
#DBDocs Install Check | ||
- name: Check dbdocs | ||
run: dbdocs | ||
|
||
# Runs a set of commands using the runners shell | ||
- name: Update dbdocs project | ||
|
||
env: | ||
DBDOCS_TOKEN: ${{ secrets.DBDOCS_TOKEN }} | ||
run: dbdocs build ./Docs/Picasso.dbml --project=Picasso |
9 changes: 3 additions & 6 deletions
9
...casso/server/api/test/HomeController.java → ...va/picasso/server/api/HomeController.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 |
---|---|---|
@@ -1,18 +1,15 @@ | ||
package picasso.server.api.test; | ||
package picasso.server.api; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
|
||
|
||
@Slf4j | ||
@Controller | ||
public class HomeController { | ||
@GetMapping("/") | ||
public String index() { | ||
return "/index"; | ||
} | ||
|
||
@GetMapping("/layout") | ||
public String layout() { | ||
return "/test_layout"; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
Api/src/main/java/picasso/server/api/config/advice/GlobalControllerExceptionHandler.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,36 @@ | ||
package picasso.server.api.config.advice; | ||
|
||
import jakarta.servlet.http.HttpServletRequest; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.MethodArgumentNotValidException; | ||
import org.springframework.web.bind.annotation.ExceptionHandler; | ||
import org.springframework.web.bind.annotation.RestControllerAdvice; | ||
import picasso.server.common.dto.ErrorDetail; | ||
import picasso.server.common.exception.BaseException; | ||
import picasso.server.common.exception.GlobalException; | ||
|
||
//TODO : 현재 `GlobalRestControllerExceptionHandler`와 동일한 코드, 추후 수정 필요 | ||
@Slf4j | ||
@RequiredArgsConstructor | ||
@RestControllerAdvice | ||
public class GlobalControllerExceptionHandler { | ||
@ExceptionHandler(BaseException.class) | ||
protected ResponseEntity<ErrorDetail> baseExceptionHandle(BaseException e, HttpServletRequest request) { | ||
ErrorDetail errorDetail = e.getErrorCode().getErrorDetail(); | ||
log.warn("ExceptionName >>> {}, ErrorCode >>> {}, ExceptionReason >>> {}", | ||
e.getClass(), errorDetail.getStatusCode(), errorDetail.getReason()); | ||
|
||
return ResponseEntity.status(errorDetail.getStatusCode()).body(errorDetail); | ||
} | ||
|
||
@ExceptionHandler(MethodArgumentNotValidException.class) | ||
protected ResponseEntity<ErrorDetail> argumentNotValidHandle(MethodArgumentNotValidException e, HttpServletRequest request) { | ||
ErrorDetail errorDetail = ErrorDetail.builder() | ||
.statusCode(GlobalException.METHOD_ARGUMENT_ERROR.getStatusCode()) | ||
.reason(GlobalException.METHOD_ARGUMENT_ERROR.getReason()) | ||
.build(); | ||
return ResponseEntity.status(errorDetail.getStatusCode()).body(errorDetail); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
Api/src/main/java/picasso/server/api/config/advice/GlobalRestControllerExceptionHandler.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,36 @@ | ||
package picasso.server.api.config.advice; | ||
|
||
import jakarta.servlet.http.HttpServletRequest; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.MethodArgumentNotValidException; | ||
import org.springframework.web.bind.annotation.ExceptionHandler; | ||
import org.springframework.web.bind.annotation.RestControllerAdvice; | ||
import picasso.server.common.dto.ErrorDetail; | ||
import picasso.server.common.exception.BaseException; | ||
import picasso.server.common.exception.GlobalException; | ||
|
||
//TODO : 현재 `GlobalControllerExceptionHandler`와 동일한 코드, 추후 수정 필요 | ||
@Slf4j | ||
@RequiredArgsConstructor | ||
@RestControllerAdvice | ||
public class GlobalRestControllerExceptionHandler { | ||
@ExceptionHandler(BaseException.class) | ||
protected ResponseEntity<ErrorDetail> baseExceptionHandle(BaseException e, HttpServletRequest request) { | ||
ErrorDetail errorDetail = e.getErrorCode().getErrorDetail(); | ||
log.warn("ExceptionName >>> {}, ErrorCode >>> {}, ExceptionReason >>> {}", | ||
e.getClass(), errorDetail.getStatusCode(), errorDetail.getReason()); | ||
|
||
return ResponseEntity.status(errorDetail.getStatusCode()).body(errorDetail); | ||
} | ||
|
||
@ExceptionHandler(MethodArgumentNotValidException.class) | ||
protected ResponseEntity<ErrorDetail> argumentNotValidHandle(MethodArgumentNotValidException e, HttpServletRequest request) { | ||
ErrorDetail errorDetail = ErrorDetail.builder() | ||
.statusCode(GlobalException.METHOD_ARGUMENT_ERROR.getStatusCode()) | ||
.reason(GlobalException.METHOD_ARGUMENT_ERROR.getReason()) | ||
.build(); | ||
return ResponseEntity.status(errorDetail.getStatusCode()).body(errorDetail); | ||
} | ||
} |
15 changes: 6 additions & 9 deletions
15
...casso/server/api/test/TestController.java → ...i/config/controller/HealthController.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 |
---|---|---|
@@ -1,21 +1,18 @@ | ||
package picasso.server.api.test; | ||
package picasso.server.api.config.controller; | ||
|
||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@Slf4j | ||
@RequestMapping("/test") | ||
@RequiredArgsConstructor | ||
@RestController | ||
public class TestController { | ||
private final TestMessage testMessage; | ||
@RequestMapping("/health") | ||
public class HealthController { | ||
|
||
@GetMapping | ||
public String rtnMsg() { | ||
return testMessage.toString(); | ||
public ResponseEntity healthCheck() { | ||
return ResponseEntity.ok().build(); | ||
} | ||
} |
12 changes: 0 additions & 12 deletions
12
Api/src/main/java/picasso/server/api/test/TestMessage.java
This file was deleted.
Oops, something went wrong.
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 @@ | ||
/* footer */ | ||
footer { | ||
border-top: 1px solid #eee; | ||
padding-top: 12px; | ||
padding-bottom: 10px; | ||
background-color: #bdbdbd; | ||
} | ||
footer .title { | ||
font-weight: 700; | ||
font-size: 16px; | ||
color: #242424; | ||
padding-left: 10px; | ||
margin-bottom: 0; | ||
} | ||
footer .footer-menu { | ||
margin-top: 24px; | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
footer .footer-menu li a { | ||
font-size: 12px; | ||
color: #6f6f6f; | ||
} | ||
footer .copyright { | ||
color: #6f6f6f; | ||
font-size: 10px; | ||
margin-top: 10px; | ||
padding-left: 10px; | ||
} |
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
Empty file.
10 changes: 10 additions & 0 deletions
10
Common/src/main/java/picasso/server/common/config/ConfigurationPropertiesConfig.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,10 @@ | ||
package picasso.server.common.config; | ||
|
||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
@EnableConfigurationProperties({ | ||
}) | ||
public class ConfigurationPropertiesConfig { | ||
} |
21 changes: 21 additions & 0 deletions
21
Common/src/main/java/picasso/server/common/dto/ErrorDetail.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,21 @@ | ||
package picasso.server.common.dto; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
/** | ||
* StatusCode : ControllerAdvice, RestControllerAdvice에서 ResponseEntity의 Status를 찾기 위함. | ||
* Reason : ResponseEntity에서 내용반환에 필요한 컬럼 | ||
*/ | ||
@Getter | ||
@Builder | ||
public class ErrorDetail { | ||
private final Integer statusCode; | ||
private final String reason; | ||
public static ErrorDetail of(Integer statusCode, String reason ) { | ||
return ErrorDetail.builder() | ||
.statusCode(statusCode) | ||
.reason(reason) | ||
.build(); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
Common/src/main/java/picasso/server/common/exception/BaseErrorCode.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,7 @@ | ||
package picasso.server.common.exception; | ||
|
||
import picasso.server.common.dto.ErrorDetail; | ||
|
||
public interface BaseErrorCode { | ||
ErrorDetail getErrorDetail(); | ||
} |
15 changes: 15 additions & 0 deletions
15
Common/src/main/java/picasso/server/common/exception/BaseException.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,15 @@ | ||
package picasso.server.common.exception; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import picasso.server.common.dto.ErrorDetail; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public abstract class BaseException extends RuntimeException { | ||
private BaseErrorCode errorCode; | ||
|
||
public ErrorDetail getErrorDetail() { | ||
return this.errorCode.getErrorDetail(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
Common/src/main/java/picasso/server/common/exception/ExampleException.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 picasso.server.common.exception; | ||
|
||
public class ExampleException extends BaseException { | ||
|
||
public static final BaseException EXCEPTION = new ExampleException(); | ||
|
||
private ExampleException() { | ||
super(GlobalException.EXAMPLE_ERROR); | ||
} | ||
|
||
} | ||
|
26 changes: 26 additions & 0 deletions
26
Common/src/main/java/picasso/server/common/exception/GlobalException.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,26 @@ | ||
package picasso.server.common.exception; | ||
|
||
import static org.springframework.http.HttpStatus.BAD_REQUEST; | ||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import picasso.server.common.dto.ErrorDetail; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public enum GlobalException implements BaseErrorCode { | ||
EXAMPLE_ERROR(BAD_REQUEST.value(), "에러 예시 입니다."), | ||
METHOD_ARGUMENT_ERROR(BAD_REQUEST.value(), "메서드 인자가 유효하지 않거나 @Valid를 통과하지 못하여 발생하는 예외입니다."), | ||
INTERNAL_SERVER_ERRORS(INTERNAL_SERVER_ERROR.value(), "서버 내부 오류입니다."), | ||
DATE_FORMAT_ERROR(BAD_REQUEST.value(), "날짜 형식을 확인해주세요."), | ||
; | ||
|
||
private final Integer statusCode; | ||
private final String reason; | ||
|
||
@Override | ||
public ErrorDetail getErrorDetail() { | ||
return ErrorDetail.of(statusCode, reason); | ||
} | ||
} |
Oops, something went wrong.