room_participant.rs

 1use super::{ProjectId, RoomId, RoomParticipantId, UserId};
 2use sea_orm::entity::prelude::*;
 3
 4#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
 5#[sea_orm(table_name = "room_participants")]
 6pub struct Model {
 7    #[sea_orm(primary_key)]
 8    pub id: RoomParticipantId,
 9    pub room_id: RoomId,
10    pub user_id: UserId,
11    pub answering_connection_id: Option<i32>,
12    pub answering_connection_epoch: Option<Uuid>,
13    pub location_kind: Option<i32>,
14    pub location_project_id: Option<ProjectId>,
15    pub initial_project_id: Option<ProjectId>,
16    pub calling_user_id: UserId,
17    pub calling_connection_id: i32,
18    pub calling_connection_epoch: Uuid,
19}
20
21#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
22pub enum Relation {
23    #[sea_orm(
24        belongs_to = "super::user::Entity",
25        from = "Column::UserId",
26        to = "super::user::Column::Id"
27    )]
28    User,
29    #[sea_orm(
30        belongs_to = "super::room::Entity",
31        from = "Column::RoomId",
32        to = "super::room::Column::Id"
33    )]
34    Room,
35}
36
37impl Related<super::user::Entity> for Entity {
38    fn to() -> RelationDef {
39        Relation::User.def()
40    }
41}
42
43impl Related<super::room::Entity> for Entity {
44    fn to() -> RelationDef {
45        Relation::Room.def()
46    }
47}
48
49impl ActiveModelBehavior for ActiveModel {}