实体: - journal_entry: 日记核心表 (心情/天气/标签/版本) - journal_element: 日记元素 (文字/图片/贴纸/手写/胶带) - handwriting_stroke: 手写笔画 (独立大字段表) - school_class: 班级 (6位码/过期控制) - class_member: 班级成员 (复合PK) - topic_assignment: 主题布置 - comment: 老师点评 - sticker_pack + sticker: 贴纸包和贴纸 - template: 日记模板 - achievement + user_achievement: 成就系统 - parent_child_binding: 家长-孩子绑定 (PIPL) - teacher_profile: 老师档案 - user_settings: 用户设置 迁移 (000170-000184): - 15 个建表迁移 + 索引 + RLS 策略 + 种子数据 - 所有表含 tenant_id 多租户隔离 - 软删除 + 乐观锁版本号 - 外键级联删除 - 暖记权限注册到基座 permissions 表 验证: cargo check 通过, 425 个测试全通过
36 lines
1.1 KiB
Rust
36 lines
1.1 KiB
Rust
// 家长-孩子绑定 — PIPL 合规:未满 14 岁必须家长授权
|
||
|
||
use sea_orm::entity::prelude::*;
|
||
use serde::{Deserialize, Serialize};
|
||
|
||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
|
||
#[sea_orm(table_name = "parent_child_bindings")]
|
||
pub struct Model {
|
||
#[sea_orm(primary_key, auto_increment = false)]
|
||
pub id: Uuid,
|
||
pub tenant_id: Uuid,
|
||
/// 家长用户 ID
|
||
pub parent_id: Uuid,
|
||
/// 孩子用户 ID
|
||
pub child_id: Uuid,
|
||
/// 验证方式(qr/sms/manual)
|
||
pub verification_method: String,
|
||
/// 验证通过时间
|
||
#[serde(skip_serializing_if = "Option::is_none")]
|
||
pub verified_at: Option<DateTimeUtc>,
|
||
/// 绑定状态(pending/verified/revoked)
|
||
pub status: String,
|
||
pub created_at: DateTimeUtc,
|
||
pub updated_at: DateTimeUtc,
|
||
pub created_by: Uuid,
|
||
pub updated_by: Uuid,
|
||
#[serde(skip_serializing_if = "Option::is_none")]
|
||
pub deleted_at: Option<DateTimeUtc>,
|
||
pub version: i32,
|
||
}
|
||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||
pub enum Relation {}
|
||
|
||
impl ActiveModelBehavior for ActiveModel {}
|