diff --git a/src/helpers/AccountHelper.ts b/src/helpers/AccountHelper.ts index ecd0ff9..b7ebe01 100644 --- a/src/helpers/AccountHelper.ts +++ b/src/helpers/AccountHelper.ts @@ -453,6 +453,9 @@ export class AccountHelper { // Delete all responses of user to surveys await SurveyHelper.DeleteAllUserResponses(userID); + + // Delete all the likes created by the user + await LikesHelper.DeleteAllUser(userID); */ // TODO : continue work diff --git a/src/helpers/LikesHelper.ts b/src/helpers/LikesHelper.ts index e031923..cefe746 100644 --- a/src/helpers/LikesHelper.ts +++ b/src/helpers/LikesHelper.ts @@ -135,6 +135,17 @@ export class LikesHelper { })).map(this.DBToUserLike); } + /** + * Delete all the likes of a given user + * + * @param userID Target user ID + */ + public static async DeleteAllUser(userID: number) { + await DatabaseHelper.DeleteRows(LIKES_TABLE, { + ID_personne: userID + }) + } + /** * Turn a database entry into a like entry *