1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-22 05:19:22 +00:00

Can delete all the posts of a user

This commit is contained in:
Pierre HUBERT 2020-03-27 11:42:18 +01:00
parent 15c2652b21
commit 30200b9301
2 changed files with 17 additions and 1 deletions

View File

@ -447,6 +447,9 @@ export class AccountHelper {
// Delete all user comments
await CommentsHelper.DeleteAllUser(userID);
// Delete all user posts
await PostsHelper.DeleteAllUser(userID);
*/
// TODO : continue work

View File

@ -374,6 +374,19 @@ export class PostsHelper {
return list.map((l) => this.DBToPost(l));
}
/**
* Delete all the posts of a given user
*
* This method deletes both the posts created by the user
* & the posts created on user page
*
* @param userID Target user ID
*/
public static async DeleteAllUser(userID: number) {
for(const post of await this.ExportAllPostsUser(userID))
await this.Delete(post.id);
}
/**
* Get the access level of a user over a post
*