use sqlx::PgPool;

use crate::{error::Result, models::User};


pub async fn list(pool: &PgPool) -> Result<Vec<User>> {
    let users = sqlx::query_as!(
        User,
        "SELECT id, username, email, name, avatar_url, role, verified, created_at, updated_at FROM users ORDER BY username"
    )
    .fetch_all(pool)
    .await?;

    Ok(users)
}
