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:
14
src/controllers/notifications_controller.rs
Normal file
14
src/controllers/notifications_controller.rs
Normal 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))
|
||||
}
|
Reference in New Issue
Block a user