mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-05 02:57:59 +08:00
[F] Card access time is not correctly set (#120)
This commit is contained in:
@@ -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
|
||||
cardService.cardRepo.save(it.apply { accessTime = LocalDateTime.now() }).extId
|
||||
cardService.cardRepo.save(card.apply { accessTime = LocalDateTime.now() }).let {
|
||||
it.aquaUser?.ghostCard ?: it
|
||||
}?.extId
|
||||
} ?: -1
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,15 +34,11 @@ class CardService(val cardRepo: CardRepository)
|
||||
/**
|
||||
* 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
|
||||
* @return Optional of a Card
|
||||
*/
|
||||
fun getCardByAccessCode(accessCode: String?): Optional<Card> = Optional.ofNullable(
|
||||
cardRepo.findByLuid(accessCode).getOrNull()?.let {
|
||||
it.aquaUser?.ghostCard ?: it
|
||||
}
|
||||
cardRepo.findByLuid(accessCode).getOrNull()
|
||||
)
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user