feat(industry): Phase 1 行业配置基础 — 数据模型 + 四行业内置配置 + ButlerRouter 动态关键词
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- 新增 SaaS industry 模块 (types/service/handlers/mod/builtin) - 4 行业内置配置: healthcare/education/garment/ecommerce - 数据库迁移: industries + account_industries 表 - 8 个 API 端点 (CRUD + 用户行业关联) - ButlerRouter 改造: 支持 IndustryKeywordConfig 动态注入 - 12 个测试全通过 (含动态行业分类测试)
This commit is contained in:
@@ -5,7 +5,7 @@ use sqlx::PgPool;
|
||||
use crate::config::DatabaseConfig;
|
||||
use crate::error::SaasResult;
|
||||
|
||||
const SCHEMA_VERSION: i32 = 14;
|
||||
const SCHEMA_VERSION: i32 = 15;
|
||||
|
||||
/// 初始化数据库
|
||||
pub async fn init_db(config: &DatabaseConfig) -> SaasResult<PgPool> {
|
||||
@@ -42,6 +42,7 @@ pub async fn init_db(config: &DatabaseConfig) -> SaasResult<PgPool> {
|
||||
ensure_security_columns(&pool).await?;
|
||||
seed_admin_account(&pool).await?;
|
||||
seed_builtin_prompts(&pool).await?;
|
||||
seed_builtin_industries(&pool).await?;
|
||||
seed_demo_data(&pool).await?;
|
||||
fix_seed_data(&pool).await?;
|
||||
tracing::info!("Database initialized (schema v{})", SCHEMA_VERSION);
|
||||
@@ -998,6 +999,11 @@ async fn ensure_security_columns(pool: &PgPool) -> SaasResult<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// 种子化内置行业配置
|
||||
async fn seed_builtin_industries(pool: &PgPool) -> SaasResult<()> {
|
||||
crate::industry::service::seed_builtin_industries(pool).await
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
// PostgreSQL 单元测试需要真实数据库连接,此处保留接口兼容
|
||||
|
||||
Reference in New Issue
Block a user