add: notifications table

add: query_rows macro
fix: postgres driver
This commit is contained in:
trisua 2025-03-25 18:18:33 -04:00
parent 0ea6b25138
commit 81005a6e1c
14 changed files with 258 additions and 33 deletions

View file

@ -72,3 +72,28 @@ impl User {
self.password == hash_salted(against, self.salt.clone())
}
}
#[derive(Debug, Serialize)]
pub struct Notification {
pub id: usize,
pub created: usize,
pub title: String,
pub content: String,
pub owner: usize,
}
impl Notification {
/// Returns a new [`Notification`].
pub fn new(title: String, content: String, owner: usize) -> Self {
Self {
id: AlmostSnowflake::new(1234567890)
.to_string()
.parse::<usize>()
.unwrap(),
created: unix_epoch_timestamp() as usize,
title,
content,
owner,
}
}
}