Post.remove() -> Post.del(), remove is used by Mongoose internally

This commit is contained in:
Jonathan Barrow
2023-10-02 17:15:46 -04:00
parent 8e57cc6bb8
commit e529afe540
3 changed files with 3 additions and 3 deletions

View File

@@ -88,7 +88,7 @@ const PostSchema = new Schema<IPost, PostModel, IPostMethods>({
});
PostSchema.method<HydratedPostDocument>('remove', async function remove(reason) {
PostSchema.method<HydratedPostDocument>('del', async function del(reason: string) {
this.removed = true;
this.removed_reason = reason;
await this.save();

View File

@@ -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);

View File

@@ -40,7 +40,7 @@ export interface IPost {
}
export interface IPostMethods {
remove(reason: string): Promise<void>;
del(reason: string): Promise<void>;
generatePostUID(length: number): Promise<void>;
cleanedBody(): string;
cleanedMiiData(): string;