mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-06-20 16:35:17 +00:00
Can get information about a single comment
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
//!
|
||||
//! @author Pierre Hubert
|
||||
|
||||
use crate::api_data::comment_api::CommentAPI;
|
||||
use crate::api_data::res_create_comment::ResCreateComment;
|
||||
use crate::constants::PATH_COMMENTS_IMAGES;
|
||||
use crate::controllers::routes::RequestResult;
|
||||
@ -48,4 +49,11 @@ pub fn create(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
// TODO : Remove notifications targeting current user about the post
|
||||
|
||||
r.set_response(ResCreateComment::new(comment_id))
|
||||
}
|
||||
|
||||
/// Get information about a single comment
|
||||
pub fn get_single(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
let comment = r.post_comment_with_access("commentID")?;
|
||||
|
||||
r.set_response(CommentAPI::new(&comment, &r.user_id_opt())?)
|
||||
}
|
@ -221,6 +221,8 @@ pub fn get_routes() -> Vec<Route> {
|
||||
// Comments controller
|
||||
Route::post("/comments/create", Box::new(comments_controller::create)),
|
||||
|
||||
Route::post("/comments/get_single", Box::new(comments_controller::get_single)),
|
||||
|
||||
|
||||
|
||||
// Movies controller
|
||||
|
Reference in New Issue
Block a user