use actix_web::{HttpResponse, 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};
const OPENAPI_YAML: &str = include_str!("../../openapi.yaml");
const OPENAPI_WSS_YAML: &str = include_str!("../../openapi-wss.yaml");
#[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() -> impl Responder {
HttpResponse::Ok()
.content_type("application/yaml; charset=utf-8")
.body(OPENAPI_YAML)
}
#[get("/openapi-wss.yaml")]
pub async fn athena_wss_openapi_host() -> impl Responder {
HttpResponse::Ok()
.content_type("application/yaml; charset=utf-8")
.body(OPENAPI_WSS_YAML)
}
#[get("/docs")]
pub async fn athena_docs() -> impl Responder {
actix_web::HttpResponse::PermanentRedirect()
.insert_header(("Location", "https://xylex.group/docs/athena"))
.finish()
}