room.rs

 1use super::RoomId;
 2use sea_orm::entity::prelude::*;
 3
 4#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
 5#[sea_orm(table_name = "rooms")]
 6pub struct Model {
 7    #[sea_orm(primary_key)]
 8    pub id: RoomId,
 9    pub live_kit_room: String,
10}
11
12#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
13pub enum Relation {
14    #[sea_orm(has_many = "super::room_participant::Entity")]
15    RoomParticipant,
16    #[sea_orm(has_many = "super::project::Entity")]
17    Project,
18    #[sea_orm(has_many = "super::follower::Entity")]
19    Follower,
20}
21
22impl Related<super::room_participant::Entity> for Entity {
23    fn to() -> RelationDef {
24        Relation::RoomParticipant.def()
25    }
26}
27
28impl Related<super::project::Entity> for Entity {
29    fn to() -> RelationDef {
30        Relation::Project.def()
31    }
32}
33
34impl Related<super::follower::Entity> for Entity {
35    fn to() -> RelationDef {
36        Relation::Follower.def()
37    }
38}
39
40impl ActiveModelBehavior for ActiveModel {}