-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
177 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 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
72 changes: 72 additions & 0 deletions
72
src/main/java/net/teumteum/user/domain/request/UserUpdateRequest.java
This file contains 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,72 @@ | ||
package net.teumteum.user.domain.request; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import java.util.List; | ||
import net.teumteum.user.domain.ActivityArea; | ||
import net.teumteum.user.domain.Job; | ||
import net.teumteum.user.domain.JobStatus; | ||
import net.teumteum.user.domain.Oauth; | ||
import net.teumteum.user.domain.Terms; | ||
import net.teumteum.user.domain.User; | ||
|
||
public record UserUpdateRequest( | ||
Long id, | ||
String newName, | ||
String newBirth, | ||
Long newCharacterId, | ||
NewActivityArea newActivityArea, | ||
String newMbti, | ||
String newStatus, | ||
String newGoal, | ||
NewJob newJob, | ||
List<String> newInterests | ||
) { | ||
|
||
private static final Long IGNORE_ID = null; | ||
private static final int IGNORE_MANNER_TEMPERATURE = -1; | ||
private static final Oauth IGNORE_OAUTH = null; | ||
private static final boolean NOT_CERTIFICATED = false; | ||
private static final Terms IGNORE_TERMS = null; | ||
|
||
public User toUser() { | ||
return new User( | ||
IGNORE_ID, | ||
newName, | ||
newBirth, | ||
newCharacterId, | ||
IGNORE_MANNER_TEMPERATURE, | ||
IGNORE_OAUTH, | ||
new ActivityArea( | ||
newActivityArea.city, | ||
newActivityArea.streets | ||
), | ||
newMbti, | ||
JobStatus.valueOf(newStatus), | ||
newGoal, | ||
new Job( | ||
newJob.name, | ||
NOT_CERTIFICATED, | ||
newJob.jobClass, | ||
newJob.detailClass | ||
), | ||
newInterests, | ||
IGNORE_TERMS | ||
); | ||
} | ||
|
||
public record NewActivityArea( | ||
String city, | ||
List<String> streets | ||
) { | ||
|
||
} | ||
|
||
public record NewJob( | ||
String name, | ||
@JsonProperty("class") | ||
String jobClass, | ||
String detailClass | ||
) { | ||
|
||
} | ||
} |
This file contains 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 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
40 changes: 40 additions & 0 deletions
40
src/test/java/net/teumteum/user/integration/RequestFixture.java
This file contains 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,40 @@ | ||
package net.teumteum.user.integration; | ||
|
||
import net.teumteum.user.domain.User; | ||
import net.teumteum.user.domain.request.UserUpdateRequest; | ||
import net.teumteum.user.domain.request.UserUpdateRequest.NewActivityArea; | ||
import net.teumteum.user.domain.request.UserUpdateRequest.NewJob; | ||
|
||
public class RequestFixture { | ||
|
||
public static UserUpdateRequest userUpdateRequest(User user) { | ||
return new UserUpdateRequest( | ||
user.getId(), | ||
"new_name", | ||
user.getBirth(), | ||
user.getCharacterId(), | ||
newActivityArea(user), | ||
user.getMbti(), | ||
user.getStatus().name(), | ||
user.getGoal(), | ||
newJob(user), | ||
user.getInterests() | ||
); | ||
} | ||
|
||
private static NewActivityArea newActivityArea(User user) { | ||
return new NewActivityArea( | ||
user.getActivityArea().getCity(), | ||
user.getActivityArea().getStreet() | ||
); | ||
} | ||
|
||
private static NewJob newJob(User user) { | ||
return new NewJob( | ||
user.getJob().getName(), | ||
user.getJob().getJobClass(), | ||
user.getJob().getDetailJobClass() | ||
); | ||
} | ||
|
||
} |
This file contains 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