-
Notifications
You must be signed in to change notification settings - Fork 5
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
Feature :: 회원가입, 로그인 리팩터링 (#67, #68, #77) #78
Feature :: 회원가입, 로그인 리팩터링 (#67, #68, #77) #78
Conversation
Controller return Response Entity 신규 양식으로 변경 가입, 로그인시 발생하는 위험요소에 대한 Exception 처리
public String getMessage() { | ||
return message; | ||
} | ||
} |
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.
The code snippet you provided appears to be a code review request for a Java enum class MemberBusinessCode
that implements the BusinessCode
interface. Here are some observations and suggestions:
-
Make sure the package name (
com.kernel360.member.code
) is correct and aligns with your project structure. -
The
@RequiredArgsConstructor
annotation suggests that there are other fields in this enum class that are not shown in the code snippet. Ensure those fields are appropriately initialized. -
It's generally good practice to use uppercase letters and underscores for enum constants. For example, you could rename
SUCCESS_REQUEST_JOIN_MEMBER_CREATED
toSUCCESS_REQUEST_JOIN_MEMBER_CREATED
. -
Consider adding comments to document the purpose and usage of the enum values and any specific implementation details, if necessary.
-
Verify that the
HttpStatus
import is correctly referencing the desired class. -
Since the enum implements the
BusinessCode
interface, ensure that the interface is also defined correctly and captures the required functionality related to business codes.
Overall, based on the code snippet provided, it looks like a simple and straightforward implementation of an enum class representing business codes. However, a comprehensive review would require examining the rest of the relevant code files and understanding their context and usage.
public String getMessage() { | ||
return message; | ||
} | ||
} |
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.
The code you've provided appears to be a Java enum class called MemberBusinessCode
. Here's a brief review:
-
It seems like the class is implementing the
BusinessCode
interface, which defines three methods:getStatus()
,getCode()
, andgetMessage()
. This suggests thatMemberBusinessCode
is meant to represent specific business codes with associated status, code, and message values. -
The constructor is annotated with
@RequiredArgsConstructor
, indicating that it generates a constructor with all final fields. Since the fields (status
,code
, andmessage
) are final, they can only be set through this constructor. -
The enum values defined in the enum appear to represent different types of business codes for member-related actions. Each value has a corresponding HTTP status value, code, and message.
Improvement suggestions:
-
It would be helpful to have more context about how this
MemberBusinessCode
enum class is used within your application. Without that information, it's challenging to provide specific improvement suggestions. -
Consider adding additional meaningful codes that represent different scenarios or error conditions specific to your application's member module. This could help in providing detailed feedback to users or developers in case of errors or exceptions.
-
Ensure that the usage of HTTP status codes aligns with the actual responses returned by your APIs. Make sure these codes accurately reflect the response status expected from the server.
-
Depending on your project's requirements, you might want to consider making the enum values uppercase to follow naming conventions (e.g.,
SUCCESS_REQUEST_JOIN_MEMBER_CREATED
would becomeSUCCESS_REQUEST_JOIN_MEMBER_CREATED
).
Please note that without further details on the context and usage of this enum class, it's difficult to provide a comprehensive review or identify potential bugs or risks.
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.
LGTM
|
||
return new ResponseEntity<>("", HttpStatus.CREATED); | ||
return ApiResponse.toResponseEntity(SUCCESS_REQUEST_JOIN_MEMBER_CREATED); |
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.
👍🏻
return String.valueOf(age.value); | ||
} | ||
} | ||
throw new BusinessException(MemberErrorCode.FAILED_NOT_MAPPING_ORDINAL_TO_VALUE); |
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.
👍🏻
SUCCESS_REQUEST_JOIN_MEMBER_CREATED(HttpStatus.CREATED.value(), "BMC001", "회원가입 성공"), | ||
SUCCESS_REQUEST_LOGIN_MEMBER(HttpStatus.OK.value(), "BMC002", "로그인 성공"); | ||
|
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.
바뀐 코드 확인했습니다.
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.
확인했습니다~!
LGTM 👍
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.
LGTM
💡 Motivation and Context
여기에 왜 이 PR이 필요했는지, PR을 통해 무엇이 바뀌는지에 대해서 설명해 주세요
🔨 Modified
회원가입 및 로그인시 성별, 연령대의 대한 데이터를 enum 타입으로 처리하도록 바꾸었습니다.
성별은 DTO (String) -> enum.ordinal -> entity (int) :: entity -> enum.name-> DTO(String) 로 처리합니다.
나이는 DTO (String) -> enum.ordinal -> entity (int) :: entity -> enum.value -> DTO(String) 로 처리합니다.
성별을 예로 들어 회원가입시 아래와 같은 양식으로 보낸다 했을 때 (나이 엘리멘트 VALUE는 "AGE_xx" 형태로 보내야 됩니다.
(enum타입은 숫자가 먼저 올 수 없음.)
DB에는 다음과 같이 enum의 대한 index 값이 반입됩니다.
Entity의 자료형은 enum 값이 많지 않으므로 int형으로 하였습니다.
회원가입 결과 화면은 다음과 같이 나옵니다.
로그인 성공시 다음과 같이 나옵니다. 프론트엔드에서 성별과 나이의 대한 값을 가입시에 사용했던 값 그대로 쓸 수 있도록 하였습니다.
🌟 More
📋 커밋 전 체크리스트
🤟🏻 PR로 완료된 이슈
closes #67, #68 , #77