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: 회원 도메인 리팩토링 #132

Merged
merged 7 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
@@ -1,19 +1,20 @@
package com.fc.shimpyo_be.domain.member.dto.request;

import jakarta.validation.constraints.NotBlank;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class CheckPasswordRequestDto {

@NotBlank(message = "비밀번호를 입력하세요.")
private String password;

@Builder
public CheckPasswordRequestDto(String password) {
private CheckPasswordRequestDto(String password) {
this.password = password;
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package com.fc.shimpyo_be.domain.member.dto.request;

import jakarta.validation.constraints.NotBlank;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class RefreshRequestDto {

@NotBlank(message = "Access Token 을 입력하세요.")
Expand All @@ -15,7 +16,7 @@ public class RefreshRequestDto {
private String refreshToken;

@Builder
public RefreshRequestDto(String accessToken, String refreshToken) {
private RefreshRequestDto(String accessToken, String refreshToken) {
this.accessToken = accessToken;
this.refreshToken = refreshToken;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;

@Getter
@NoArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class SignInRequestDto {

@NotBlank(message = "이메일을 입력하세요.")
Expand All @@ -19,12 +19,12 @@ public class SignInRequestDto {
private String password;

@Builder
public SignInRequestDto(String email, String password) {
private SignInRequestDto(String email, String password) {
this.email = email;
this.password = password;
}

public UsernamePasswordAuthenticationToken toAuthentication(){
public UsernamePasswordAuthenticationToken toAuthentication() {
return new UsernamePasswordAuthenticationToken(this.email, this.password);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.springframework.security.crypto.password.PasswordEncoder;

@Getter
@NoArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class SignUpRequestDto {

@NotBlank(message = "이메일을 입력하세요.")
Expand All @@ -26,7 +27,7 @@ public class SignUpRequestDto {
private String passwordConfirm;

@Builder
public SignUpRequestDto(String email, String name, String password, String passwordConfirm) {
private SignUpRequestDto(String email, String name, String password, String passwordConfirm) {
this.email = email;
this.name = name;
this.password = password;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package com.fc.shimpyo_be.domain.member.dto.request;

import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class UpdateMemberRequestDto {

private String password;
private String passwordConfirm;
private String photoUrl;

@Builder
public UpdateMemberRequestDto(String password, String passwordConfirm, String photoUrl) {
private UpdateMemberRequestDto(String password, String passwordConfirm, String photoUrl) {
this.password = password;
this.passwordConfirm = passwordConfirm;
this.photoUrl = photoUrl;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package com.fc.shimpyo_be.domain.member.dto.response;

import com.fc.shimpyo_be.domain.member.entity.Member;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class MemberResponseDto {

private Long memberId;
Expand All @@ -15,7 +16,7 @@ public class MemberResponseDto {
private String photoUrl;

@Builder
public MemberResponseDto(Long memberId, String email, String name, String photoUrl) {
private MemberResponseDto(Long memberId, String email, String name, String photoUrl) {
this.memberId = memberId;
this.email = email;
this.name = name;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
package com.fc.shimpyo_be.domain.member.dto.response;

import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class SignInResponseDto {

private MemberResponseDto member;
private TokenResponseDto token;

@Builder
public SignInResponseDto(MemberResponseDto member, TokenResponseDto token) {
private SignInResponseDto(MemberResponseDto member, TokenResponseDto token) {
this.member = member;
this.token = token;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.fc.shimpyo_be.domain.member.dto.response;

import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class TokenResponseDto {

private String grantType;
Expand All @@ -14,7 +15,7 @@ public class TokenResponseDto {
private String refreshToken;

@Builder
public TokenResponseDto(String grantType, String accessToken, long accessTokenExpiresIn,
private TokenResponseDto(String grantType, String accessToken, long accessTokenExpiresIn,
String refreshToken) {
this.grantType = grantType;
this.accessToken = accessToken;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class Member extends BaseTimeEntity {
private Authority authority;

@Builder
public Member(Long id, String email, String name, String password, String photoUrl,
private Member(Long id, String email, String name, String password, String photoUrl,
Authority authority) {
this.id = id;
this.email = email;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class RefreshToken {
private String token;

@Builder
public RefreshToken(Long id, String token) {
private RefreshToken(Long id, String token) {
this.id = id;
this.token = token;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void signUp() throws Exception {

given(authService.signUp(any(SignUpRequestDto.class))).willReturn(memberResponseDto);

// when
// when then
mockMvc.perform(post("/api/auth/signup")
.content(objectMapper.writeValueAsString(signUpRequestDto))
.contentType(MediaType.APPLICATION_JSON))
Expand Down Expand Up @@ -118,7 +118,7 @@ void signIn() throws Exception {

given(authService.signIn(any(SignInRequestDto.class))).willReturn(signInResponseDto);

// when
// when then
mockMvc.perform(post("/api/auth/signin")
.content(objectMapper.writeValueAsString(signInRequestDto))
.contentType(MediaType.APPLICATION_JSON))
Expand Down Expand Up @@ -187,7 +187,7 @@ void refresh() throws Exception {

given(authService.refresh(any(RefreshRequestDto.class))).willReturn(signInResponseDto);

// when
// when then
mockMvc.perform(post("/api/auth/refresh")
.content(objectMapper.writeValueAsString(refreshRequestDto))
.contentType(MediaType.APPLICATION_JSON))
Expand Down