-
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.
- Loading branch information
Showing
24 changed files
with
412 additions
and
32 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 |
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
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"; | ||
} | ||
} |
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.api; | ||
|
||
import jakarta.transaction.Transactional; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import picasso.server.domain.domains.test.Test; | ||
import picasso.server.domain.domains.test.TestRepository; | ||
|
||
import java.util.Optional; | ||
|
||
@Service | ||
@Transactional | ||
@RequiredArgsConstructor | ||
public class TestService { | ||
private final TestRepository testRepository; | ||
|
||
|
||
public Optional<Test> test() { | ||
return testRepository.findById(1L); | ||
} | ||
} |
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.