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

Can cancel the response to a survey

This commit is contained in:
Pierre HUBERT 2020-07-10 11:20:11 +02:00
parent 964a7d1c8c
commit b76e16294a
2 changed files with 12 additions and 0 deletions

View File

@ -231,11 +231,14 @@ pub fn get_routes() -> Vec<Route> {
// Likes controller // Likes controller
Route::post("/likes/update", Box::new(likes_controller::update)), Route::post("/likes/update", Box::new(likes_controller::update)),
// Surveys controller // Surveys controller
Route::post("/surveys/get_info", Box::new(surveys_controller::get_info_single)), Route::post("/surveys/get_info", Box::new(surveys_controller::get_info_single)),
Route::post("/surveys/send_response", Box::new(surveys_controller::send_response)), Route::post("/surveys/send_response", Box::new(surveys_controller::send_response)),
Route::post("/surveys/cancel_response", Box::new(surveys_controller::cancel_response)),
// Movies controller // Movies controller
Route::post("/movies/get_list", Box::new(movies_controller::get_list)), Route::post("/movies/get_list", Box::new(movies_controller::get_list)),

View File

@ -43,3 +43,12 @@ pub fn send_response(r: &mut HttpRequestHandler) -> RequestResult {
r.success("Choice saved!") r.success("Choice saved!")
} }
/// Cancel a response to a survey
pub fn cancel_response(r: &mut HttpRequestHandler) -> RequestResult {
let survey_id = r.post_survey_id_from_post_id("postID", PostAccessLevel::BASIC_ACCESS)?;
survey_helper::cancel_response(r.user_id_ref()?, survey_id)?;
r.success("Response cancelled")
}