fix: user notification/request counts

This commit is contained in:
trisua 2025-07-26 22:28:45 -04:00
parent 29155ddb0c
commit 46e38042ce
4 changed files with 46 additions and 15 deletions

View file

@ -17,11 +17,19 @@ pub struct Letter {
/// This field can be updated by anyone in the letter's `receivers` field.
/// Other fields in the letter can only be updated by the letter's `owner`.
pub read_by: Vec<usize>,
/// The ID of the letter this letter is replying to.
pub replying_to: usize,
}
impl Letter {
/// Create a new [`Letter`].
pub fn new(owner: usize, receivers: Vec<usize>, subject: String, content: String) -> Self {
pub fn new(
owner: usize,
receivers: Vec<usize>,
subject: String,
content: String,
replying_to: usize,
) -> Self {
Self {
id: Snowflake::new().to_string().parse::<usize>().unwrap(),
created: unix_epoch_timestamp(),
@ -30,6 +38,7 @@ impl Letter {
subject,
content,
read_by: Vec::new(),
replying_to,
}
}
}