pre assign rooms before checkin

This commit is contained in:
androidlover5842
2026-01-24 23:07:45 +05:30
parent 57ca477c08
commit 4a2834819f
3 changed files with 67 additions and 0 deletions

View File

@@ -47,4 +47,19 @@ interface RoomStayRepo : JpaRepository<RoomStay, UUID> {
@Param("propertyId") propertyId: UUID,
@Param("roomIds") roomIds: List<UUID>
): List<UUID>
@Query("""
select case when count(rs) > 0 then true else false end
from RoomStay rs
where rs.property.id = :propertyId
and rs.room.id = :roomId
and rs.fromAt < :toAt
and (rs.toAt is null or rs.toAt > :fromAt)
""")
fun existsOverlap(
@Param("propertyId") propertyId: UUID,
@Param("roomId") roomId: UUID,
@Param("fromAt") fromAt: java.time.OffsetDateTime,
@Param("toAt") toAt: java.time.OffsetDateTime
): Boolean
}