diff --git a/src/helpers/AccountHelper.ts b/src/helpers/AccountHelper.ts index 13d96cb..ecd0ff9 100644 --- a/src/helpers/AccountHelper.ts +++ b/src/helpers/AccountHelper.ts @@ -450,8 +450,11 @@ export class AccountHelper { // Delete all user posts await PostsHelper.DeleteAllUser(userID); + + // Delete all responses of user to surveys + await SurveyHelper.DeleteAllUserResponses(userID); */ - + // TODO : continue work } diff --git a/src/helpers/SurveyHelper.ts b/src/helpers/SurveyHelper.ts index 46b7d37..43870d7 100644 --- a/src/helpers/SurveyHelper.ts +++ b/src/helpers/SurveyHelper.ts @@ -232,6 +232,17 @@ export class SurveyHelper { })).map(this.DBTosurveyResponse) } + /** + * Delete all user responses to surveys + * + * @param userID Target user ID + */ + public static async DeleteAllUserResponses(userID: number) { + await DatabaseHelper.DeleteRows(SURVEY_RESPONSE_TABLE, { + ID_utilisateurs: userID + }); + } + /** * Turn a database entry into a survey object