1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-12-28 14:38:52 +00:00

Can update like status from WebSocket

This commit is contained in:
Pierre HUBERT 2021-02-05 13:45:40 +01:00
parent 737ed75b3b
commit b25628454a
2 changed files with 6 additions and 3 deletions

View File

@ -6,7 +6,6 @@ use crate::controllers::routes::RequestResult;
use crate::data::base_request_handler::BaseRequestHandler; use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::error::ExecError; use crate::data::error::ExecError;
use crate::data::group::GroupAccessLevel; use crate::data::group::GroupAccessLevel;
use crate::data::http_request_handler::HttpRequestHandler;
use crate::data::post::PostAccessLevel; use crate::data::post::PostAccessLevel;
use crate::helpers::{likes_helper, notifications_helper, user_helper}; use crate::helpers::{likes_helper, notifications_helper, user_helper};
use crate::helpers::likes_helper::LikeType; use crate::helpers::likes_helper::LikeType;
@ -14,7 +13,7 @@ use crate::helpers::likes_helper::LikeType;
struct LikeTarget(u64, LikeType); struct LikeTarget(u64, LikeType);
/// Update like status /// Update like status
pub fn update(r: &mut HttpRequestHandler) -> RequestResult { pub fn update<H: BaseRequestHandler>(r: &mut H) -> RequestResult {
let req_type = r.post_string("type")?; let req_type = r.post_string("type")?;
let is_liking = r.post_bool("like")?; let is_liking = r.post_bool("like")?;

View File

@ -2,6 +2,7 @@
//! //!
//! @author Pierre Hubert //! @author Pierre Hubert
use crate::controllers::likes_controller;
use crate::data::error::Res; use crate::data::error::Res;
use crate::data::user_ws_request_handler::WsRequestHandler; use crate::data::user_ws_request_handler::WsRequestHandler;
@ -25,7 +26,10 @@ impl UserWsRoute {
/// Get the list of available WebSocket routes /// Get the list of available WebSocket routes
pub fn get_user_ws_routes() -> Vec<UserWsRoute> { pub fn get_user_ws_routes() -> Vec<UserWsRoute> {
vec![] vec![
// Likes controller
UserWsRoute::new("likes/update", likes_controller::update)
]
} }
/// Search for a route /// Search for a route