1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-20 16:35:17 +00:00

Improve code logic

This commit is contained in:
2020-07-11 13:57:20 +02:00
parent cf549f973c
commit b133827c61
2 changed files with 19 additions and 13 deletions

View File

@ -47,6 +47,13 @@ pub fn get_list_unread(user_id: &UserID) -> ResultBoxError<Vec<Notification>> {
.exec(db_to_notif)
}
/// Get information about a single notification
pub fn get_single(notif_id: u64) -> ResultBoxError<Notification> {
database::QueryInfo::new(NOTIFICATIONS_TABLE)
.cond_u64("id", notif_id)
.query_row(db_to_notif)
}
/// Turn a database row into a notification object
fn db_to_notif(row: &database::RowResult) -> ResultBoxError<Notification> {
Ok(Notification {