mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-01-08 11:42:35 +00:00
14 lines
542 B
Rust
14 lines
542 B
Rust
|
//! # 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))
|
||
|
}
|