refactor: \@LastModifiedBy 설정 휴먼에러 방지를 위한 ScheduleEntity 생성 전용 팩터리 메서드 추가

This commit is contained in:
이상진 2025-09-16 22:06:50 +09:00
parent 4e13735d5f
commit 6cfa2cbd38

View File

@ -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 {