refactor(health): 拆分 module.rs 路由注册为 13 个子模块
protected_routes (800+ 行) 按业务域拆分为 routes/ 目录下 13 个文件: patient / health_data / follow_up / appointment / consultation / article / points / stats / alert / device / media / care / admin。 module.rs 从 1595 行降至 798 行,路由注册逻辑更清晰。
This commit is contained in:
109
crates/erp-health/src/routes/points.rs
Normal file
109
crates/erp-health/src/routes/points.rs
Normal file
@@ -0,0 +1,109 @@
|
||||
use axum::Router;
|
||||
|
||||
use crate::handler::points_handler;
|
||||
|
||||
pub fn routes<S>() -> Router<S>
|
||||
where
|
||||
crate::state::HealthState: axum::extract::FromRef<S>,
|
||||
S: Clone + Send + Sync + 'static,
|
||||
{
|
||||
Router::new()
|
||||
// 积分商城 — 患者端
|
||||
.route(
|
||||
"/health/points/account",
|
||||
axum::routing::get(points_handler::get_my_account),
|
||||
)
|
||||
.route(
|
||||
"/health/points/checkin",
|
||||
axum::routing::post(points_handler::daily_checkin),
|
||||
)
|
||||
.route(
|
||||
"/health/points/checkin/status",
|
||||
axum::routing::get(points_handler::get_checkin_status),
|
||||
)
|
||||
.route(
|
||||
"/health/points/transactions",
|
||||
axum::routing::get(points_handler::list_my_transactions),
|
||||
)
|
||||
.route(
|
||||
"/health/points/products",
|
||||
axum::routing::get(points_handler::list_products),
|
||||
)
|
||||
.route(
|
||||
"/health/points/products/{id}",
|
||||
axum::routing::get(points_handler::get_product),
|
||||
)
|
||||
.route(
|
||||
"/health/points/exchange",
|
||||
axum::routing::post(points_handler::exchange_product),
|
||||
)
|
||||
.route(
|
||||
"/health/points/orders",
|
||||
axum::routing::get(points_handler::list_my_orders),
|
||||
)
|
||||
// 线下活动 — 患者端
|
||||
.route(
|
||||
"/health/offline-events",
|
||||
axum::routing::get(points_handler::list_offline_events),
|
||||
)
|
||||
.route(
|
||||
"/health/offline-events/{id}/register",
|
||||
axum::routing::post(points_handler::register_event),
|
||||
)
|
||||
// 积分商城 — 管理端
|
||||
.route(
|
||||
"/health/points/verify",
|
||||
axum::routing::post(points_handler::verify_order),
|
||||
)
|
||||
.route(
|
||||
"/health/admin/points/rules",
|
||||
axum::routing::get(points_handler::list_rules).post(points_handler::create_rule),
|
||||
)
|
||||
.route(
|
||||
"/health/admin/points/rules/{id}",
|
||||
axum::routing::put(points_handler::update_rule).delete(points_handler::delete_rule),
|
||||
)
|
||||
.route(
|
||||
"/health/admin/points/products",
|
||||
axum::routing::get(points_handler::admin_list_products)
|
||||
.post(points_handler::admin_create_product),
|
||||
)
|
||||
.route(
|
||||
"/health/admin/points/products/{id}",
|
||||
axum::routing::put(points_handler::admin_update_product)
|
||||
.delete(points_handler::admin_delete_product),
|
||||
)
|
||||
.route(
|
||||
"/health/admin/points/orders",
|
||||
axum::routing::get(points_handler::admin_list_orders),
|
||||
)
|
||||
// 积分账户 — 管理端按患者查询
|
||||
.route(
|
||||
"/health/admin/points/patients/{patient_id}/account",
|
||||
axum::routing::get(points_handler::admin_get_patient_account),
|
||||
)
|
||||
.route(
|
||||
"/health/admin/points/patients/{patient_id}/transactions",
|
||||
axum::routing::get(points_handler::admin_list_patient_transactions),
|
||||
)
|
||||
// 线下活动 — 管理端
|
||||
.route(
|
||||
"/health/admin/offline-events",
|
||||
axum::routing::get(points_handler::admin_list_events)
|
||||
.post(points_handler::admin_create_event),
|
||||
)
|
||||
.route(
|
||||
"/health/admin/offline-events/{id}",
|
||||
axum::routing::put(points_handler::admin_update_event)
|
||||
.delete(points_handler::admin_delete_event),
|
||||
)
|
||||
.route(
|
||||
"/health/admin/offline-events/{id}/checkin",
|
||||
axum::routing::post(points_handler::admin_checkin_event),
|
||||
)
|
||||
// 积分统计 — 管理端
|
||||
.route(
|
||||
"/health/admin/points/statistics",
|
||||
axum::routing::get(points_handler::get_points_statistics),
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user