Files
AstralRinth/src/models/reports.rs
Geometrically 8f61e9876f Add report + moderation messaging (#567)
* Add report + moderation messaging

* Add system messages

* address review comments

* Remove ds store

* Update messaging

* run prep

---------

Co-authored-by: Geometrically <geometrically@Jais-MacBook-Pro.local>
2023-04-12 17:59:43 -07:00

43 lines
1004 B
Rust

use super::ids::Base62Id;
use crate::models::ids::{ThreadId, UserId};
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(from = "Base62Id")]
#[serde(into = "Base62Id")]
pub struct ReportId(pub u64);
#[derive(Serialize, Deserialize)]
pub struct Report {
pub id: ReportId,
pub report_type: String,
pub item_id: String,
pub item_type: ItemType,
pub reporter: UserId,
pub body: String,
pub created: DateTime<Utc>,
pub closed: bool,
pub thread_id: Option<ThreadId>,
}
#[derive(Serialize, Deserialize, Clone)]
#[serde(rename_all = "kebab-case")]
pub enum ItemType {
Project,
Version,
User,
Unknown,
}
impl ItemType {
pub fn as_str(&self) -> &'static str {
match self {
ItemType::Project => "project",
ItemType::Version => "version",
ItemType::User => "user",
ItemType::Unknown => "unknown",
}
}
}