mirror of https://github.com/hykilpikonna/AquaDX
[F] Card access time is not correctly set (#120)
parent
5caeaccec8
commit
3da92de951
|
@ -115,9 +115,11 @@ class AimeDB(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCard(accessCode: String) = cardService.getCardByAccessCode(accessCode).getOrNull()?.let {
|
fun getCard(accessCode: String) = cardService.getCardByAccessCode(accessCode).getOrNull()?.let { card ->
|
||||||
// Update card access time
|
// Update card access time
|
||||||
cardService.cardRepo.save(it.apply { accessTime = LocalDateTime.now() }).extId
|
cardService.cardRepo.save(card.apply { accessTime = LocalDateTime.now() }).let {
|
||||||
|
it.aquaUser?.ghostCard ?: it
|
||||||
|
}?.extId
|
||||||
} ?: -1
|
} ?: -1
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -34,15 +34,11 @@ class CardService(val cardRepo: CardRepository)
|
||||||
/**
|
/**
|
||||||
* Find a card by its access code
|
* Find a card by its access code
|
||||||
*
|
*
|
||||||
* If the card is linked to a user, return the user's ghost card instead
|
|
||||||
*
|
|
||||||
* @param accessCode String represent of an access code
|
* @param accessCode String represent of an access code
|
||||||
* @return Optional of a Card
|
* @return Optional of a Card
|
||||||
*/
|
*/
|
||||||
fun getCardByAccessCode(accessCode: String?): Optional<Card> = Optional.ofNullable(
|
fun getCardByAccessCode(accessCode: String?): Optional<Card> = Optional.ofNullable(
|
||||||
cardRepo.findByLuid(accessCode).getOrNull()?.let {
|
cardRepo.findByLuid(accessCode).getOrNull()
|
||||||
it.aquaUser?.ghostCard ?: it
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue