gitdataai/libs/models/rooms/room_category.rs
2026-04-14 19:02:01 +08:00

31 lines
806 B
Rust

use crate::{DateTimeUtc, ProjectId, RoomCategoryId, UserId};
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "room_category")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: RoomCategoryId,
#[sea_orm(column_name = "project_uuid")]
pub project: ProjectId,
pub name: String,
pub position: i32,
pub created_by: UserId,
pub created_at: DateTimeUtc,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::room::Entity")]
Rooms,
}
impl Related<super::room::Entity> for Entity {
fn to() -> RelationDef {
Relation::Rooms.def()
}
}
impl ActiveModelBehavior for ActiveModel {}