Fundamental_Analysis/services/tushare-provider-service/src/api.rs
Lv, Qi 5327e76aaa chore: 提交本轮 Rust 架构迁移相关改动
- docker-compose: 下线 Python backend/config-service,切换至 config-service-rs
- archive: 归档 legacy Python 目录至 archive/python/*
- services: 新增/更新 common-contracts、api-gateway、各 provider、report-generator-service、config-service-rs
- data-persistence-service: API/system 模块与模型/DTO 调整
- frontend: 更新 useApi 与 API 路由
- docs: 更新路线图并勾选光荣退役
- cleanup: 移除 data-distance-service 占位测试
2025-11-16 20:55:46 +08:00

24 lines
619 B
Rust

use axum::{routing::get, Router, extract::State};
use crate::state::AppState;
pub fn create_router(app_state: AppState) -> Router {
Router::new()
.route("/health", get(health_check))
.route("/tasks", get(get_tasks))
.with_state(app_state)
}
async fn health_check(State(_state): State<AppState>) -> &'static str {
"OK"
}
async fn get_tasks(State(state): State<AppState>) -> axum::Json<Vec<common_contracts::observability::TaskProgress>> {
let tasks = state
.tasks
.iter()
.map(|kv| kv.value().clone())
.collect::<Vec<_>>();
axum::Json(tasks)
}