Fix joining hosted projects (#9038)

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2024-03-07 19:56:41 -07:00 committed by GitHub
parent f67abd2943
commit 866d791760
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 104 additions and 69 deletions

View file

@ -15,4 +15,13 @@ pub struct Model {
impl ActiveModelBehavior for ActiveModel {}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}
pub enum Relation {
#[sea_orm(has_one = "super::project::Entity")]
Project,
}
impl Related<super::project::Entity> for Entity {
fn to() -> RelationDef {
Relation::Project.def()
}
}

View file

@ -50,6 +50,12 @@ pub enum Relation {
Collaborators,
#[sea_orm(has_many = "super::language_server::Entity")]
LanguageServers,
#[sea_orm(
belongs_to = "super::hosted_project::Entity",
from = "Column::HostedProjectId",
to = "super::hosted_project::Column::Id"
)]
HostedProject,
}
impl Related<super::user::Entity> for Entity {
@ -82,4 +88,10 @@ impl Related<super::language_server::Entity> for Entity {
}
}
impl Related<super::hosted_project::Entity> for Entity {
fn to() -> RelationDef {
Relation::HostedProject.def()
}
}
impl ActiveModelBehavior for ActiveModel {}