Files
oxspeak_server/src/models/role_user.rs
T
2026-07-13 09:27:07 +02:00

32 lines
769 B
Rust

//! `SeaORM` Entity.
use sea_orm::entity::prelude::*;
#[sea_orm::model]
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "role_user")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub role_id: Uuid,
#[sea_orm(primary_key, auto_increment = false)]
pub user_id: Uuid,
#[sea_orm(
belongs_to,
from = "role_id",
to = "id",
on_update = "NoAction",
on_delete = "Cascade"
)]
pub role: HasOne<super::role::Entity>,
#[sea_orm(
belongs_to,
from = "user_id",
to = "id",
on_update = "NoAction",
on_delete = "Cascade"
)]
pub user: HasOne<super::user::Entity>,
}
impl ActiveModelBehavior for ActiveModel {}