build guest rating system
This commit is contained in:
@@ -59,6 +59,21 @@ class Booking(
|
||||
@Column(name = "transport_vehicle_number")
|
||||
var transportVehicleNumber: String? = null,
|
||||
|
||||
@Column(name = "adult_count")
|
||||
var adultCount: Int? = null,
|
||||
|
||||
@Column(name = "child_count")
|
||||
var childCount: Int? = null,
|
||||
|
||||
@Column(name = "male_count")
|
||||
var maleCount: Int? = null,
|
||||
|
||||
@Column(name = "female_count")
|
||||
var femaleCount: Int? = null,
|
||||
|
||||
@Column(name = "total_guest_count")
|
||||
var totalGuestCount: Int? = null,
|
||||
|
||||
var notes: String? = null,
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.android.trisolarisserver.models.booking
|
||||
|
||||
import com.android.trisolarisserver.models.property.AppUser
|
||||
import com.android.trisolarisserver.models.property.Organization
|
||||
import com.android.trisolarisserver.models.property.Property
|
||||
import jakarta.persistence.Column
|
||||
import jakarta.persistence.Entity
|
||||
import jakarta.persistence.EnumType
|
||||
import jakarta.persistence.Enumerated
|
||||
import jakarta.persistence.FetchType
|
||||
import jakarta.persistence.GeneratedValue
|
||||
import jakarta.persistence.Id
|
||||
import jakarta.persistence.JoinColumn
|
||||
import jakarta.persistence.ManyToOne
|
||||
import jakarta.persistence.Table
|
||||
import jakarta.persistence.UniqueConstraint
|
||||
import java.time.OffsetDateTime
|
||||
import java.util.UUID
|
||||
|
||||
@Entity
|
||||
@Table(
|
||||
name = "guest_rating",
|
||||
uniqueConstraints = [
|
||||
UniqueConstraint(columnNames = ["guest_id", "booking_id"])
|
||||
]
|
||||
)
|
||||
class GuestRating(
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@Column(columnDefinition = "uuid")
|
||||
val id: UUID? = null,
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(name = "org_id", nullable = false)
|
||||
var org: Organization,
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(name = "property_id", nullable = false)
|
||||
var property: Property,
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(name = "guest_id", nullable = false)
|
||||
var guest: Guest,
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(name = "booking_id", nullable = false)
|
||||
var booking: Booking,
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(nullable = false)
|
||||
var score: GuestRatingScore,
|
||||
|
||||
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()
|
||||
)
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.android.trisolarisserver.models.booking
|
||||
|
||||
enum class GuestRatingScore {
|
||||
GOOD, OK, TROUBLE
|
||||
}
|
||||
Reference in New Issue
Block a user