From 58c3930ceb45ed4fb0bdd7f051808a78f4b807dd Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Fri, 20 Mar 2020 19:07:19 +0100 Subject: [PATCH] Ready to implement comments deletion --- src/helpers/CommentsHelper.ts | 9 +++++++++ src/helpers/PostsHelper.ts | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/src/helpers/CommentsHelper.ts b/src/helpers/CommentsHelper.ts index 0a092ee..2d99428 100644 --- a/src/helpers/CommentsHelper.ts +++ b/src/helpers/CommentsHelper.ts @@ -28,6 +28,15 @@ export class CommentsHelper { return results.map(this.DbToComment); } + /** + * Delete all the comments associated to a post + * + * @param postID Target post ID + */ + public static async DeleteAll(postID: number) { + // TODO : implement + } + /** * Turn a database entry into a Comment object * diff --git a/src/helpers/PostsHelper.ts b/src/helpers/PostsHelper.ts index bf76a3c..22bb247 100644 --- a/src/helpers/PostsHelper.ts +++ b/src/helpers/PostsHelper.ts @@ -6,6 +6,7 @@ import { GroupsHelper } from "./GroupsHelper"; import { GroupMembershipLevels } from "../entities/GroupMember"; import { mysql_date } from "../utils/DateUtils"; import { LikesHelper, LikesType } from "./LikesHelper"; +import { CommentsHelper } from "./CommentsHelper"; /** * Posts helper @@ -488,6 +489,11 @@ export class PostsHelper { // Delete all the likes associated with the post await LikesHelper.DeleteAll(postID, LikesType.POST); + + // Delete all the comments associated to the post + await CommentsHelper.DeleteAll(postID); + + // TODO : continue deletion } /**