mirror of https://github.com/hykilpikonna/AquaDX
[O] Make a non-callback version of cardByName
parent
ac375abf5e
commit
daa5129f65
|
@ -130,11 +130,12 @@ class AquaUserServices(
|
|||
suspend fun <T> byName(username: Str, callback: suspend (AquaNetUser) -> T) =
|
||||
async { userRepo.findByUsernameIgnoreCase(username) }?.let { callback(it) } ?: (404 - "User not found")
|
||||
|
||||
suspend fun <T> cardByName(username: Str, callback: suspend (Card) -> T) =
|
||||
suspend fun cardByName(username: Str) =
|
||||
if (username.startsWith("user")) username.substring(4).toLongOrNull()
|
||||
?.let { cardRepo.findById(it).getOrNull() }
|
||||
?.let { callback(it) } ?: (404 - "Card not found")
|
||||
else byName(username) { callback(it.ghostCard) }
|
||||
?.let { cardRepo.findById(it).getOrNull() } ?: (404 - "Card not found")
|
||||
else byName(username) { it.ghostCard }
|
||||
|
||||
suspend fun <T> cardByName(username: Str, callback: suspend (Card) -> T) = callback(cardByName(username))
|
||||
|
||||
fun validKeychip(keychipId: Str): Bool {
|
||||
if (!allNetProps.checkKeychip) return true
|
||||
|
|
Loading…
Reference in New Issue