Files
TrisolarisServer/src/main/kotlin/com/android/trisolarisserver/db/repo/BookingRepo.kt
androidlover5842 34fc7ca7d2
All checks were successful
build-and-deploy / build-deploy (push) Successful in 33s
Fix booking snapshot lazy loading
2026-01-31 14:45:40 +05:30

20 lines
1.0 KiB
Kotlin

package com.android.trisolarisserver.db.repo
import com.android.trisolarisserver.models.booking.Booking
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.EntityGraph
import java.util.UUID
interface BookingRepo : JpaRepository<Booking, UUID> {
fun findByPropertyIdAndSourceBookingId(propertyId: UUID, sourceBookingId: String): Booking?
fun existsByPropertyIdAndSourceBookingId(propertyId: UUID, sourceBookingId: String): Boolean
fun countByPrimaryGuestId(guestId: UUID): Long
@EntityGraph(attributePaths = ["primaryGuest"])
fun findByPropertyIdAndStatusInOrderByCreatedAtDesc(propertyId: UUID, status: Collection<com.android.trisolarisserver.models.booking.BookingStatus>): List<Booking>
@EntityGraph(attributePaths = ["primaryGuest"])
fun findByPropertyIdOrderByCreatedAtDesc(propertyId: UUID): List<Booking>
@EntityGraph(attributePaths = ["property", "primaryGuest", "createdBy"])
fun findDetailedById(id: UUID): java.util.Optional<Booking>
}