Skip to main content

tango_core/entities/
transcript.rs

1use sea_orm::entity::prelude::*;
2use serde::{Deserialize, Serialize};
3
4/// Per-cue transcript rows: the click-to-seek half.
5///
6/// Deliberately *not* deduplicated. Rolling ASR captions repeat the same
7/// phrase across consecutive cues, and keeping that repetition is what lets
8/// every search hit map to an exact `start_ms`. The deduplicated prose lives in
9/// `video_transcript_documents` instead.
10#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
11#[sea_orm(table_name = "video_transcripts")]
12pub struct Model {
13    #[sea_orm(primary_key, auto_increment = false)]
14    pub video_id: String,
15    #[sea_orm(primary_key, auto_increment = false)]
16    pub lang: String,
17    /// 'manual' or 'auto'. Part of the key, so a video can carry both.
18    #[sea_orm(primary_key, auto_increment = false)]
19    pub source: String,
20    #[sea_orm(primary_key, auto_increment = false)]
21    pub cue_index: i32,
22    pub start_ms: i32,
23    pub end_ms: i32,
24    pub content: String,
25    /// `GENERATED ALWAYS AS to_tsvector(...) STORED`, so PostgreSQL maintains
26    /// it and it must never appear in an insert.
27    #[sea_orm(ignore)]
28    pub tsv: String,
29    pub updated_at: DateTimeWithTimeZone,
30}
31
32#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
33pub enum Relation {}
34
35impl ActiveModelBehavior for ActiveModel {}