mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-01-30 14:03:00 +00:00
Can delete all the notifications of a given user
This commit is contained in:
parent
d358119ae6
commit
ead879bc21
@ -71,4 +71,11 @@ pub fn mark_seen(r: &mut HttpRequestHandler) -> RequestResult {
|
|||||||
notifications_helper::delete(¬if)?;
|
notifications_helper::delete(¬if)?;
|
||||||
|
|
||||||
r.success("Notification deleted")
|
r.success("Notification deleted")
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Delete all the notifications of the current user
|
||||||
|
pub fn delete_all(r: &mut HttpRequestHandler) -> RequestResult {
|
||||||
|
notifications_helper::delete_all_user(r.user_id_ref()?)?;
|
||||||
|
|
||||||
|
r.success("Notifications deleted.")
|
||||||
}
|
}
|
@ -253,6 +253,8 @@ pub fn get_routes() -> Vec<Route> {
|
|||||||
|
|
||||||
Route::post("/notifications/mark_seen", Box::new(notifications_controller::mark_seen)),
|
Route::post("/notifications/mark_seen", Box::new(notifications_controller::mark_seen)),
|
||||||
|
|
||||||
|
Route::post("/notifications/delete_all", Box::new(notifications_controller::delete_all)),
|
||||||
|
|
||||||
|
|
||||||
// Movies controller
|
// Movies controller
|
||||||
Route::post("/movies/get_list", Box::new(movies_controller::get_list)),
|
Route::post("/movies/get_list", Box::new(movies_controller::get_list)),
|
||||||
|
@ -21,6 +21,11 @@ pub fn delete(notification: &PartialNotification) -> ResultBoxError {
|
|||||||
.exec()
|
.exec()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Delete all the notifications of a given user
|
||||||
|
pub fn delete_all_user(user_id: &UserID) -> ResultBoxError {
|
||||||
|
delete(&PartialNotification::new().set_dest_user_id(user_id))
|
||||||
|
}
|
||||||
|
|
||||||
/// Check out whether a similar notification exists for given specifications
|
/// Check out whether a similar notification exists for given specifications
|
||||||
pub fn similar_exists(n: &PartialNotification) -> ResultBoxError<bool> {
|
pub fn similar_exists(n: &PartialNotification) -> ResultBoxError<bool> {
|
||||||
database::QueryInfo::new(NOTIFICATIONS_TABLE)
|
database::QueryInfo::new(NOTIFICATIONS_TABLE)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user