[EDIT]目標のModelの変換部分の修正
This commit is contained in:
@@ -2,6 +2,9 @@ package com.example.demo.app.domain.model;
|
|||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
import com.example.demo.app.infra.entity.GoalEntity;
|
||||||
|
import com.example.demo.app.presentation.form.GoalForm;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@@ -21,4 +24,35 @@ public class GoalModel {
|
|||||||
|
|
||||||
private Integer goalComplete;
|
private Integer goalComplete;
|
||||||
|
|
||||||
|
public static GoalModel convertFrom(GoalEntity goalEntity) {
|
||||||
|
return new GoalModel(
|
||||||
|
goalEntity.getGoalId(),
|
||||||
|
goalEntity.getGoalTitle(),
|
||||||
|
goalEntity.getGoalSubtitle(),
|
||||||
|
goalEntity.getTargetAmount(),
|
||||||
|
goalEntity.getDeadline(),
|
||||||
|
goalEntity.getGoalComplete());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GoalEntity convertTo(GoalModel goalModel) {
|
||||||
|
return new GoalEntity(
|
||||||
|
goalModel.getGoalId(),
|
||||||
|
goalModel.getGoalTitle(),
|
||||||
|
goalModel.getGoalSubtitle(),
|
||||||
|
goalModel.getTargetAmount(),
|
||||||
|
goalModel.getDeadline(),
|
||||||
|
goalModel.getGoalComplete(),
|
||||||
|
null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GoalModel convertFrom(GoalForm goalForm) {
|
||||||
|
return new GoalModel(
|
||||||
|
goalForm.getGoalId(),
|
||||||
|
goalForm.getGoalTitle(),
|
||||||
|
goalForm.getGoalSubtitle(),
|
||||||
|
goalForm.getTargetAmount(),
|
||||||
|
goalForm.getDeadline(),
|
||||||
|
goalForm.getGoalComplete());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user