-
Notifications
You must be signed in to change notification settings - Fork 170
[4기 - 김희빈] SpringBoot Part3 Weekly Mission PR 제출합니다. #834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kmebin
wants to merge
23
commits into
prgrms-be-devcourse:kmebin
Choose a base branch
from
kmebin:week3
base: kmebin
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
824a8b0
Merge branch 'week2' into main
kmebin 99257f3
chore: thymeleaf, lombok 의존성 추가
kmebin 563525c
feat: 바우처 프로그램 메인 뷰 구현
kmebin 08b1903
feat: 바우처 전체 조회, 생성, 삭제 뷰 구현
kmebin 2afdbd3
feat: 바우처 전체 조회, 생성, 삭제 요청 매핑
kmebin 67e5b89
feat: 바우처 상세 조회 뷰 구현
kmebin 9ea89d5
feat: 바우처 상세 조회 요청 매핑
kmebin c88e54e
feat: 전체 메뉴로 돌아가기 버튼 추가
kmebin b0fa89f
feat: 고객 생성, 조회, 삭제 뷰 구현 및 요청 매핑
kmebin e132e49
docs: 3주차 요구 사항 업데이트
kmebin 776f45a
feat: ErrorCode 적용
kmebin b386283
feat: 바우처 조회, 생성, 삭제 API 구현
kmebin 14e0920
feat: 고객 조회, 생성, 삭제 API 구현
kmebin b1faf0b
feat: 바우처 타입별 조회 구현
kmebin 9aeea3e
docs: API 개발 요구 사항 업데이트
kmebin 0b98cae
fix: VoucherType 불필요한 필드 제거
kmebin cd3aeaa
feat: RestControllerAdivce를 통해 전역 예외 처리
kmebin 1c5cee0
refactor: lombok 적용
kmebin 7ea52b9
refactor: Enum values를 맵으로 관리
kmebin 706714b
refactor: console 하위 패키지로 분리
kmebin 7ee0757
chore: validation 의존성 추가
kmebin 75221d7
feat: validation을 통한 요청 검증
kmebin 5d601a2
test: 잘못된 검증 로직 수정
kmebin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: ErrorCode 적용
- Loading branch information
commit 776f45a7df69f75fb7c1bbf9c0b718c9afd62708
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
src/main/java/com/programmers/voucher/constant/BaseResponse.java
This file contains hidden or 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 com.programmers.voucher.constant; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonInclude; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.http.HttpStatus; | ||
|
|
||
| import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; | ||
|
|
||
| @Getter | ||
| @RequiredArgsConstructor | ||
| @AllArgsConstructor | ||
| public class BaseResponse<T> { | ||
| private final int status; | ||
|
|
||
| @JsonInclude(NON_NULL) | ||
| private String message; | ||
|
|
||
| @JsonInclude(NON_NULL) | ||
| private T data; | ||
|
|
||
| public static <T> BaseResponse<T> ok() { | ||
| return new BaseResponse<>(HttpStatus.OK.value()); | ||
| } | ||
|
|
||
| public static <T> BaseResponse<T> ok(T data) { | ||
| return new BaseResponse<>(HttpStatus.OK.value(), null, data); | ||
| } | ||
|
|
||
| public static <T> BaseResponse<T> created() { | ||
| return new BaseResponse<>(HttpStatus.CREATED.value()); | ||
| } | ||
|
|
||
| public static <T> BaseResponse<T> created(T data) { | ||
| return new BaseResponse<>(HttpStatus.CREATED.value(), null, data); | ||
| } | ||
|
|
||
| public static <T> BaseResponse<T> error(ErrorCode errorCode) { | ||
| return new BaseResponse<>(errorCode.getStatus().value(), errorCode.getMessage(), null); | ||
| } | ||
| } | ||
19 changes: 19 additions & 0 deletions
19
src/main/java/com/programmers/voucher/constant/ErrorCode.java
This file contains hidden or 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,19 @@ | ||
| package com.programmers.voucher.constant; | ||
|
|
||
| import lombok.Getter; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.http.HttpStatus; | ||
|
|
||
| @Getter | ||
| @RequiredArgsConstructor | ||
| public enum ErrorCode { | ||
| INVALID_COMMAND(HttpStatus.BAD_REQUEST, "존재하지 않는 명령어입니다."), | ||
| INVALID_DISCOUNT_AMOUNT(HttpStatus.BAD_REQUEST, "할인 값은 양수만 가능합니다."), | ||
| INVALID_DISCOUNT_PERCENT(HttpStatus.BAD_REQUEST, "할인율은 100을 넘을 수 없습니다."), | ||
| NOT_FOUND_VOUCHER(HttpStatus.NOT_FOUND, "존재하는 바우처가 없습니다."), | ||
| NOT_FOUND_CUSTOMER(HttpStatus.NOT_FOUND, "존재하는 고객이 없습니다."), | ||
| EXISTED_NICKNAME(HttpStatus.CONFLICT, "이미 존재하는 닉네임입니다."); | ||
|
|
||
| private final HttpStatus status; | ||
| private final String message; | ||
| } |
12 changes: 0 additions & 12 deletions
12
src/main/java/com/programmers/voucher/constant/ErrorMessage.java
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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: 9 additions & 0 deletions
9
src/main/java/com/programmers/voucher/exception/BadRequestException.java
This file contains hidden or 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,9 @@ | ||
| package com.programmers.voucher.exception; | ||
|
|
||
| import com.programmers.voucher.constant.ErrorCode; | ||
|
|
||
| public class BadRequestException extends IllegalArgumentException { | ||
| public BadRequestException(ErrorCode errorCode) { | ||
| super(errorCode.getMessage()); | ||
| } | ||
| } |
6 changes: 4 additions & 2 deletions
6
src/main/java/com/programmers/voucher/exception/ConflictException.java
This file contains hidden or 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,7 +1,9 @@ | ||
| package com.programmers.voucher.exception; | ||
|
|
||
| import com.programmers.voucher.constant.ErrorCode; | ||
|
|
||
| public class ConflictException extends IllegalArgumentException { | ||
| public ConflictException(String message) { | ||
| super(message); | ||
| public ConflictException(ErrorCode errorCode) { | ||
| super(errorCode.getMessage()); | ||
| } | ||
| } |
6 changes: 4 additions & 2 deletions
6
src/main/java/com/programmers/voucher/exception/InvalidCommandException.java
This file contains hidden or 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,7 +1,9 @@ | ||
| package com.programmers.voucher.exception; | ||
|
|
||
| import com.programmers.voucher.constant.ErrorCode; | ||
|
|
||
| public class InvalidCommandException extends IllegalArgumentException { | ||
| public InvalidCommandException(String message) { | ||
| super(message); | ||
| public InvalidCommandException(ErrorCode errorCode) { | ||
| super(errorCode.getMessage()); | ||
| } | ||
| } |
6 changes: 4 additions & 2 deletions
6
src/main/java/com/programmers/voucher/exception/NotFoundException.java
This file contains hidden or 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,7 +1,9 @@ | ||
| package com.programmers.voucher.exception; | ||
|
|
||
| import com.programmers.voucher.constant.ErrorCode; | ||
|
|
||
| public class NotFoundException extends IllegalArgumentException { | ||
| public NotFoundException(String message) { | ||
| super(message); | ||
| public NotFoundException(ErrorCode errorCode) { | ||
| super(errorCode.getMessage()); | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JsonInclude는 어떤것때문에 넣으신건가요??