mirror of
				https://gitlab.com/comunic/comunicapiv3
				synced 2025-11-04 01:24:04 +00:00 
			
		
		
		
	Improve code logic
This commit is contained in:
		@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user