Skip to main content

tdm_server_rust/sea_entity/
editor_unit.rs

1//! `SeaORM` Entity:编辑器标记单元表 `editor_unit`
2//!
3//! 页面气泡坐标与翻译/校对文本。物理上按 `episode_id` HASH 分区(分库分表预埋)。
4//! 分区表无单列主键,逻辑上以 `id` 作主键(IDENTITY 全局唯一)。
5
6use sea_orm::entity::prelude::*;
7use serde::{Deserialize, Serialize};
8
9/// `editor_unit` 行模型
10#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
11#[sea_orm(table_name = "editor_unit")]
12pub struct Model {
13    /// 单元主键,IDENTITY 生成,全局唯一
14    #[sea_orm(primary_key)]
15    pub id: i64,
16    /// 所属话数 ID,分片键(冗余存储以支持分区路由)
17    pub episode_id: i32,
18    /// 所属页面 ID(editor_page.id)
19    pub page_id: i64,
20    /// 页面内序号
21    pub unit_index: i32,
22    /// 横坐标
23    pub x_coord: f32,
24    /// 纵坐标
25    pub y_coord: f32,
26    /// 是否位于对话气泡内
27    pub in_bubble: bool,
28    /// 是否已校对
29    pub is_proofread: bool,
30    /// 翻译文本
31    pub translated_text: Option<String>,
32    /// 翻译者组员 ID
33    pub translator_id: Option<i32>,
34    /// 翻译备注
35    pub translator_comment: Option<String>,
36    /// 校对文本
37    pub proofreader_text: Option<String>,
38    /// 校对者组员 ID
39    pub proofreader_id: Option<i32>,
40    /// 校对备注
41    pub proofreader_comment: Option<String>,
42    /// 版本号
43    pub revision: i32,
44    /// 最后编辑者组员 ID
45    pub last_edited_by: Option<i32>,
46    /// 最后编辑时间(UTC TIMESTAMP,由前端负责本地化显示)
47    pub last_edited_at: Option<DateTime>,
48    /// 创建时间(UTC TIMESTAMP,由前端负责本地化显示)
49    pub created_at: DateTime,
50    /// 更新时间(UTC TIMESTAMP,由前端负责本地化显示)
51    pub updated_at: DateTime,
52}
53
54/// SeaORM 关系枚举(暂无显式关联)
55#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
56pub enum Relation {}
57
58/// 使用 SeaORM 默认 ActiveModel 行为
59impl ActiveModelBehavior for ActiveModel {}