From e529afe5401873af3af2e73a3af895be80aa0481 Mon Sep 17 00:00:00 2001 From: Jonathan Barrow Date: Mon, 2 Oct 2023 17:15:46 -0400 Subject: [PATCH] Post.remove() -> Post.del(), remove is used by Mongoose internally --- src/models/post.ts | 2 +- src/services/api/routes/posts.ts | 2 +- src/types/mongoose/post.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/models/post.ts b/src/models/post.ts index e035a70..31db0a1 100644 --- a/src/models/post.ts +++ b/src/models/post.ts @@ -88,7 +88,7 @@ const PostSchema = new Schema({ }); -PostSchema.method('remove', async function remove(reason) { +PostSchema.method('del', async function del(reason: string) { this.removed = true; this.removed_reason = reason; await this.save(); diff --git a/src/services/api/routes/posts.ts b/src/services/api/routes/posts.ts index 93a94b3..7ae813d 100644 --- a/src/services/api/routes/posts.ts +++ b/src/services/api/routes/posts.ts @@ -53,7 +53,7 @@ router.post('/:post_id.delete', async function (request: express.Request, respon } if (post.pid === userContent.pid) { - await post.remove('User requested removal'); + await post.del('User requested removal'); response.sendStatus(200); } else { response.sendStatus(401); diff --git a/src/types/mongoose/post.ts b/src/types/mongoose/post.ts index 916e20e..49731c9 100644 --- a/src/types/mongoose/post.ts +++ b/src/types/mongoose/post.ts @@ -40,7 +40,7 @@ export interface IPost { } export interface IPostMethods { - remove(reason: string): Promise; + del(reason: string): Promise; generatePostUID(length: number): Promise; cleanedBody(): string; cleanedMiiData(): string;