use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(table_name = "categories")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
pub name: String,
#[sea_orm(unique)]
pub slug: String,
pub description: Option<String>,
pub color: String,
pub position: i32,
/// Parent category for nesting (None = top level). Max depth is 3.
pub parent_id: Option<Uuid>,
/// Read visibility: NULL = public, 0 = any logged-in user, 1..4 = that
/// trust level or higher. Effective visibility also requires ancestors.
pub min_trust_level: Option<i32>,
/// Who may start a topic here: NULL = anyone who can read it, 0..4 =
/// that trust level or higher, 5 = staff only (see `crate::policy`).
pub topic_min_trust: Option<i32>,
/// Who may reply (and react) here; same values as `topic_min_trust`.
pub reply_min_trust: Option<i32>,
/// Reactions here at all (`crate::policy::ReactionRule`). Off keeps the
/// rows, hidden; on again brings them back.
pub reactions_enabled: bool,
/// NULL = every active reaction type; else the comma-separated keys
/// offered here.
pub reaction_keys: Option<String>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::topics::Entity")]
Topics,
}
impl Related<super::topics::Entity> for Entity {
fn to() -> RelationDef {
Relation::Topics.def()
}
}
impl ActiveModelBehavior for ActiveModel {}
neiam
/recourse
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
1.7 KiB · text
History
263b40b