Files
nj/crates/erp-diary/src/entity/parent_child_binding.rs
iven 3d9896a676 feat(diary): 添加 15 个 SeaORM 实体和数据库迁移 (Phase B1)
实体:
- 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 个测试全通过
2026-05-31 22:29:56 +08:00

36 lines
1.1 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 家长-孩子绑定 — 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 {}