diff --git a/src/controllers/PostsController.ts b/src/controllers/PostsController.ts index e9695f4..961c525 100644 --- a/src/controllers/PostsController.ts +++ b/src/controllers/PostsController.ts @@ -334,6 +334,19 @@ export class PostsController { h.success(); } + /** + * Delete a post + * + * @param h Request handler + */ + public static async DeletePost(h: RequestHandler) { + const postID = await h.postPostIDWithAccess("postID", PostAccessLevel.INTERMEDIATE_ACCESS); + + await PostsHelper.Delete(postID); + + h.success(); + } + /** * Send multiple posts to the API * diff --git a/src/controllers/Routes.ts b/src/controllers/Routes.ts index 9668a21..cb06747 100644 --- a/src/controllers/Routes.ts +++ b/src/controllers/Routes.ts @@ -198,6 +198,8 @@ export const Routes : Route[] = [ {path: "/posts/update_content", cb: (h) => PostsController.UpdateContent(h)}, + {path: "/posts/delete", cb: (h) => PostsController.DeletePost(h)}, + // Notifications controller diff --git a/src/helpers/PostsHelper.ts b/src/helpers/PostsHelper.ts index c49c69b..c620607 100644 --- a/src/helpers/PostsHelper.ts +++ b/src/helpers/PostsHelper.ts @@ -478,6 +478,15 @@ export class PostsHelper { }) } + /** + * Delete a post + * + * @param postID The ID of the post to delete + */ + public static async Delete(postID: number) { + + } + /** * Turn a database entry into a row object *