Skip to content

Commit af9a99d

Browse files
authored
Merge pull request #367 from DDD-Community/feat/366/user
Feat/366/user
2 parents f5a6cad + 7c9be9a commit af9a99d

File tree

12 files changed

+32
-6
lines changed

12 files changed

+32
-6
lines changed

app/src/main/java/com/growit/app/user/controller/dto/request/SignUpRequest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public class SignUpRequest {
2020
@Size(min = 2, message = "{validation.user.name.size}")
2121
private String name;
2222

23+
private String lastName;
24+
2325
@NotBlank(message = "{validation.user.job-role.required}")
2426
private String jobRoleId;
2527

app/src/main/java/com/growit/app/user/controller/dto/request/UpdateUserRequest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ public class UpdateUserRequest {
1515
@Size(min = 2, message = "{validation.user.name.size}")
1616
private String name;
1717

18+
private String lastName;
19+
1820
@NotBlank(message = "{validation.user.job-role.required}")
1921
private String jobRoleId;
2022

app/src/main/java/com/growit/app/user/controller/mapper/RequestMapper.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public SignUpCommand toSignUpCommand(SignUpRequest request) {
1313
new Email(request.getEmail()),
1414
request.getPassword(),
1515
request.getName(),
16+
request.getLastName(),
1617
request.getJobRoleId(),
1718
request.getCareerYear(),
1819
null);
@@ -41,6 +42,10 @@ public RequiredConsentCommand toRequiredConsentCommand(RequiredConsentRequest re
4142

4243
public UpdateUserCommand toUpdateUserCommand(User user, UpdateUserRequest request) {
4344
return new UpdateUserCommand(
44-
user, request.getName(), request.getJobRoleId(), request.getCareerYear());
45+
user,
46+
request.getName(),
47+
request.getLastName(),
48+
request.getJobRoleId(),
49+
request.getCareerYear());
4550
}
4651
}

app/src/main/java/com/growit/app/user/domain/user/User.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public class User {
2424

2525
private String name;
2626

27+
private String lastName;
28+
2729
private String jobRoleId;
2830

2931
private CareerYear careerYear;
@@ -43,6 +45,7 @@ public static User from(SignUpCommand command) {
4345
.email(command.email())
4446
.password(command.password())
4547
.name(command.name())
48+
.lastName(command.lastName())
4649
.jobRoleId(command.jobRoleId())
4750
.careerYear(command.careerYear())
4851
.isOnboarding(false)
@@ -55,6 +58,7 @@ public static User from(SignUpCommand command) {
5558

5659
public void updateByCommand(UpdateUserCommand command) {
5760
this.name = command.name();
61+
this.lastName = command.lastName();
5862
this.jobRoleId = command.jobRoleId();
5963
this.careerYear = command.careerYear();
6064
}

app/src/main/java/com/growit/app/user/domain/user/dto/SignUpCommand.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ public record SignUpCommand(
1111
Email email,
1212
String password,
1313
String name,
14+
String lastName,
1415
String jobRoleId,
1516
CareerYear careerYear,
1617
OAuth oAuth) {
1718
public SignUpCommand encodePassword(String password) {
18-
return new SignUpCommand(email, password, name, jobRoleId, careerYear, oAuth);
19+
return new SignUpCommand(email, password, name, lastName, jobRoleId, careerYear, oAuth);
1920
}
2021

2122
public void checkOAuth() {

app/src/main/java/com/growit/app/user/domain/user/dto/UpdateUserCommand.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
import com.growit.app.user.domain.user.User;
44
import com.growit.app.user.domain.user.vo.CareerYear;
55

6-
public record UpdateUserCommand(User user, String name, String jobRoleId, CareerYear careerYear) {}
6+
public record UpdateUserCommand(
7+
User user, String name, String lastName, String jobRoleId, CareerYear careerYear) {}

app/src/main/java/com/growit/app/user/usecase/SignUpKaKaoUseCase.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public void execute(
4343
new Email(emailFromToken),
4444
null,
4545
signUpCommand.name(),
46+
null,
4647
signUpCommand.jobRoleId(),
4748
signUpCommand.careerYear(),
4849
oAuth);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER TABLE users
2+
ADD COLUMN last_name VARCHAR(255);

app/src/test/java/com/growit/app/fake/user/UserFixture.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,19 @@ public static ReIssueCommand defaultReIssueCommand() {
4646
}
4747

4848
public static UpdateUserCommand defaultUpdateUserCommand(User user) {
49-
return new UpdateUserCommand(user, "updatedName", "jobRoleId-1", CareerYear.JUNIOR);
49+
return new UpdateUserCommand(user, "updatedName", null, "jobRoleId-1", CareerYear.JUNIOR);
5050
}
5151

5252
public static UpdateUserRequest defaultUpdateUserRequest() {
53-
return new UpdateUserRequest("updatedName", "jobRoleId-1", CareerYear.JUNIOR);
53+
return new UpdateUserRequest("updatedName", null, "jobRoleId-1", CareerYear.JUNIOR);
5454
}
5555

5656
public static SignUpRequest defaultSignUpRequest() {
5757
return new SignUpRequest(
5858
"test@example.com",
5959
"securePass123",
6060
"홍길동",
61+
null,
6162
"6rOg7Zmp7IOd",
6263
CareerYear.JUNIOR,
6364
new RequiredConsentRequest(true, true));
@@ -125,6 +126,7 @@ public User build() {
125126
.email(new Email(email))
126127
.password(password)
127128
.name(name)
129+
.lastName(null)
128130
.jobRoleId(jobRoleId)
129131
.careerYear(careerYear)
130132
.isDeleted(false)

app/src/test/java/com/growit/app/user/controller/AuthControllerTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ void signupTest() throws Exception {
9090
fieldWithPath("email").type(STRING).description("사용자 이메일"),
9191
fieldWithPath("password").type(STRING).description("사용자 비밀번호"),
9292
fieldWithPath("name").type(STRING).description("사용자 이름"),
93+
fieldWithPath("lastName").type(STRING).description("사용자 성").optional(),
9394
fieldWithPath("jobRoleId").type(STRING).description("직무 ID"),
9495
fieldWithPath("careerYear")
9596
.type(STRING)

0 commit comments

Comments
 (0)