Add room-type quantity reservation APIs
All checks were successful
build-and-deploy / build-deploy (push) Successful in 35s
All checks were successful
build-and-deploy / build-deploy (push) Successful in 35s
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user