refactor: 积分系统拆分为独立 erp-points crate
Some checks failed
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
CI / security-audit (push) Has been cancelled

- 新建 erp-points crate(8 Entity + account/product service + handler)
- 商品 CRUD 和账户管理完整实现,订单/签到/规则端点暂返回 501
- 注册到 workspace + erp-server 路由 /api/v1/points/*
- API 路径不变,前端无需修改
This commit is contained in:
iven
2026-04-28 14:32:16 +08:00
parent fa9278590d
commit ac1033dbaf
18 changed files with 1036 additions and 104 deletions

View File

@@ -349,6 +349,14 @@ async fn main() -> anyhow::Result<()> {
"AI module initialized"
);
// Initialize points module
let points_module = erp_points::PointsModule;
tracing::info!(
module = points_module.name(),
version = points_module.version(),
"Points module initialized"
);
// Initialize module registry and register modules
let registry = ModuleRegistry::new()
.register(auth_module)
@@ -356,7 +364,8 @@ async fn main() -> anyhow::Result<()> {
.register(workflow_module)
.register(message_module)
.register(health_module)
.register(ai_module);
.register(ai_module)
.register(points_module);
tracing::info!(
module_count = registry.modules().len(),
"Modules registered"
@@ -535,6 +544,7 @@ async fn main() -> anyhow::Result<()> {
.merge(erp_plugin::module::PluginModule::protected_routes())
.merge(erp_health::HealthModule::protected_routes())
.merge(erp_ai::AiModule::protected_routes())
.merge(erp_points::PointsModule::protected_routes())
.merge(handlers::audit_log::audit_log_router())
.route(
"/upload",

View File

@@ -122,3 +122,13 @@ impl FromRef<AppState> for erp_ai::AiState {
state.ai_state.clone()
}
}
/// Allow erp-points handlers to extract their required state.
impl FromRef<AppState> for erp_points::PointsState {
fn from_ref(state: &AppState) -> Self {
Self {
db: state.db.clone(),
event_bus: state.event_bus.clone(),
}
}
}