fix: complete incomplete use statement and implement API router with all endpoints

Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-12 14:32:57 -03:00
parent 703ae3b776
commit e67d7ba98f

View File

@@ -3,4 +3,26 @@ use axum::{
Router, Router,
}; };
use use crate::modes::server::common::AppState;
use crate::modes::server::api::{
item, status, docs
};
pub fn api_router() -> Router<AppState> {
Router::new()
// Status endpoints
.route("/api/status", get(status::handle_status))
// Item endpoints
.route("/api/item/", get(item::handle_list_items).post(item::handle_post_item))
.route("/api/item/latest", get(item::handle_get_item_latest))
.route("/api/item/latest/meta", get(item::handle_get_item_latest_meta))
.route("/api/item/latest/content", get(item::handle_get_content_latest).get(item::handle_get_content_latest_raw))
.route("/api/item/:id", get(item::handle_get_item).delete(item::handle_delete_item))
.route("/api/item/:id/meta", get(item::handle_get_item_meta))
.route("/api/item/:id/content", get(item::handle_get_content).get(item::handle_get_content_raw))
// Documentation endpoints
.route("/api/openapi.json", get(docs::handle_openapi))
.route("/api/docs", get(docs::handle_swagger_ui))
}