- 4 表迁移: copilot_rules, copilot_insights, copilot_risk_snapshots, copilot_chat_logs - 4 个 SeaORM Entity 对应新表 - JSONLogic 规则引擎 (evaluate + evaluate_rules) + 5 个单元测试
30 lines
852 B
Rust
30 lines
852 B
Rust
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
|
|
#[sea_orm(table_name = "copilot_rules")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key, auto_increment = false)]
|
|
pub id: Uuid,
|
|
pub tenant_id: Uuid,
|
|
pub name: String,
|
|
pub category: String,
|
|
pub condition_expr: serde_json::Value,
|
|
pub score: i16,
|
|
pub severity: String,
|
|
pub suggestion: Option<String>,
|
|
pub enabled: bool,
|
|
pub sort_order: i32,
|
|
pub created_at: DateTimeUtc,
|
|
pub updated_at: DateTimeUtc,
|
|
pub created_by: Option<Uuid>,
|
|
pub updated_by: Option<Uuid>,
|
|
pub deleted_at: Option<DateTimeUtc>,
|
|
pub version_lock: i32,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|