use sea_orm::entity::prelude::*; #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] #[sea_orm(table_name = "folder")] pub struct Model { #[sea_orm(primary_key)] pub id: i32, pub name: String, #[sea_orm(unique)] pub path: String, pub git_branch: Option, pub default_agent_type: Option, pub last_opened_at: DateTimeUtc, pub created_at: DateTimeUtc, pub updated_at: DateTimeUtc, pub deleted_at: Option, pub is_open: bool, pub sort_order: i32, } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation { #[sea_orm(has_many = "super::conversation::Entity")] Conversations, #[sea_orm(has_many = "super::opened_tab::Entity")] OpenedTabs, #[sea_orm(has_many = "super::folder_command::Entity")] FolderCommands, } impl Related for Entity { fn to() -> RelationDef { Relation::Conversations.def() } } impl Related for Entity { fn to() -> RelationDef { Relation::OpenedTabs.def() } } impl Related for Entity { fn to() -> RelationDef { Relation::FolderCommands.def() } } impl ActiveModelBehavior for ActiveModel {}