generated from pricelees/issue-pr-template
[#44] 매장 기능 도입 #45
@ -1,22 +1,43 @@
|
||||
package roomescape.schedule.infrastructure.persistence
|
||||
|
||||
import jakarta.persistence.*
|
||||
import roomescape.common.entity.AuditingBaseEntity
|
||||
import org.springframework.data.annotation.CreatedBy
|
||||
import org.springframework.data.annotation.CreatedDate
|
||||
import org.springframework.data.annotation.LastModifiedDate
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener
|
||||
import roomescape.common.entity.PersistableBaseEntity
|
||||
import roomescape.common.util.MdcPrincipalId
|
||||
import java.time.LocalDate
|
||||
import java.time.LocalDateTime
|
||||
import java.time.LocalTime
|
||||
|
||||
@Entity
|
||||
@EntityListeners(AuditingEntityListener::class)
|
||||
@Table(name = "schedule", uniqueConstraints = [UniqueConstraint(columnNames = ["date", "time", "theme_id"])])
|
||||
class ScheduleEntity(
|
||||
id: Long,
|
||||
|
||||
var date: LocalDate,
|
||||
var time: LocalTime,
|
||||
val storeId: Long,
|
||||
var themeId: Long,
|
||||
|
||||
@Enumerated(value = EnumType.STRING)
|
||||
var status: ScheduleStatus
|
||||
) : AuditingBaseEntity(id) {
|
||||
var status: ScheduleStatus,
|
||||
) : PersistableBaseEntity(id) {
|
||||
@Column(updatable = false)
|
||||
@CreatedDate
|
||||
lateinit var createdAt: LocalDateTime
|
||||
|
||||
@Column(updatable = false)
|
||||
@CreatedBy
|
||||
var createdBy: Long = 0L
|
||||
|
||||
@Column
|
||||
@LastModifiedDate
|
||||
lateinit var updatedAt: LocalDateTime
|
||||
|
||||
var updatedBy: Long = 0L
|
||||
|
||||
fun modifyIfNotNull(
|
||||
time: LocalTime?,
|
||||
@ -24,6 +45,7 @@ class ScheduleEntity(
|
||||
) {
|
||||
time?.let { this.time = it }
|
||||
status?.let { this.status = it }
|
||||
MdcPrincipalId.extractAsLongOrNull()?.also { this.updatedBy = it }
|
||||
}
|
||||
|
||||
fun hold() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user