76 lines
2.0 KiB
Rust
76 lines
2.0 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 = "workspaces")]
|
|
pub struct Model {
|
|
pub created_at: DateTimeWithTimeZone,
|
|
pub updated_at: DateTimeWithTimeZone,
|
|
#[sea_orm(primary_key, auto_increment = false)]
|
|
pub id: Uuid,
|
|
pub name: String,
|
|
pub logo: Option<String>,
|
|
#[sea_orm(unique)]
|
|
pub slug: String,
|
|
pub created_by_id: Option<Uuid>,
|
|
pub owner_id: Uuid,
|
|
pub updated_by_id: Option<Uuid>,
|
|
pub organization_size: Option<String>,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(has_many = "super::file_assets::Entity")]
|
|
FileAssets,
|
|
#[sea_orm(has_many = "super::project_identifiers::Entity")]
|
|
ProjectIdentifiers,
|
|
#[sea_orm(
|
|
belongs_to = "super::users::Entity",
|
|
from = "Column::CreatedById",
|
|
to = "super::users::Column::Id",
|
|
on_update = "NoAction",
|
|
on_delete = "NoAction"
|
|
)]
|
|
Users4,
|
|
#[sea_orm(
|
|
belongs_to = "super::users::Entity",
|
|
from = "Column::OwnerId",
|
|
to = "super::users::Column::Id",
|
|
on_update = "NoAction",
|
|
on_delete = "NoAction"
|
|
)]
|
|
Users3,
|
|
#[sea_orm(
|
|
belongs_to = "super::users::Entity",
|
|
from = "Column::UpdatedById",
|
|
to = "super::users::Column::Id",
|
|
on_update = "NoAction",
|
|
on_delete = "NoAction"
|
|
)]
|
|
Users2,
|
|
#[sea_orm(
|
|
belongs_to = "super::users::Entity",
|
|
from = "Column::OwnerId",
|
|
to = "super::users::Column::Id",
|
|
on_update = "NoAction",
|
|
on_delete = "NoAction"
|
|
)]
|
|
Users1,
|
|
}
|
|
|
|
impl Related<super::file_assets::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::FileAssets.def()
|
|
}
|
|
}
|
|
|
|
impl Related<super::project_identifiers::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::ProjectIdentifiers.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|