project_collaborator.rs

 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: i32,
11    pub connection_epoch: Uuid,
12    pub user_id: UserId,
13    pub replica_id: ReplicaId,
14    pub is_host: bool,
15}
16
17#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
18pub enum Relation {
19    #[sea_orm(
20        belongs_to = "super::project::Entity",
21        from = "Column::ProjectId",
22        to = "super::project::Column::Id"
23    )]
24    Project,
25}
26
27impl Related<super::project::Entity> for Entity {
28    fn to() -> RelationDef {
29        Relation::Project.def()
30    }
31}
32
33impl ActiveModelBehavior for ActiveModel {}