mirror of
				https://gitlab.com/comunic/comunicapiv2
				synced 2025-10-31 01:24:43 +00:00 
			
		
		
		
	Can delete all the posts of a user
This commit is contained in:
		| @@ -447,8 +447,11 @@ 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 | ||||
| 	 *  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user