-
Notifications
You must be signed in to change notification settings - Fork 0
8주차 미션 [빈] #35
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
deli-minju
wants to merge
4
commits into
main
Choose a base branch
from
bean/week8
base: main
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
8주차 미션 [빈] #35
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
There are no files selected for viewing
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
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
11 changes: 3 additions & 8 deletions
11
bean/umc10th/src/main/java/com/example/umc10th/domain/member/exception/MemberException.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,15 +1,10 @@ | ||
| package com.example.umc10th.domain.member.exception; | ||
|
|
||
| import com.example.umc10th.domain.member.exception.code.MemberErrorCode; | ||
| import lombok.Getter; | ||
|
|
||
| @Getter | ||
| public class MemberException extends RuntimeException { | ||
|
|
||
| private final MemberErrorCode errorCode; | ||
| import com.example.umc10th.global.apiPayload.exception.GeneralException; | ||
|
|
||
| public class MemberException extends GeneralException { | ||
| public MemberException(MemberErrorCode errorCode) { | ||
| super(errorCode.getMessage()); | ||
| this.errorCode = errorCode; | ||
| super(errorCode); | ||
| } | ||
| } |
22 changes: 18 additions & 4 deletions
22
...c10th/src/main/java/com/example/umc10th/domain/member/exception/code/MemberErrorCode.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,15 +1,29 @@ | ||
| package com.example.umc10th.domain.member.exception.code; | ||
|
|
||
| import com.example.umc10th.global.apiPayload.code.BaseErrorCode; | ||
| import com.example.umc10th.global.apiPayload.code.dto.ReasonDto; | ||
| import lombok.Getter; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.http.HttpStatus; | ||
|
|
||
| @Getter | ||
| @RequiredArgsConstructor | ||
| public enum MemberErrorCode { | ||
| MEMBER_NOT_FOUND(HttpStatus.NOT_FOUND, "MEMBER404", "����ڸ� ã�� �� �����ϴ�."); | ||
| public enum MemberErrorCode implements BaseErrorCode { | ||
| MEMBER_NOT_FOUND(HttpStatus.NOT_FOUND, "MEMBER404", "User not found."), | ||
| EMAIL_ALREADY_EXISTS(HttpStatus.BAD_REQUEST, "MEMBER4001", "Email already exists."), | ||
| FOOD_CATEGORY_NOT_FOUND(HttpStatus.BAD_REQUEST, "MEMBER4002", "Food category not found."); | ||
|
|
||
| private final HttpStatus status; | ||
| private final HttpStatus httpStatus; | ||
| private final String code; | ||
| private final String message; | ||
| } | ||
|
|
||
| @Override | ||
| public ReasonDto getReason() { | ||
| return new ReasonDto(httpStatus, false, code, message); | ||
| } | ||
|
|
||
| @Override | ||
| public ReasonDto getReasonHttpStatus() { | ||
| return getReason(); | ||
| } | ||
| } |
28 changes: 28 additions & 0 deletions
28
...0th/src/main/java/com/example/umc10th/domain/member/exception/code/MemberSuccessCode.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,28 @@ | ||
| package com.example.umc10th.domain.member.exception.code; | ||
|
|
||
| import com.example.umc10th.global.apiPayload.code.BaseSuccessCode; | ||
| import com.example.umc10th.global.apiPayload.code.dto.ReasonDto; | ||
| import lombok.Getter; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.http.HttpStatus; | ||
|
|
||
| @Getter | ||
| @RequiredArgsConstructor | ||
| public enum MemberSuccessCode implements BaseSuccessCode { | ||
| SIGN_UP_SUCCESS(HttpStatus.OK, "MEMBER2000", "Sign-up completed successfully."), | ||
| GET_MY_PAGE_SUCCESS(HttpStatus.OK, "MEMBER2001", "Successfully retrieved user information."); | ||
|
|
||
| private final HttpStatus httpStatus; | ||
| private final String code; | ||
| private final String message; | ||
|
|
||
| @Override | ||
| public ReasonDto getReason() { | ||
| return new ReasonDto(httpStatus, true, code, message); | ||
| } | ||
|
|
||
| @Override | ||
| public ReasonDto getReasonHttpStatus() { | ||
| return getReason(); | ||
| } | ||
| } |
6 changes: 5 additions & 1 deletion
6
.../umc10th/src/main/java/com/example/umc10th/domain/member/repository/MemberRepository.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,11 @@ | ||
| package com.example.umc10th.domain.member.repository; | ||
|
|
||
| import com.example.umc10th.domain.member.entity.Member; | ||
| import java.util.Optional; | ||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
|
|
||
| public interface MemberRepository extends JpaRepository<Member, Long> { | ||
| } | ||
| Optional<Member> findByEmail(String email); | ||
|
|
||
| boolean existsByEmail(String email); | ||
| } |
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
Oops, something went wrong.
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.
보안 요구사항에 따라 영문/숫자/특수문자 조합 등의 @pattern 검증을 추가해도 좋을 것 같습니다