From 662e3433d23341ce5bf3089c4c06bb86c3e3cd41 Mon Sep 17 00:00:00 2001 From: k-oshita Date: Thu, 17 Sep 2026 16:12:15 +0900 Subject: [PATCH] =?UTF-8?q?[EDIT]=E7=9B=AE=E6=A8=99=E3=81=AEModel=E3=81=AE?= =?UTF-8?q?=E5=A4=89=E6=8F=9B=E9=83=A8=E5=88=86=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo/app/domain/model/GoalModel.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/main/java/com/example/demo/app/domain/model/GoalModel.java b/src/main/java/com/example/demo/app/domain/model/GoalModel.java index 7764281..94a57d2 100644 --- a/src/main/java/com/example/demo/app/domain/model/GoalModel.java +++ b/src/main/java/com/example/demo/app/domain/model/GoalModel.java @@ -2,6 +2,9 @@ package com.example.demo.app.domain.model; 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.Getter; @@ -21,4 +24,35 @@ public class GoalModel { 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()); + } + } \ No newline at end of file