1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-01-08 11:42:35 +00:00
comunicapiv3/src/controllers/notifications_controller.rs

14 lines
542 B
Rust
Raw Normal View History

//! # 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))
}