fix(health): 数据完整性 + 代码规范修复 — FK约束/版本类型统一/软删除过滤
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

数据完整性:
- 新增 8 个 FK 约束 (follow_up_task→appointment, points_transaction→account/rule/order,
  points_order→product/patient, offline_event_registration→event/patient)
- critical_alert/critical_alert_response version 字段 i64→i32 统一
- vital_signs_daily_service 聚合查询添加 DeletedAt.is_null() 过滤

代码规范:
- 新增 api/upload.ts 封装文件上传,ArticleEditor 改用 service 层
- 新增 messages.updateSubscription,NotificationPreferences 改用 service 层
- 修复 erp-message SSE 测试编译错误 (移除 serde_urlencoded 依赖)
This commit is contained in:
iven
2026-05-04 11:22:54 +08:00
parent 30a578ee00
commit 444dc7dd8d
11 changed files with 245 additions and 20 deletions

View File

@@ -27,7 +27,7 @@ pub struct Model {
pub updated_by: Option<Uuid>,
#[sea_orm(skip_serializing_if = "Option::is_none")]
pub deleted_at: Option<DateTimeUtc>,
pub version: i64,
pub version: i32,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]

View File

@@ -20,7 +20,7 @@ pub struct Model {
pub updated_by: Option<Uuid>,
#[sea_orm(skip_serializing_if = "Option::is_none")]
pub deleted_at: Option<DateTimeUtc>,
pub version: i64,
pub version: i32,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]

View File

@@ -18,6 +18,7 @@ pub async fn aggregate_daily(
.filter(crate::entity::vital_signs_hourly::Column::TenantId.eq(tenant_id))
.filter(crate::entity::vital_signs_hourly::Column::HourStart.gte(start_of_day))
.filter(crate::entity::vital_signs_hourly::Column::HourStart.lte(end_of_day))
.filter(crate::entity::vital_signs_hourly::Column::DeletedAt.is_null())
.all(db)
.await?;
@@ -94,6 +95,7 @@ pub async fn aggregate_daily_for_all_tenants(
let hourly_rows = crate::entity::vital_signs_hourly::Entity::find()
.filter(crate::entity::vital_signs_hourly::Column::HourStart.gte(start_of_day))
.filter(crate::entity::vital_signs_hourly::Column::HourStart.lte(end_of_day))
.filter(crate::entity::vital_signs_hourly::Column::DeletedAt.is_null())
.all(db)
.await?;