routes.rs 29 lignes · 1093 octets
//! Default Axum router exposing the five guard admin screens.
//!
//! Returns a `Router<DatabaseConnection>` so the caller can `merge_routes`
//! it directly with the host application's main router. The admin
//! middleware shipped by `rustwarden-core` automatically gates every
//! `/admin/*` route — including the five mounted here — so no extra
//! authorization layering is required.

use axum::Router;
use axum::routing::get;
use sea_orm::DatabaseConnection;

use super::handlers;

/// Build the router for `/admin/fediverse-guard/*`.
pub fn default_routes() -> Router<DatabaseConnection> {
    Router::new()
        .route("/admin/fediverse-guard", get(handlers::dashboard))
        .route("/admin/fediverse-guard/events", get(handlers::events))
        .route("/admin/fediverse-guard/bans", get(handlers::bans))
        .route(
            "/admin/fediverse-guard/manual_ban",
            get(handlers::manual_ban_form).post(handlers::manual_ban_submit),
        )
        .route(
            "/admin/fediverse-guard/thresholds",
            get(handlers::thresholds),
        )
}