summary refs log tree commit diff
path: root/src/routes/users/@me/delete.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-05-31 20:32:23 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-05-31 20:32:23 +0200
commit536900d255ff4306b00903dac1988ca08ce731ee (patch)
tree9c7d24fa946944bf8697e3450b1d45811405a8da /src/routes/users/@me/delete.ts
parent:bug: fix getPublicUser (diff)
downloadserver-536900d255ff4306b00903dac1988ca08ce731ee.tar.xz
:construction: dm channels
Diffstat (limited to 'src/routes/users/@me/delete.ts')
-rw-r--r--src/routes/users/@me/delete.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/routes/users/@me/delete.ts b/src/routes/users/@me/delete.ts
index aef4006c..edda8e2d 100644
--- a/src/routes/users/@me/delete.ts
+++ b/src/routes/users/@me/delete.ts
@@ -1,5 +1,5 @@
 import { Router, Request, Response } from "express";
-import { UserModel } from "@fosscord/server-util";
+import { GuildModel, MemberModel, UserModel } from "@fosscord/server-util";
 import bcrypt from "bcrypt";
 const router = Router();
 
@@ -8,7 +8,10 @@ router.post("/", async (req: Request, res: Response) => {
 
 	let correctpass = await bcrypt.compare(req.body.password, user!.user_data.hash); //Not sure if user typed right password :/
 	if (correctpass) {
-		await UserModel.deleteOne({ id: req.user_id }).exec(); //Yeetus user deletus
+		await Promise.all([
+			UserModel.deleteOne({ id: req.user_id }).exec(), //Yeetus user deletus
+			MemberModel.deleteMany({ id: req.user_id }).exec()
+		]);
 
 		res.sendStatus(204);
 	} else {