tango_core/entities/
video.rs1use sea_orm::entity::prelude::*;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
5#[sea_orm(table_name = "videos")]
6pub struct Model {
7 #[sea_orm(primary_key, auto_increment = false)]
8 pub id: String,
9 pub channel_id: String,
10 pub title: String,
11 #[sea_orm(column_type = "Text")]
12 pub description: String,
13 pub published_at: DateTimeWithTimeZone,
14 pub thumbnail_url: String,
15 #[sea_orm(column_type = "JsonBinary", nullable)]
16 pub thumbnails: Option<serde_json::Value>,
17 pub duration_seconds: Option<i32>,
20 #[sea_orm(column_type = "JsonBinary", nullable)]
21 pub tags: Option<serde_json::Value>,
22 pub category_id: Option<String>,
23 pub view_count: Option<i64>,
24 pub like_count: Option<i64>,
25 pub comment_count: Option<i64>,
26 pub default_language: Option<String>,
27 pub live_broadcast_content: Option<String>,
28 pub source_tab: Option<String>,
31 pub stats_refreshed_at: Option<DateTimeWithTimeZone>,
32 #[sea_orm(column_type = "JsonBinary", nullable)]
41 pub subtitle_availability: Option<serde_json::Value>,
42 pub captions_available: Option<bool>,
49 pub created_at: DateTimeWithTimeZone,
50 pub updated_at: DateTimeWithTimeZone,
51 pub transcript_status: String,
52 pub chapters_status: String,
59}
60
61#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
62pub enum Relation {
63 #[sea_orm(
64 belongs_to = "super::channel::Entity",
65 from = "Column::ChannelId",
66 to = "super::channel::Column::Id"
67 )]
68 Channel,
69}
70
71impl Related<super::channel::Entity> for Entity {
72 fn to() -> RelationDef {
73 Relation::Channel.def() }
75}
76
77impl ActiveModelBehavior for ActiveModel {}