1use super::{ProjectCollaboratorId, ProjectId, ReplicaId, UserId};
2use sea_orm::entity::prelude::*;
3
4#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
5#[sea_orm(table_name = "project_collaborators")]
6pub struct Model {
7 #[sea_orm(primary_key)]
8 pub id: ProjectCollaboratorId,
9 pub project_id: ProjectId,
10 pub connection_id: u32,
11 pub user_id: UserId,
12 pub replica_id: ReplicaId,
13 pub is_host: bool,
14}
15
16#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
17pub enum Relation {
18 #[sea_orm(
19 belongs_to = "super::project::Entity",
20 from = "Column::ProjectId",
21 to = "super::project::Column::Id"
22 )]
23 Project,
24}
25
26impl Related<super::project::Entity> for Entity {
27 fn to() -> RelationDef {
28 Relation::Project.def()
29 }
30}
31
32impl ActiveModelBehavior for ActiveModel {}