Skip to content
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

[Refactor] 멤버 필드 수정 #91

Merged
merged 2 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@
public record PrincipalDetails(
String email,
String password,
String memberName,
ProviderType provider
) implements UserDetails {

public static PrincipalDetails of(Member member) {
return new PrincipalDetails(member.getEmail(),
member.getPassword(),
member.getMemberName(),
member.getProviderType()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ public record OauthSignUpRequest(
message = "이메일 형식으로 입력해주세요."
)
String email,
@NotEmpty(message = "사용자 이름이 비어있을 수 없습니다")
String memberName,
@NotEmpty(message = "닉네임이 비어있을 수 없습니다")
String nickName,
@NotEmpty(message = "휴대 전화 번호가 비어있을 수 없습니다")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ public record SignUpRequest(
message = "패스워드는 영문+숫자+특수문자 8~20 자리이어야 합니다."
)
String password,
@NotEmpty(message = "사용자 이름이 비어있을 수 없습니다")
String memberName,
@NotEmpty(message = "닉네임이 비어있을 수 없습니다")
String nickName,
@NotEmpty(message = "휴대 전화 번호가 비어있을 수 없습니다")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static kr.co.fastcampus.yanabada.domain.member.entity.ProviderType.EMAIL;
import static kr.co.fastcampus.yanabada.domain.member.entity.RoleType.ROLE_USER;

import kr.co.fastcampus.yanabada.common.exception.EmailDuplicatedException;
import kr.co.fastcampus.yanabada.common.jwt.dto.TokenIssueResponse;
import kr.co.fastcampus.yanabada.common.jwt.dto.TokenRefreshResponse;
import kr.co.fastcampus.yanabada.common.jwt.service.TokenService;
Expand Down Expand Up @@ -38,13 +39,12 @@ public class AuthService {
@Transactional
public Long signUp(SignUpRequest signUpRequest) {
if (memberRepository.existsByEmailAndProviderType(signUpRequest.email(), EMAIL)) {
throw new RuntimeException("이미 존재하는 이메일"); //todo custom + 닉네임도 중복 체크
throw new EmailDuplicatedException();
}

String encodedPassword = passwordEncoder.encode(signUpRequest.password());
Member member = Member.builder()
.email(signUpRequest.email())
.memberName(signUpRequest.memberName())
.nickName(signUpRequest.nickName())
.password(encodedPassword)
.phoneNumber(signUpRequest.phoneNumber())
Expand All @@ -63,7 +63,6 @@ public Long oauthSignUp(OauthSignUpRequest signUpRequest) {
//todo: 패스워드 환경변수 분리
Member member = Member.builder()
.email(signUpRequest.email())
.memberName(signUpRequest.memberName())
.nickName(signUpRequest.nickName())
.password(encodedPassword)
.phoneNumber(signUpRequest.phoneNumber())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public class Member extends BaseEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String email;
private String memberName;
private String nickName;
private String password;
private String phoneNumber;
Expand Down
Loading