tango_core/entities/
playlist.rs1use sea_orm::entity::prelude::*;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
5#[sea_orm(table_name = "playlists")]
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 item_count: Option<i64>,
18 pub privacy_status: Option<String>,
19 pub created_at: DateTimeWithTimeZone,
20 pub updated_at: DateTimeWithTimeZone,
21}
22
23#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
24pub enum Relation {
25 #[sea_orm(
26 belongs_to = "super::channel::Entity",
27 from = "Column::ChannelId",
28 to = "super::channel::Column::Id"
29 )]
30 Channel,
31}
32
33impl Related<super::channel::Entity> for Entity {
34 fn to() -> RelationDef {
35 Relation::Channel.def()
36 }
37}
38
39impl ActiveModelBehavior for ActiveModel {}