summary refs log tree commit diff
path: root/api/src/routes/users/@me
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-03 03:37:55 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-03 03:37:55 +0200
commit36fe0ec0c8022cbbde23eb87ca00906629255de6 (patch)
tree43dba167ea6e790ac271b05710c41a539a0fd0d3 /api/src/routes/users/@me
parentfix #309 (diff)
downloadserver-36fe0ec0c8022cbbde23eb87ca00906629255de6.tar.xz
:bug: fix member + member list
Diffstat (limited to 'api/src/routes/users/@me')
-rw-r--r--api/src/routes/users/@me/channels.ts2
-rw-r--r--api/src/routes/users/@me/delete.ts2
-rw-r--r--api/src/routes/users/@me/guilds.ts4
3 files changed, 4 insertions, 4 deletions
diff --git a/api/src/routes/users/@me/channels.ts b/api/src/routes/users/@me/channels.ts
index 880e09c1..6fd396b8 100644
--- a/api/src/routes/users/@me/channels.ts
+++ b/api/src/routes/users/@me/channels.ts
@@ -10,7 +10,7 @@ import { Recipient } from "../../../../../util/dist/entities/Recipient";
 const router: Router = Router();
 
 router.get("/", async (req: Request, res: Response) => {
-	const recipients = await Recipient.find({ where: { id: req.user_id }, relations: ["channel"] });
+	const recipients = await Recipient.find({ where: { user_id: req.user_id }, relations: ["channel"] });
 
 	res.json(recipients.map((x) => x.channel));
 });
diff --git a/api/src/routes/users/@me/delete.ts b/api/src/routes/users/@me/delete.ts
index e3b54607..e5fda948 100644
--- a/api/src/routes/users/@me/delete.ts
+++ b/api/src/routes/users/@me/delete.ts
@@ -19,7 +19,7 @@ router.post("/", async (req: Request, res: Response) => {
 	// TODO: decrement guild member count
 
 	if (correctpass) {
-		await Promise.all([User.delete({ id: req.user_id }), Member.delete({ user_id: req.user_id })]);
+		await Promise.all([User.delete({ id: req.user_id }), Member.delete({ id: req.user_id })]);
 
 		res.sendStatus(204);
 	} else {
diff --git a/api/src/routes/users/@me/guilds.ts b/api/src/routes/users/@me/guilds.ts
index 1edb0eb1..fb88281b 100644
--- a/api/src/routes/users/@me/guilds.ts
+++ b/api/src/routes/users/@me/guilds.ts
@@ -6,7 +6,7 @@ import { In } from "typeorm";
 const router: Router = Router();
 
 router.get("/", async (req: Request, res: Response) => {
-	const members = await Member.find({ relations: ["guild"], where: { user_id: req.user_id } });
+	const members = await Member.find({ relations: ["guild"], where: { id: req.user_id } });
 
 	res.json(members.map((x) => x.guild));
 });
@@ -20,7 +20,7 @@ router.delete("/:id", async (req: Request, res: Response) => {
 	if (guild.owner_id === req.user_id) throw new HTTPError("You can't leave your own guild", 400);
 
 	await Promise.all([
-		Member.delete({ user_id: req.user_id, guild_id: guild_id }),
+		Member.delete({ id: req.user_id, guild_id: guild_id }),
 		emitEvent({
 			event: "GUILD_DELETE",
 			data: {