tango-core 0.3.0

The tango schema, entities, migrations, and search contract
Documentation
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

/// One chapter of one video, as yt-dlp reported it.
///
/// `chapter_index` is the position in the video after the chapters are sorted by
/// start time and renumbered, so it is contiguous from zero and the primary key
/// `(video_id, chapter_index)` is stable for a given payload. A re-fetch is a
/// replacement, not a merge: YouTube can re-cut a video's chapters, and stale
/// rows from the old list would otherwise linger.
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "video_chapters")]
pub struct Model {
    #[sea_orm(primary_key, auto_increment = false)]
    pub video_id: String,
    #[sea_orm(primary_key, auto_increment = false)]
    pub chapter_index: i32,
    pub start_ms: i32,
    pub end_ms: i32,
    pub title: String,
    pub updated_at: DateTimeWithTimeZone,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}

impl ActiveModelBehavior for ActiveModel {}