add: user account warnings

This commit is contained in:
trisua 2025-04-11 22:12:43 -04:00
parent 535a854a47
commit 5995aaf31c
16 changed files with 459 additions and 1 deletions

View file

@ -351,3 +351,28 @@ impl IpBan {
}
}
}
#[derive(Serialize, Deserialize)]
pub struct UserWarning {
pub id: usize,
pub created: usize,
pub receiver: usize,
pub moderator: usize,
pub content: String,
}
impl UserWarning {
/// Create a new [`UserWarning`].
pub fn new(user: usize, moderator: usize, content: String) -> Self {
Self {
id: AlmostSnowflake::new(1234567890)
.to_string()
.parse::<usize>()
.unwrap(),
created: unix_epoch_timestamp() as usize,
receiver: user,
moderator,
content,
}
}
}