[+] User info endpoint

pull/122/head
Azalea 2025-03-03 18:08:21 -05:00
parent d5be354a84
commit a105871a98
1 changed files with 6 additions and 1 deletions

View File

@ -165,6 +165,11 @@ class UserRegistrar(
@Doc("Get the information of the current logged-in user.", "User information") @Doc("Get the information of the current logged-in user.", "User information")
suspend fun getUser(@RP token: Str) = jwt.auth(token) suspend fun getUser(@RP token: Str) = jwt.auth(token)
@API("/user-info")
@Doc("Get the information of a user by username.", "User information")
fun getUserInfo(@RP username: Str) =
userRepo.findByUsernameIgnoreCase(username)?.publicFields ?: (404 - "User not found")
@API("/setting") @API("/setting")
@Doc("Validate and set a user setting field.", "Success message") @Doc("Validate and set a user setting field.", "Success message")
suspend fun setting(@RP token: Str, @RP key: Str, @RP value: Str) = jwt.auth(token) { u -> suspend fun setting(@RP token: Str, @RP key: Str, @RP value: Str) = jwt.auth(token) { u ->