hosted_project.rs

 1use crate::db::{ChannelId, ChannelVisibility, HostedProjectId};
 2use sea_orm::entity::prelude::*;
 3
 4#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
 5#[sea_orm(table_name = "hosted_projects")]
 6pub struct Model {
 7    #[sea_orm(primary_key)]
 8    pub id: HostedProjectId,
 9    pub channel_id: ChannelId,
10    pub name: String,
11    pub visibility: ChannelVisibility,
12    pub deleted_at: Option<DateTime>,
13}
14
15impl ActiveModelBehavior for ActiveModel {}
16
17#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
18pub enum Relation {
19    #[sea_orm(has_one = "super::project::Entity")]
20    Project,
21}
22
23impl Related<super::project::Entity> for Entity {
24    fn to() -> RelationDef {
25        Relation::Project.def()
26    }
27}