jet/crates/entities/src/github_repository_syncs.rs
2024-02-10 11:03:40 +01:00

137 lines
3.8 KiB
Rust

//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.11
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(table_name = "github_repository_syncs")]
pub struct Model {
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
#[sea_orm(column_type = "JsonBinary")]
pub credentials: Json,
pub actor_id: Uuid,
pub created_by_id: Option<Uuid>,
pub label_id: Option<Uuid>,
pub project_id: Uuid,
#[sea_orm(unique)]
pub repository_id: Uuid,
pub updated_by_id: Option<Uuid>,
pub workspace_id: Uuid,
pub workspace_integration_id: Uuid,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::github_issue_syncs::Entity")]
GithubIssueSyncs,
#[sea_orm(
belongs_to = "super::github_repositories::Entity",
from = "Column::RepositoryId",
to = "super::github_repositories::Column::Id",
on_update = "NoAction",
on_delete = "NoAction"
)]
GithubRepositories,
#[sea_orm(
belongs_to = "super::labels::Entity",
from = "Column::LabelId",
to = "super::labels::Column::Id",
on_update = "NoAction",
on_delete = "NoAction"
)]
Labels,
#[sea_orm(
belongs_to = "super::projects::Entity",
from = "Column::ProjectId",
to = "super::projects::Column::Id",
on_update = "NoAction",
on_delete = "NoAction"
)]
Projects2,
#[sea_orm(
belongs_to = "super::projects::Entity",
from = "Column::ProjectId",
to = "super::projects::Column::Id",
on_update = "NoAction",
on_delete = "NoAction"
)]
Projects1,
#[sea_orm(
belongs_to = "super::users::Entity",
from = "Column::ActorId",
to = "super::users::Column::Id",
on_update = "NoAction",
on_delete = "NoAction"
)]
Users3,
#[sea_orm(
belongs_to = "super::users::Entity",
from = "Column::CreatedById",
to = "super::users::Column::Id",
on_update = "NoAction",
on_delete = "NoAction"
)]
Users2,
#[sea_orm(
belongs_to = "super::users::Entity",
from = "Column::UpdatedById",
to = "super::users::Column::Id",
on_update = "NoAction",
on_delete = "NoAction"
)]
Users1,
#[sea_orm(
belongs_to = "super::workspace_integrations::Entity",
from = "Column::WorkspaceIntegrationId",
to = "super::workspace_integrations::Column::Id",
on_update = "NoAction",
on_delete = "NoAction"
)]
WorkspaceIntegrations,
#[sea_orm(
belongs_to = "super::workspaces::Entity",
from = "Column::WorkspaceId",
to = "super::workspaces::Column::Id",
on_update = "NoAction",
on_delete = "NoAction"
)]
Workspaces2,
#[sea_orm(
belongs_to = "super::workspaces::Entity",
from = "Column::WorkspaceId",
to = "super::workspaces::Column::Id",
on_update = "NoAction",
on_delete = "NoAction"
)]
Workspaces1,
}
impl Related<super::github_issue_syncs::Entity> for Entity {
fn to() -> RelationDef {
Relation::GithubIssueSyncs.def()
}
}
impl Related<super::github_repositories::Entity> for Entity {
fn to() -> RelationDef {
Relation::GithubRepositories.def()
}
}
impl Related<super::labels::Entity> for Entity {
fn to() -> RelationDef {
Relation::Labels.def()
}
}
impl Related<super::workspace_integrations::Entity> for Entity {
fn to() -> RelationDef {
Relation::WorkspaceIntegrations.def()
}
}
impl ActiveModelBehavior for ActiveModel {}