mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-06-21 00:45:18 +00:00
Can update the content of the posts
This commit is contained in:
@ -247,4 +247,16 @@ pub fn set_visibility_level(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
// TODO : Depending on new level, delete (or not) notifications about the post
|
||||
|
||||
r.success("Visibility level updated")
|
||||
}
|
||||
|
||||
/// Update the content of a post
|
||||
pub fn update_content(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
let post = r.post_post_with_access("postID", PostAccessLevel::FULL_ACCESS)?;
|
||||
let new_content = r.post_content("new_content", 2, true)?;
|
||||
|
||||
posts_helper::set_content(post.id, &new_content)?;
|
||||
|
||||
// TODO : Delete the notifications targeting the current user about this post
|
||||
|
||||
r.success("Content updated")
|
||||
}
|
@ -210,6 +210,8 @@ pub fn get_routes() -> Vec<Route> {
|
||||
|
||||
Route::post("/posts/set_visibility_level", Box::new(posts_controller::set_visibility_level)),
|
||||
|
||||
Route::post("/posts/update_content", Box::new(posts_controller::update_content)),
|
||||
|
||||
|
||||
// Movies controller
|
||||
Route::post("/movies/get_list", Box::new(movies_controller::get_list)),
|
||||
|
Reference in New Issue
Block a user