fediverse_trusted_domain.rs 33 lignes · 1137 octets
//! `fediverse_trusted_domains` SeaORM entity (RFC 0004).
//!
//! Allowlist of remote Fediverse domains explicitly trusted by the local
//! admin. Used when `app_settings.fediverse_trust_mode = "allowlist"`.

use chrono::{DateTime, Utc};
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
use uuid::Uuid;

/// `fediverse_trusted_domains` row.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, DeriveEntityModel)]
#[sea_orm(table_name = "fediverse_trusted_domains")]
pub struct Model {
    /// Primary key.
    #[sea_orm(primary_key, auto_increment = false)]
    pub id: Uuid,
    /// Bare domain name, lowercased and stripped of `www.` prefix.
    #[sea_orm(unique)]
    pub domain: String,
    /// Optional admin note (motivation for the trust).
    pub note: Option<String>,
    /// User that added the entry (NULL for bootstrap / system insertion).
    pub added_by_user_id: Option<Uuid>,
    /// Insertion timestamp.
    pub created_at: DateTime<Utc>,
}

/// SeaORM relations (none).
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}

impl ActiveModelBehavior for ActiveModel {}