use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "playlists")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
pub channel_id: String,
pub title: String,
#[sea_orm(column_type = "Text")]
pub description: String,
pub published_at: DateTimeWithTimeZone,
pub thumbnail_url: String,
#[sea_orm(column_type = "JsonBinary", nullable)]
pub thumbnails: Option<serde_json::Value>,
pub item_count: Option<i64>,
pub privacy_status: Option<String>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::channel::Entity",
from = "Column::ChannelId",
to = "super::channel::Column::Id"
)]
Channel,
}
impl Related<super::channel::Entity> for Entity {
fn to() -> RelationDef {
Relation::Channel.def()
}
}
impl ActiveModelBehavior for ActiveModel {}