use actix_files::NamedFile;
use actix_web::{Responder, get};
pub mod admin;
pub mod auth;
pub mod cache;
pub mod gateway;
pub mod headers;
pub mod health;
pub mod metrics;
pub mod pg_meta;
pub mod pipelines;
pub mod query;
pub mod registry;
pub mod response;
pub mod schema;
pub mod supabase;
use crate::data::athena_router::list_athena_router_entries;
use response::{api_ok, internal_error};
#[get("/router/registry")]
pub async fn athena_router_registry() -> impl Responder {
match list_athena_router_entries().await {
Ok(entries) => api_ok(entries),
Err(err) => internal_error("Failed to list router entries", err),
}
}
#[get("/openapi.yaml")]
pub async fn athena_openapi_host() -> actix_web::Result<NamedFile> {
NamedFile::open("openapi.yaml").map_err(|err| {
actix_web::error::ErrorInternalServerError(format!("Failed to open openapi.yaml: {}", err))
})
}
#[get("/docs")]
pub async fn athena_docs() -> impl Responder {
actix_web::HttpResponse::PermanentRedirect()
.insert_header(("Location", "https://xylex.group/docs/athena"))
.finish()
}