mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-12 03:07:59 +08:00
[+] Backend card linking
This commit is contained in:
@@ -33,10 +33,17 @@ 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> = 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
|
* Register a new card with access code
|
||||||
|
|||||||
Reference in New Issue
Block a user