fix: query actual number of accounts
This commit is contained in:
parent
1f897deb33
commit
0f1824b366
1 changed files with 8 additions and 1 deletions
|
@ -17,9 +17,16 @@ struct Response {
|
||||||
|
|
||||||
#[get("/stats")]
|
#[get("/stats")]
|
||||||
pub async fn res(data: web::Data<Data>) -> impl Responder {
|
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 {
|
let response = Response {
|
||||||
// TODO: Get number of accounts from db
|
// TODO: Get number of accounts from db
|
||||||
accounts: 0,
|
accounts,
|
||||||
uptime: SystemTime::now()
|
uptime: SystemTime::now()
|
||||||
.duration_since(data.start_time)
|
.duration_since(data.start_time)
|
||||||
.expect("Seriously why dont you have time??")
|
.expect("Seriously why dont you have time??")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue