Add room-type quantity reservation APIs
All checks were successful
build-and-deploy / build-deploy (push) Successful in 35s

This commit is contained in:
androidlover5842
2026-02-02 09:09:40 +05:30
parent 247d6e4961
commit 30c37affb4
8 changed files with 356 additions and 4 deletions

View File

@@ -139,6 +139,24 @@ interface RoomStayRepo : JpaRepository<RoomStay, UUID> {
@Param("roomStayId") roomStayId: UUID,
@Param("bookingId") bookingId: UUID
): RoomStay?
@Query(
"""
select count(distinct rs.room.id)
from RoomStay rs
where rs.property.id = :propertyId
and rs.room.roomType.id = :roomTypeId
and rs.isVoided = false
and rs.fromAt < :toAt
and (rs.toAt is null or rs.toAt > :fromAt)
"""
)
fun countOccupiedByTypeInRange(
@Param("propertyId") propertyId: UUID,
@Param("roomTypeId") roomTypeId: UUID,
@Param("fromAt") fromAt: java.time.OffsetDateTime,
@Param("toAt") toAt: java.time.OffsetDateTime
): Long
}
interface BookingRoomNumberRow {