diff --git a/src/helpers/account_helper.rs b/src/helpers/account_helper.rs index f99c200..8011dee 100644 --- a/src/helpers/account_helper.rs +++ b/src/helpers/account_helper.rs @@ -312,6 +312,9 @@ pub fn delete(user_id: &UserID) -> ResultBoxError { // Delete all user posts posts_helper::delete_all_user(user_id)?; + // Delete all responses of user to surveys + survey_helper::delete_all_user_responses(user_id)?; + // TODO : continue work here Ok(()) diff --git a/src/helpers/survey_helper.rs b/src/helpers/survey_helper.rs index 1c2b8f7..328a3c6 100644 --- a/src/helpers/survey_helper.rs +++ b/src/helpers/survey_helper.rs @@ -143,6 +143,13 @@ pub fn export_all_user_responses(user_id: &UserID) -> ResultBoxError ResultBoxError { + database::DeleteQuery::new(SURVEY_RESPONSE_TABLE) + .cond_user_id("ID_utilisateurs", user_id) + .exec() +} + /// Turn a database entry into a row object fn db_to_survey(row: &database::RowResult) -> ResultBoxError { let survey_id = row.get_u64("ID")?;