fix: query actual number of accounts

This commit is contained in:
Radical 2025-04-30 11:10:25 +00:00
parent 1f897deb33
commit 0f1824b366

View file

@ -17,9 +17,16 @@ struct Response {
#[get("/stats")]
pub async fn res(data: web::Data<Data>) -> impl Responder {
let accounts;
if let Ok(users) = sqlx::query("SELECT uuid FROM users").fetch_all(&data.pool).await {
accounts = users.len();
} else {
return HttpResponse::InternalServerError().finish()
}
let response = Response {
// TODO: Get number of accounts from db
accounts: 0,
accounts,
uptime: SystemTime::now()
.duration_since(data.start_time)
.expect("Seriously why dont you have time??")