/*
    This file is part of jellything (https://codeberg.org/metamuffin/jellything)
    which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
    Copyright (C) 2026 metamuffin <metamuffin.org>
*/

pub mod import;
pub mod log;
pub mod users;

use super::error::MyResult;
use crate::request_info::RequestInfo;
use jellyui::components::admin::AdminDashboard;
use rocket::{get, response::content::RawHtml};

#[get("/admin/dashboard")]
pub async fn r_admin_dashboard(ri: RequestInfo<'_>) -> MyResult<RawHtml<String>> {
    ri.require_admin()?;

    // let mut db_debug = String::new();
    // ri.state.database.transaction(&mut |txn| {
    //     db_debug = txn.debug_info()?;
    //     Ok(())
    // })?;

    Ok(ri.respond_ui(&AdminDashboard {
        ri: &ri.render_info(),
    }))
}
