Handle duplicate cardId on revoke
Some checks failed
build-and-deploy / build-deploy (push) Has been cancelled
Some checks failed
build-and-deploy / build-deploy (push) Has been cancelled
This commit is contained in:
@@ -249,7 +249,8 @@ class IssuedCards(
|
|||||||
return if (uuid != null) {
|
return if (uuid != null) {
|
||||||
issuedCardRepo.findByIdAndPropertyId(uuid, propertyId)
|
issuedCardRepo.findByIdAndPropertyId(uuid, propertyId)
|
||||||
} else {
|
} else {
|
||||||
issuedCardRepo.findByCardIdIgnoreCaseAndPropertyId(trimmed, propertyId)
|
issuedCardRepo.findAllByCardIdIgnoreCaseAndPropertyId(trimmed, propertyId)
|
||||||
|
.maxByOrNull { it.issuedAt }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ interface IssuedCardRepo : JpaRepository<IssuedCard, UUID> {
|
|||||||
fun findByRoomStayIdOrderByIssuedAtDesc(roomStayId: UUID): List<IssuedCard>
|
fun findByRoomStayIdOrderByIssuedAtDesc(roomStayId: UUID): List<IssuedCard>
|
||||||
fun findByIdAndPropertyId(id: UUID, propertyId: UUID): IssuedCard?
|
fun findByIdAndPropertyId(id: UUID, propertyId: UUID): IssuedCard?
|
||||||
fun findByCardIdIgnoreCaseAndPropertyId(cardId: String, propertyId: UUID): IssuedCard?
|
fun findByCardIdIgnoreCaseAndPropertyId(cardId: String, propertyId: UUID): IssuedCard?
|
||||||
|
fun findAllByCardIdIgnoreCaseAndPropertyId(cardId: String, propertyId: UUID): List<IssuedCard>
|
||||||
|
|
||||||
@org.springframework.data.jpa.repository.Query("""
|
@org.springframework.data.jpa.repository.Query("""
|
||||||
select case when count(c) > 0 then true else false end
|
select case when count(c) > 0 then true else false end
|
||||||
|
|||||||
Reference in New Issue
Block a user