ai creates booking
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
package com.android.trisolarisserver.models.booking
|
||||
|
||||
import com.android.trisolarisserver.models.property.Property
|
||||
import jakarta.persistence.*
|
||||
import java.time.OffsetDateTime
|
||||
import java.util.UUID
|
||||
|
||||
@Entity
|
||||
@Table(
|
||||
name = "inbound_email",
|
||||
uniqueConstraints = [
|
||||
UniqueConstraint(columnNames = ["message_id"]),
|
||||
UniqueConstraint(columnNames = ["property_id", "ota_booking_id"])
|
||||
]
|
||||
)
|
||||
class InboundEmail(
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@Column(columnDefinition = "uuid")
|
||||
val id: UUID? = null,
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "property_id")
|
||||
var property: Property? = null,
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "booking_id")
|
||||
var booking: Booking? = null,
|
||||
|
||||
@Column(name = "ota_booking_id")
|
||||
var otaBookingId: String? = null,
|
||||
|
||||
@Column(name = "message_id")
|
||||
var messageId: String? = null,
|
||||
|
||||
@Column(name = "subject")
|
||||
var subject: String? = null,
|
||||
|
||||
@Column(name = "from_address")
|
||||
var fromAddress: String? = null,
|
||||
|
||||
@Column(name = "received_at", columnDefinition = "timestamptz")
|
||||
var receivedAt: OffsetDateTime? = null,
|
||||
|
||||
@Column(name = "status", nullable = false)
|
||||
@Enumerated(EnumType.STRING)
|
||||
var status: InboundEmailStatus = InboundEmailStatus.PENDING,
|
||||
|
||||
@Column(name = "raw_pdf_path")
|
||||
var rawPdfPath: String? = null,
|
||||
|
||||
@Column(name = "extracted_data", columnDefinition = "jsonb")
|
||||
var extractedData: String? = null,
|
||||
|
||||
@Column(name = "processed_at", columnDefinition = "timestamptz")
|
||||
var processedAt: OffsetDateTime? = null,
|
||||
|
||||
@Column(name = "created_at", nullable = false, columnDefinition = "timestamptz")
|
||||
val createdAt: OffsetDateTime = OffsetDateTime.now()
|
||||
)
|
||||
|
||||
enum class InboundEmailStatus {
|
||||
PENDING,
|
||||
CREATED,
|
||||
CANCELLED,
|
||||
SKIPPED,
|
||||
ERROR
|
||||
}
|
||||
Reference in New Issue
Block a user