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 parent_branch: Option, } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation { #[sea_orm(has_many = "super::conversation::Entity")] Conversations, #[sea_orm(has_many = "super::folder_opened_conversation::Entity")] OpenedConversations, #[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::OpenedConversations.def() } } impl Related for Entity { fn to() -> RelationDef { Relation::FolderCommands.def() } } impl ActiveModelBehavior for ActiveModel {}