- 迁移 m000065/m000066: 添加 key_version 列 - consultation_message: content 加密写入 + 解密读取 - follow_up_record: result/patient_condition/medical_advice 加密 - Entity: 添加 key_version 字段
46 lines
1.3 KiB
Rust
46 lines
1.3 KiB
Rust
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
|
|
#[sea_orm(table_name = "consultation_message")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key, auto_increment = false)]
|
|
pub id: Uuid,
|
|
pub tenant_id: Uuid,
|
|
pub session_id: Uuid,
|
|
pub sender_id: Uuid,
|
|
pub sender_role: String,
|
|
pub content_type: String,
|
|
pub content: String,
|
|
pub is_read: bool,
|
|
pub created_at: DateTimeUtc,
|
|
pub updated_at: DateTimeUtc,
|
|
#[sea_orm(skip_serializing_if = "Option::is_none")]
|
|
pub created_by: Option<Uuid>,
|
|
#[sea_orm(skip_serializing_if = "Option::is_none")]
|
|
pub updated_by: Option<Uuid>,
|
|
#[sea_orm(skip_serializing_if = "Option::is_none")]
|
|
pub deleted_at: Option<DateTimeUtc>,
|
|
pub version: i32,
|
|
#[sea_orm(skip_serializing_if = "Option::is_none")]
|
|
pub key_version: Option<i32>,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(
|
|
belongs_to = "super::consultation_session::Entity",
|
|
from = "Column::SessionId",
|
|
to = "super::consultation_session::Column::Id"
|
|
)]
|
|
Session,
|
|
}
|
|
|
|
impl Related<super::consultation_session::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Session.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|