mirror of
				https://gitlab.com/comunic/comunicapiv3
				synced 2025-11-04 01:24:04 +00:00 
			
		
		
		
	Can get the list of unread notifications
This commit is contained in:
		@@ -2,6 +2,7 @@
 | 
			
		||||
//!
 | 
			
		||||
//! @author Pierre Hubert
 | 
			
		||||
 | 
			
		||||
use crate::api_data::notification_api::NotificationAPI;
 | 
			
		||||
use crate::api_data::res_count_all_unreads::ResCountAllUnread;
 | 
			
		||||
use crate::api_data::res_number_unread_notifications::ResNumberUnreadNotifications;
 | 
			
		||||
use crate::controllers::routes::RequestResult;
 | 
			
		||||
@@ -24,4 +25,11 @@ pub fn count_all_news(r: &mut HttpRequestHandler) -> RequestResult {
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    r.set_response(ResCountAllUnread::new(notifications, conversations as u64, friends_requests))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Get the list of unread notifications
 | 
			
		||||
pub fn get_list_unread(r: &mut HttpRequestHandler) -> RequestResult {
 | 
			
		||||
    let list = notifications_helper::get_list_unread(r.user_id_ref()?)?;
 | 
			
		||||
 | 
			
		||||
    r.set_response(NotificationAPI::for_list(&list))
 | 
			
		||||
}
 | 
			
		||||
@@ -249,6 +249,9 @@ pub fn get_routes() -> Vec<Route> {
 | 
			
		||||
 | 
			
		||||
        Route::post("/notifications/count_all_news", Box::new(notifications_controller::count_all_news)),
 | 
			
		||||
 | 
			
		||||
        Route::post("/notifications/get_list_unread", Box::new(notifications_controller::get_list_unread)),
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        // Movies controller
 | 
			
		||||
        Route::post("/movies/get_list", Box::new(movies_controller::get_list)),
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user