getting started
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
package com.android.trisolarisserver.models.booking
|
||||
|
||||
import com.android.trisolarisserver.models.property.AppUser
|
||||
import com.android.trisolarisserver.models.property.Property
|
||||
import jakarta.persistence.*
|
||||
import java.time.OffsetDateTime
|
||||
import java.util.UUID
|
||||
|
||||
@Entity
|
||||
@Table(
|
||||
name = "booking",
|
||||
uniqueConstraints = [
|
||||
UniqueConstraint(columnNames = ["property_id", "source", "source_booking_id"])
|
||||
]
|
||||
)
|
||||
class Booking(
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@Column(columnDefinition = "uuid")
|
||||
val id: UUID? = null,
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(name = "property_id", nullable = false)
|
||||
var property: Property,
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "primary_guest_id")
|
||||
var primaryGuest: Guest? = null,
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(nullable = false)
|
||||
var status: BookingStatus = BookingStatus.OPEN,
|
||||
|
||||
@Column(nullable = false)
|
||||
var source: String = "WALKIN", // WALKIN, WEBSITE, MMT, AGENT
|
||||
|
||||
@Column(name = "source_booking_id")
|
||||
var sourceBookingId: String? = null,
|
||||
|
||||
@Column(name = "checkin_at", columnDefinition = "timestamptz")
|
||||
var checkinAt: OffsetDateTime? = null,
|
||||
|
||||
@Column(name = "checkout_at", columnDefinition = "timestamptz")
|
||||
var checkoutAt: OffsetDateTime? = null,
|
||||
|
||||
@Column(name = "expected_checkin_at", columnDefinition = "timestamptz")
|
||||
var expectedCheckinAt: OffsetDateTime? = null,
|
||||
|
||||
@Column(name = "expected_checkout_at", columnDefinition = "timestamptz")
|
||||
var expectedCheckoutAt: OffsetDateTime? = null,
|
||||
|
||||
var notes: String? = null,
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "created_by")
|
||||
var createdBy: AppUser? = null,
|
||||
|
||||
@Column(name = "created_at", columnDefinition = "timestamptz")
|
||||
val createdAt: OffsetDateTime = OffsetDateTime.now(),
|
||||
|
||||
@Column(name = "updated_at", columnDefinition = "timestamptz")
|
||||
var updatedAt: OffsetDateTime = OffsetDateTime.now()
|
||||
)
|
||||
Reference in New Issue
Block a user