Expose active temp card state on room responses
All checks were successful
build-and-deploy / build-deploy (push) Successful in 33s

This commit is contained in:
androidlover5842
2026-01-28 17:56:59 +05:30
parent 2591768efb
commit b52cb1a88d
3 changed files with 44 additions and 10 deletions

View File

@@ -33,4 +33,17 @@ interface IssuedCardRepo : JpaRepository<IssuedCard, UUID> {
@org.springframework.data.repository.query.Param("roomStayId") roomStayId: UUID,
@org.springframework.data.repository.query.Param("now") now: java.time.OffsetDateTime
): Boolean
@org.springframework.data.jpa.repository.Query("""
select c
from IssuedCard c
where c.property.id = :propertyId
and c.roomStay is null
and c.revokedAt is null
and c.expiresAt > :now
""")
fun findActiveTempCardsForProperty(
@org.springframework.data.repository.query.Param("propertyId") propertyId: UUID,
@org.springframework.data.repository.query.Param("now") now: java.time.OffsetDateTime
): List<IssuedCard>
}