1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-12-27 22:18:51 +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::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<H: BaseRequestHandler>(r: &mut H) -> RequestResult {
let req_type = r.post_string("type")?;
let is_liking = r.post_bool("like")?;

View File

@ -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<UserWsRoute> {
vec![]
vec![
// Likes controller
UserWsRoute::new("likes/update", likes_controller::update)
]
}
/// Search for a route