Files
universal_web_loco_rewrite/src/models/_entities/audit_logs.rs
2026-05-17 14:13:06 +02:00

41 lines
1.2 KiB
Rust

//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.20
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(table_name = "audit_logs")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
pub admin_user_id: i32,
pub action: String,
pub target_type: Option<String>,
pub target_id: Option<Uuid>,
#[sea_orm(column_type = "JsonBinary", nullable)]
pub details: Option<Json>,
#[sea_orm(column_type = "custom(\"inet\")", nullable)]
pub ip_address: Option<String>,
#[sea_orm(column_type = "Text", nullable)]
pub user_agent: Option<String>,
pub created_at: DateTimeWithTimeZone,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::users::Entity",
from = "Column::AdminUserId",
to = "super::users::Column::Id",
on_update = "Cascade",
on_delete = "Cascade"
)]
Users,
}
impl Related<super::users::Entity> for Entity {
fn to() -> RelationDef {
Relation::Users.def()
}
}