summary refs log tree commit diff
path: root/src/routes
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-05-29 18:22:52 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-05-29 18:22:52 +0200
commita86efe97bb1e623a0f0cdf77f6d8343d5b182c49 (patch)
tree99d58b7732652466b51e2d2a4fc2e05ca716b950 /src/routes
parentautomatically embed links in message (diff)
downloadserver-a86efe97bb1e623a0f0cdf77f6d8343d5b182c49.tar.xz
:art: reformat
Diffstat (limited to 'src/routes')
-rw-r--r--src/routes/users/#id/index.ts4
-rw-r--r--src/routes/users/@me/delete.ts25
2 files changed, 7 insertions, 22 deletions
diff --git a/src/routes/users/#id/index.ts b/src/routes/users/#id/index.ts
index d5f3b788..185b2e5f 100644
--- a/src/routes/users/#id/index.ts
+++ b/src/routes/users/#id/index.ts
@@ -1,9 +1,6 @@
 import { Router, Request, Response } from "express";
-import { UserModel, toObject } from "@fosscord/server-util";
 import { getPublicUser } from "../../../util/User";
 import { HTTPError } from "lambert-server";
-import { UserUpdateSchema } from "../../../schema/User";
-import { check } from "../../../util/instanceOf";
 
 const router: Router = Router();
 
@@ -15,5 +12,4 @@ router.get("/", async (req: Request, res: Response) => {
 	res.json(user);
 });
 
-
 export default router;
diff --git a/src/routes/users/@me/delete.ts b/src/routes/users/@me/delete.ts
index ec4cc223..aef4006c 100644
--- a/src/routes/users/@me/delete.ts
+++ b/src/routes/users/@me/delete.ts
@@ -1,29 +1,18 @@
 import { Router, Request, Response } from "express";
-import { UserModel,UserDocument, toObject } from "@fosscord/server-util";
-import { getPublicUser } from "../../../util/User";
-import { HTTPError } from "lambert-server";
-import { UserUpdateSchema } from "../../../schema/User";
-import { check, FieldErrors, Length } from "../../../util/instanceOf";
-import { db } from "@fosscord/server-util";
+import { UserModel } from "@fosscord/server-util";
 import bcrypt from "bcrypt";
 const router = Router();
 
 router.post("/", async (req: Request, res: Response) => {
+	const user = await UserModel.findOne({ id: req.user_id }).exec(); //User object
 
-	const user = await UserModel.findOne(
-		{ id: req.user_id },
-		
-	).exec();  //User object
-	
-	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
+	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
 
-	res.sendStatus(204);
-	}
-	else{
+		res.sendStatus(204);
+	} else {
 		res.sendStatus(401);
-
 	}
 });