generated from pricelees/issue-pr-template
[#44] 매장 기능 도입 #45
@ -1,22 +1,43 @@
|
|||||||
package roomescape.schedule.infrastructure.persistence
|
package roomescape.schedule.infrastructure.persistence
|
||||||
|
|
||||||
import jakarta.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.LocalDate
|
||||||
|
import java.time.LocalDateTime
|
||||||
import java.time.LocalTime
|
import java.time.LocalTime
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@EntityListeners(AuditingEntityListener::class)
|
||||||
@Table(name = "schedule", uniqueConstraints = [UniqueConstraint(columnNames = ["date", "time", "theme_id"])])
|
@Table(name = "schedule", uniqueConstraints = [UniqueConstraint(columnNames = ["date", "time", "theme_id"])])
|
||||||
class ScheduleEntity(
|
class ScheduleEntity(
|
||||||
id: Long,
|
id: Long,
|
||||||
|
|
||||||
var date: LocalDate,
|
var date: LocalDate,
|
||||||
var time: LocalTime,
|
var time: LocalTime,
|
||||||
|
val storeId: Long,
|
||||||
var themeId: Long,
|
var themeId: Long,
|
||||||
|
|
||||||
@Enumerated(value = EnumType.STRING)
|
@Enumerated(value = EnumType.STRING)
|
||||||
var status: ScheduleStatus
|
var status: ScheduleStatus,
|
||||||
) : AuditingBaseEntity(id) {
|
) : 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(
|
fun modifyIfNotNull(
|
||||||
time: LocalTime?,
|
time: LocalTime?,
|
||||||
@ -24,6 +45,7 @@ class ScheduleEntity(
|
|||||||
) {
|
) {
|
||||||
time?.let { this.time = it }
|
time?.let { this.time = it }
|
||||||
status?.let { this.status = it }
|
status?.let { this.status = it }
|
||||||
|
MdcPrincipalId.extractAsLongOrNull()?.also { this.updatedBy = it }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hold() {
|
fun hold() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user