mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-23 05:49:22 +00:00
Can update like status of a post
This commit is contained in:
parent
4de337421a
commit
22ce88ee53
@ -3,10 +3,11 @@
|
|||||||
//! @author Pierre Hubert
|
//! @author Pierre Hubert
|
||||||
|
|
||||||
use crate::controllers::routes::RequestResult;
|
use crate::controllers::routes::RequestResult;
|
||||||
use crate::data::http_request_handler::HttpRequestHandler;
|
|
||||||
use crate::data::error::ExecError;
|
use crate::data::error::ExecError;
|
||||||
|
use crate::data::http_request_handler::HttpRequestHandler;
|
||||||
|
use crate::data::post::PostAccessLevel;
|
||||||
|
use crate::helpers::{likes_helper, user_helper};
|
||||||
use crate::helpers::likes_helper::LikeType;
|
use crate::helpers::likes_helper::LikeType;
|
||||||
use crate::helpers::{user_helper, likes_helper};
|
|
||||||
|
|
||||||
struct LikeTarget(u64, LikeType);
|
struct LikeTarget(u64, LikeType);
|
||||||
|
|
||||||
@ -29,6 +30,15 @@ pub fn update(r: &mut HttpRequestHandler) -> RequestResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// In case of post
|
||||||
|
"post" => {
|
||||||
|
let post = r.post_post_with_access("id", PostAccessLevel::BASIC_ACCESS)?;
|
||||||
|
|
||||||
|
// TODO : delete any notification targeting this user about the post
|
||||||
|
|
||||||
|
LikeTarget(post.id, LikeType::POST)
|
||||||
|
}
|
||||||
|
|
||||||
_ => {
|
_ => {
|
||||||
r.internal_error(ExecError::boxed_new("Unsupported like type!"))?;
|
r.internal_error(ExecError::boxed_new("Unsupported like type!"))?;
|
||||||
unreachable!();
|
unreachable!();
|
||||||
|
Loading…
Reference in New Issue
Block a user