diff --git a/src/controllers/routes.rs b/src/controllers/routes.rs index e90107e..51c6534 100644 --- a/src/controllers/routes.rs +++ b/src/controllers/routes.rs @@ -241,6 +241,8 @@ pub fn get_routes() -> Vec { Route::post("/surveys/create_new_choice", Box::new(surveys_controller::create_new_choice)), + Route::post("/surveys/block_new_choices_creation", Box::new(surveys_controller::block_new_choices_creation)), + // Movies controller diff --git a/src/controllers/surveys_controller.rs b/src/controllers/surveys_controller.rs index 879d2f2..3907e2e 100644 --- a/src/controllers/surveys_controller.rs +++ b/src/controllers/surveys_controller.rs @@ -78,4 +78,13 @@ pub fn create_new_choice(r: &mut HttpRequestHandler) -> RequestResult { } r.success("Choice created") +} + +/// Block the creation of new choices +pub fn block_new_choices_creation(r: &mut HttpRequestHandler) -> RequestResult { + let survey_id = r.post_survey_id_from_post_id("postID", PostAccessLevel::FULL_ACCESS)?; + + survey_helper::block_new_choices_creation(survey_id)?; + + r.success("") } \ No newline at end of file