Add room-stay void/checkout controls and audit logs
All checks were successful
build-and-deploy / build-deploy (push) Successful in 39s

This commit is contained in:
androidlover5842
2026-02-02 08:19:40 +05:30
parent 240e8fca25
commit e77ae6396e
9 changed files with 284 additions and 3 deletions

View File

@@ -12,6 +12,7 @@ interface RoomStayRepo : JpaRepository<RoomStay, UUID> {
from RoomStay rs
where rs.property.id = :propertyId
and rs.toAt is null
and rs.isVoided = false
""")
fun findOccupiedRoomIds(@Param("propertyId") propertyId: UUID): List<UUID>
@@ -19,6 +20,7 @@ interface RoomStayRepo : JpaRepository<RoomStay, UUID> {
select distinct rs.room.id
from RoomStay rs
where rs.property.id = :propertyId
and rs.isVoided = false
and rs.fromAt < :toAt
and (rs.toAt is null or rs.toAt > :fromAt)
""")
@@ -33,6 +35,7 @@ interface RoomStayRepo : JpaRepository<RoomStay, UUID> {
from RoomStay rs
where rs.booking.id = :bookingId
and rs.toAt is null
and rs.isVoided = false
""")
fun findActiveByBookingId(@Param("bookingId") bookingId: UUID): List<RoomStay>
@@ -40,6 +43,7 @@ interface RoomStayRepo : JpaRepository<RoomStay, UUID> {
select rs
from RoomStay rs
where rs.booking.id = :bookingId
and rs.isVoided = false
""")
fun findByBookingId(@Param("bookingId") bookingId: UUID): List<RoomStay>
@@ -48,6 +52,7 @@ interface RoomStayRepo : JpaRepository<RoomStay, UUID> {
from RoomStay rs
join fetch rs.room r
where rs.booking.id = :bookingId
and rs.isVoided = false
""")
fun findByBookingIdWithRoom(@Param("bookingId") bookingId: UUID): List<RoomStay>
@@ -55,6 +60,7 @@ interface RoomStayRepo : JpaRepository<RoomStay, UUID> {
select rs
from RoomStay rs
where rs.booking.id in :bookingIds
and rs.isVoided = false
""")
fun findByBookingIdIn(@Param("bookingIds") bookingIds: List<UUID>): List<RoomStay>
@@ -64,6 +70,7 @@ interface RoomStayRepo : JpaRepository<RoomStay, UUID> {
where rs.property.id = :propertyId
and rs.room.id in :roomIds
and rs.toAt is null
and rs.isVoided = false
""")
fun findActiveRoomIds(
@Param("propertyId") propertyId: UUID,
@@ -75,6 +82,7 @@ interface RoomStayRepo : JpaRepository<RoomStay, UUID> {
from RoomStay rs
where rs.property.id = :propertyId
and rs.room.id = :roomId
and rs.isVoided = false
and rs.fromAt < :toAt
and (rs.toAt is null or rs.toAt > :fromAt)
""")
@@ -94,6 +102,7 @@ interface RoomStayRepo : JpaRepository<RoomStay, UUID> {
left join fetch b.primaryGuest g
where rs.property.id = :propertyId
and rs.toAt is null
and rs.isVoided = false
order by r.roomNumber
""")
fun findActiveByPropertyIdWithDetails(@Param("propertyId") propertyId: UUID): List<RoomStay>
@@ -111,10 +120,25 @@ interface RoomStayRepo : JpaRepository<RoomStay, UUID> {
join rs.room r
where rs.booking.id in :bookingIds
and rs.toAt is null
and rs.isVoided = false
""")
fun findActiveRoomNumbersByBookingIds(
@Param("bookingIds") bookingIds: List<UUID>
): List<BookingRoomNumberRow>
@Query(
"""
select rs
from RoomStay rs
where rs.id = :roomStayId
and rs.booking.id = :bookingId
and rs.isVoided = false
"""
)
fun findByIdAndBookingId(
@Param("roomStayId") roomStayId: UUID,
@Param("bookingId") bookingId: UUID
): RoomStay?
}
interface BookingRoomNumberRow {