1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-09-25 22:29:45 +00:00

Can count the number of unread notifications

This commit is contained in:
2020-07-10 12:55:50 +02:00
parent 6b0363935e
commit 32aa7e7d1e
8 changed files with 58 additions and 3 deletions

View File

@@ -0,0 +1,14 @@
//! # Notifications controller
//!
//! @author Pierre Hubert
use crate::api_data::res_number_unread_notifications::ResNumberUnreadNotifications;
use crate::controllers::routes::RequestResult;
use crate::data::http_request_handler::HttpRequestHandler;
use crate::helpers::notifications_helper;
/// Count the number of unread notifications
pub fn count_unread(r: &mut HttpRequestHandler) -> RequestResult {
let number = notifications_helper::count_unread(r.user_id_ref()?)?;
r.set_response(ResNumberUnreadNotifications::new(number))
}