feat: 保存视频标签,设置 video 和 page 的关系

This commit is contained in:
amtoaer
2024-03-28 19:52:41 +08:00
parent 79bbc9e4b6
commit 74396b9d1b
4 changed files with 37 additions and 3 deletions

View File

@@ -19,6 +19,19 @@ pub struct Model {
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}
pub enum Relation {
#[sea_orm(
belongs_to = "super::video::Entity",
from = "Column::VideoId",
to = "super::video::Column::Id"
)]
Video,
}
impl Related<super::video::Entity> for Entity {
fn to() -> RelationDef {
Relation::Video.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@@ -22,12 +22,21 @@ pub struct Model {
pub favtime: DateTime,
pub handled: bool,
pub valid: bool,
pub tags: Option<String>,
pub tags: Option<serde_json::Value>,
pub single_page: Option<bool>,
pub created_at: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}
pub enum Relation {
#[sea_orm(has_many = "super::page::Entity")]
Page,
}
impl Related<super::page::Entity> for Entity {
fn to() -> RelationDef {
Relation::Page.def()
}
}
impl ActiveModelBehavior for ActiveModel {}