From 6cfa2cbd38f2978d5bc787447a6569dc32a87e49 Mon Sep 17 00:00:00 2001 From: pricelees Date: Tue, 16 Sep 2025 22:06:50 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20\@LastModifiedBy=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=ED=9C=B4=EB=A8=BC=EC=97=90=EB=9F=AC=20=EB=B0=A9?= =?UTF-8?q?=EC=A7=80=EB=A5=BC=20=EC=9C=84=ED=95=9C=20ScheduleEntity=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=EC=A0=84=EC=9A=A9=20=ED=8C=A9=ED=84=B0?= =?UTF-8?q?=EB=A6=AC=20=EB=A9=94=EC=84=9C=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../persistence/ScheduleEntity.kt | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/roomescape/schedule/infrastructure/persistence/ScheduleEntity.kt b/src/main/kotlin/roomescape/schedule/infrastructure/persistence/ScheduleEntity.kt index 1b87278d..93e30bf7 100644 --- a/src/main/kotlin/roomescape/schedule/infrastructure/persistence/ScheduleEntity.kt +++ b/src/main/kotlin/roomescape/schedule/infrastructure/persistence/ScheduleEntity.kt @@ -45,12 +45,29 @@ class ScheduleEntity( ) { time?.let { this.time = it } status?.let { this.status = it } - MdcPrincipalId.extractAsLongOrNull()?.also { this.updatedBy = it } + updateLastModifiedBy() } fun hold() { this.status = ScheduleStatus.HOLD } + + fun updateLastModifiedBy() { + MdcPrincipalId.extractAsLongOrNull()?.also { this.updatedBy = it } + } +} + +object ScheduleEntityFactory { + fun create(id: Long, date: LocalDate, time: LocalTime, storeId: Long, themeId: Long): ScheduleEntity { + return ScheduleEntity( + id = id, + date = date, + time = time, + storeId = storeId, + themeId = themeId, + status = ScheduleStatus.AVAILABLE + ).apply { this.updateLastModifiedBy() } + } } enum class ScheduleStatus {