38 lines
942 B
Rust
38 lines
942 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 = "category")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key, auto_increment = false)]
|
|
pub id: Uuid,
|
|
pub server_id: Uuid,
|
|
pub name: String,
|
|
pub created_at: DateTimeUtc,
|
|
pub updated_at: DateTimeUtc,
|
|
#[sea_orm(has_many)]
|
|
pub channels: HasMany<super::channel::Entity>,
|
|
#[sea_orm(
|
|
belongs_to,
|
|
from = "server_id",
|
|
to = "id",
|
|
on_update = "Cascade",
|
|
on_delete = "Cascade"
|
|
)]
|
|
pub server: HasOne<super::server::Entity>,
|
|
}
|
|
|
|
#[async_trait]
|
|
impl ActiveModelBehavior for ActiveModel {
|
|
fn new() -> Self {
|
|
Self {
|
|
id: Set(Uuid::new_v4()),
|
|
..ActiveModelTrait::default()
|
|
}
|
|
}
|
|
}
|