[FIX] userの整合性を修正・変換メソッドを追加しました。
This commit is contained in:
@@ -2,6 +2,8 @@ package com.example.demo.app.domain.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import com.example.demo.app.infra.entity.UserEntity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -12,7 +14,7 @@ public class UserModel {
|
||||
private String userName;
|
||||
private String mailAddress;
|
||||
private String password;
|
||||
private Integer secretQuestionId;
|
||||
private Long secretQuestionId;
|
||||
private String secretAnswer;
|
||||
private LocalDate brithDate;
|
||||
private Integer saving;
|
||||
@@ -21,4 +23,22 @@ public class UserModel {
|
||||
private Long goalId;
|
||||
private Long courseId;
|
||||
private Integer deleteFlag;
|
||||
|
||||
public static UserModel convertFrom(UserEntity userEntity) {
|
||||
return new UserModel(
|
||||
userEntity.getUserId(),
|
||||
userEntity.getUserName(),
|
||||
userEntity.getMailAddress(),
|
||||
userEntity.getPassword(),
|
||||
userEntity.getQuestionEntity().getSecretQuestionId(),
|
||||
userEntity.getSecretQuestionAnswer(),
|
||||
userEntity.getBirthDate(),
|
||||
userEntity.getSaving(),
|
||||
userEntity.getAnnualIncome(),
|
||||
userEntity.getMonthlyBudget(),
|
||||
userEntity.getGoalEntity().getGoalId(),
|
||||
userEntity.getCourseEntity().getCourseId(),
|
||||
userEntity.getDeleteFlag()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.example.demo.app.domain.service;
|
||||
|
||||
import com.example.demo.app.domain.model.UserModel;
|
||||
import com.example.demo.app.presentation.form.UserForm;
|
||||
|
||||
public interface UserService {
|
||||
@@ -7,4 +8,6 @@ public interface UserService {
|
||||
void register(UserForm userForm);
|
||||
|
||||
public void updateCourse(Long userId, Long courseId);
|
||||
|
||||
public UserModel findByUserId(Long userId);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.example.demo.app.presentation.form;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import com.example.demo.app.domain.model.UserModel;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -21,4 +23,21 @@ public class UserForm {
|
||||
private Integer monthlyBudget;
|
||||
private Long goalId;
|
||||
private Long courseId;
|
||||
|
||||
|
||||
public static UserForm convertFrom(UserModel userModel) {
|
||||
return new UserForm(
|
||||
userModel.getUserName(),
|
||||
userModel.getMailAddress(),
|
||||
userModel.getPassword(),
|
||||
userModel.getSecretQuestionId(),
|
||||
userModel.getSecretAnswer(),
|
||||
userModel.getBrithDate(),
|
||||
userModel.getSaving(),
|
||||
userModel.getAnnualIncome(),
|
||||
userModel.getMonthlyBudget(),
|
||||
userModel.getGoalId(),
|
||||
userModel.getCourseId()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user