mirror of https://github.com/hykilpikonna/AquaDX
[+] Backend card linking
parent
1d4e1a8be2
commit
eccdd73908
|
@ -33,10 +33,17 @@ 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> = cardRepo.findByLuid(accessCode)
|
||||
fun getCardByAccessCode(accessCode: String?): Optional<Card> = Optional.ofNullable(
|
||||
cardRepo.findByLuid(accessCode).getOrNull()?.let {
|
||||
it.aquaUser?.ghostCard ?: it
|
||||
}
|
||||
)
|
||||
|
||||
/**
|
||||
* Register a new card with access code
|
||||
|
|
Loading…
Reference in New Issue