987 B · text History 3d71adc
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

/// One staff action (or an automatic one, `source = system`).
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(table_name = "moderation_log")]
pub struct Model {
    #[sea_orm(primary_key, auto_increment = false)]
    pub id: Uuid,
    /// The staff member (None for the CLI without `--by`, the system, or a
    /// since-deleted account).
    pub actor_id: Option<Uuid>,
    /// `web`, `api`, `cli` or `system`.
    pub source: String,
    pub action: String,
    /// `post`, `topic`, `user` or `category`.
    pub target_kind: String,
    pub target_id: Option<Uuid>,
    /// What the target was called when it happened ("@alice", a title).
    pub target_label: String,
    pub reason: Option<String>,
    pub created_at: DateTimeWithTimeZone,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}

impl ActiveModelBehavior for ActiveModel {}