jet/crates/entities/src/workspaces.rs

76 lines
2.0 KiB
Rust
Raw Normal View History

2024-01-23 12:29:19 +01:00
//! `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>,
2024-02-10 11:03:40 +01:00
#[sea_orm(unique)]
2024-01-23 12:29:19 +01:00
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 {
2024-02-10 11:03:40 +01:00
#[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,
2024-01-23 12:29:19 +01:00
#[sea_orm(
belongs_to = "super::users::Entity",
from = "Column::OwnerId",
to = "super::users::Column::Id",
on_update = "NoAction",
on_delete = "NoAction"
)]
2024-02-10 11:03:40 +01:00
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,
2024-01-23 12:29:19 +01:00
}
2024-02-10 11:03:40 +01:00
impl Related<super::file_assets::Entity> for Entity {
2024-01-23 12:29:19 +01:00
fn to() -> RelationDef {
2024-02-10 11:03:40 +01:00
Relation::FileAssets.def()
2024-01-23 12:29:19 +01:00
}
}
2024-02-10 11:03:40 +01:00
impl Related<super::project_identifiers::Entity> for Entity {
2024-01-23 12:29:19 +01:00
fn to() -> RelationDef {
2024-02-10 11:03:40 +01:00
Relation::ProjectIdentifiers.def()
2024-01-23 12:29:19 +01:00
}
}
impl ActiveModelBehavior for ActiveModel {}