use sea_orm::entity::prelude::*; #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] #[sea_orm(table_name = "opened_tab")] pub struct Model { #[sea_orm(primary_key)] pub id: i32, pub folder_id: i32, pub conversation_id: Option, pub agent_type: String, pub position: i32, pub is_active: bool, pub is_pinned: bool, pub created_at: DateTimeUtc, pub updated_at: DateTimeUtc, } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation { #[sea_orm( belongs_to = "super::folder::Entity", from = "Column::FolderId", to = "super::folder::Column::Id" )] Folder, #[sea_orm( belongs_to = "super::conversation::Entity", from = "Column::ConversationId", to = "super::conversation::Column::Id" )] Conversation, } impl Related for Entity { fn to() -> RelationDef { Relation::Folder.def() } } impl Related for Entity { fn to() -> RelationDef { Relation::Conversation.def() } } impl ActiveModelBehavior for ActiveModel {}