[+] Get user games endpoint

pull/23/head
Azalea 2024-03-14 21:47:14 -04:00
parent 8342acbd49
commit 71d7fcbe65
1 changed files with 5 additions and 1 deletions

View File

@ -38,6 +38,10 @@ class CardController(
)
}
@API("/user-games")
@Doc("Get the game summary of the user, including the user's name, rating, and last login date.", "Summary of the user")
suspend fun userGames(@RP username: Str) = us.cardByName(username) { card -> cardGameService.getSummary(card) }
/**
* Bind a card to the user. This action will migrate selected data from the card to the user's ghost card.
*
@ -100,7 +104,7 @@ class CardController(
@API("/default-game")
@Doc("Get the default game for the card.", "Game ID")
suspend fun defaultGame(@RP username: Str) = us.cardByName(username) { card ->
cardGameService.getSummary(card).filterValues { it != null }.keys.firstOrNull()
mapOf("game" to cardGameService.getSummary(card).filterValues { it != null }.keys.firstOrNull())
}
}