From b25628454a8a83e67c49eb63f4e062f20bad15b1 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Fri, 5 Feb 2021 13:45:40 +0100 Subject: [PATCH] Can update like status from WebSocket --- src/controllers/likes_controller.rs | 3 +-- src/controllers/user_ws_routes.rs | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/controllers/likes_controller.rs b/src/controllers/likes_controller.rs index a803ab1..f883bd7 100644 --- a/src/controllers/likes_controller.rs +++ b/src/controllers/likes_controller.rs @@ -6,7 +6,6 @@ use crate::controllers::routes::RequestResult; use crate::data::base_request_handler::BaseRequestHandler; use crate::data::error::ExecError; use crate::data::group::GroupAccessLevel; -use crate::data::http_request_handler::HttpRequestHandler; use crate::data::post::PostAccessLevel; use crate::helpers::{likes_helper, notifications_helper, user_helper}; use crate::helpers::likes_helper::LikeType; @@ -14,7 +13,7 @@ use crate::helpers::likes_helper::LikeType; struct LikeTarget(u64, LikeType); /// Update like status -pub fn update(r: &mut HttpRequestHandler) -> RequestResult { +pub fn update(r: &mut H) -> RequestResult { let req_type = r.post_string("type")?; let is_liking = r.post_bool("like")?; diff --git a/src/controllers/user_ws_routes.rs b/src/controllers/user_ws_routes.rs index f0fff53..f2a0afe 100644 --- a/src/controllers/user_ws_routes.rs +++ b/src/controllers/user_ws_routes.rs @@ -2,6 +2,7 @@ //! //! @author Pierre Hubert +use crate::controllers::likes_controller; use crate::data::error::Res; use crate::data::user_ws_request_handler::WsRequestHandler; @@ -25,7 +26,10 @@ impl UserWsRoute { /// Get the list of available WebSocket routes pub fn get_user_ws_routes() -> Vec { - vec![] + vec![ + // Likes controller + UserWsRoute::new("likes/update", likes_controller::update) + ] } /// Search for a route