37 lines
1009 B
Rust
37 lines
1009 B
Rust
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19
|
|
|
|
use sea_orm::Set;
|
|
use sea_orm::entity::prelude::*;
|
|
use sea_orm::prelude::async_trait::async_trait;
|
|
|
|
#[sea_orm::model]
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
|
#[sea_orm(table_name = "server")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key, auto_increment = false)]
|
|
pub id: Uuid,
|
|
pub name: String,
|
|
pub password: Option<String>,
|
|
pub created_at: DateTimeUtc,
|
|
pub updated_at: DateTimeUtc,
|
|
pub is_default: bool,
|
|
pub owner_id: Option<Uuid>,
|
|
#[sea_orm(has_many)]
|
|
pub categories: HasMany<super::category::Entity>,
|
|
#[sea_orm(has_many)]
|
|
pub channels: HasMany<super::channel::Entity>,
|
|
#[sea_orm(has_many)]
|
|
pub server_users: HasMany<super::server_user::Entity>,
|
|
}
|
|
|
|
#[async_trait]
|
|
impl ActiveModelBehavior for ActiveModel {
|
|
fn new() -> Self {
|
|
Self {
|
|
id: Set(Uuid::new_v4()),
|
|
is_default: Set(false),
|
|
..ActiveModelTrait::default()
|
|
}
|
|
}
|
|
}
|