fix(miniprogram+auth): 二次审计修复 — 3 HIGH + 2 MEDIUM
HIGH: - wechat_users 迁移补充 created_by/updated_by/version 标准字段 - Entity 同步更新,bind_phone 创建记录时填充新字段 - appointment create 移除 schedule_id 空字符串,改为可选 - appointment list 用 useRef 替代 useCallback 的 loading 依赖,消除 stale closure MEDIUM: - report 页 patientId 从顶层读取改为 useDidShow 内动态获取,就诊人切换后正确刷新 - profile/reports 同上修复 - profile/followups 移除 useDidShow 非法的第二参数
This commit is contained in:
@@ -14,8 +14,11 @@ pub struct Model {
|
||||
pub phone: Option<String>,
|
||||
pub created_at: DateTimeUtc,
|
||||
pub updated_at: DateTimeUtc,
|
||||
pub created_by: Option<Uuid>,
|
||||
pub updated_by: Option<Uuid>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub deleted_at: Option<DateTimeUtc>,
|
||||
pub version: i32,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
|
||||
@@ -105,7 +105,10 @@ impl WechatService {
|
||||
phone: Set(Some(phone)),
|
||||
created_at: Set(now),
|
||||
updated_at: Set(now),
|
||||
created_by: Set(Some(user_id)),
|
||||
updated_by: Set(Some(user_id)),
|
||||
deleted_at: Set(None),
|
||||
version: Set(1),
|
||||
};
|
||||
wu.insert(&state.db)
|
||||
.await
|
||||
|
||||
@@ -29,10 +29,13 @@ impl MigrationTrait for Migration {
|
||||
.not_null()
|
||||
.default(Expr::current_timestamp()),
|
||||
)
|
||||
.col(ColumnDef::new(WechatUsers::CreatedBy).uuid())
|
||||
.col(ColumnDef::new(WechatUsers::UpdatedBy).uuid())
|
||||
.col(
|
||||
ColumnDef::new(WechatUsers::DeletedAt)
|
||||
.timestamp_with_time_zone(),
|
||||
)
|
||||
.col(ColumnDef::new(WechatUsers::Version).integer().not_null().default(1))
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
@@ -72,4 +75,7 @@ enum WechatUsers {
|
||||
CreatedAt,
|
||||
UpdatedAt,
|
||||
DeletedAt,
|
||||
CreatedBy,
|
||||
UpdatedBy,
|
||||
Version,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user