feat: complete Phase 1 infrastructure
- erp-core: error types, shared types, event bus, ErpModule trait - erp-server: config loading, database/Redis connections, migrations - erp-server/migration: tenants table with SeaORM - apps/web: Vite + React 18 + TypeScript + Ant Design 5 + TailwindCSS - Web frontend: main layout with sidebar, header, routing - Docker: PostgreSQL 16 + Redis 7 development environment - All workspace crates compile successfully (cargo check passes)
This commit is contained in:
@@ -6,6 +6,7 @@ use crate::events::EventBus;
|
||||
|
||||
/// 模块注册接口
|
||||
/// 所有业务模块(Auth, Workflow, Message, Config, 行业模块)都实现此 trait
|
||||
#[async_trait::async_trait]
|
||||
pub trait ErpModule: Send + Sync {
|
||||
/// 模块名称(唯一标识)
|
||||
fn name(&self) -> &str;
|
||||
@@ -27,19 +28,13 @@ pub trait ErpModule: Send + Sync {
|
||||
fn register_event_handlers(&self, _bus: &EventBus) {}
|
||||
|
||||
/// 租户创建时的初始化钩子
|
||||
fn on_tenant_created(
|
||||
&self,
|
||||
_tenant_id: Uuid,
|
||||
) -> impl std::future::Future<Output = AppResult<()>> + Send {
|
||||
async { Ok(()) }
|
||||
async fn on_tenant_created(&self, _tenant_id: Uuid) -> AppResult<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// 租户删除时的清理钩子
|
||||
fn on_tenant_deleted(
|
||||
&self,
|
||||
_tenant_id: Uuid,
|
||||
) -> impl std::future::Future<Output = AppResult<()>> + Send {
|
||||
async { Ok(()) }
|
||||
async fn on_tenant_deleted(&self, _tenant_id: Uuid) -> AppResult<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user