pre assign rooms before checkin
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user