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:
parent
15c2652b21
commit
30200b9301
@ -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
|
||||
|
@ -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
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user