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}
19
20impl Related<super::room_participant::Entity> for Entity {
21    fn to() -> RelationDef {
22        Relation::RoomParticipant.def()
23    }
24}
25
26impl Related<super::project::Entity> for Entity {
27    fn to() -> RelationDef {
28        Relation::Project.def()
29    }
30}
31
32impl ActiveModelBehavior for ActiveModel {}