summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-06-26 23:35:31 +1000
committerGitHub <noreply@github.com>2022-06-26 23:35:31 +1000
commit9c6d0a98c537d1950bc977f8aea02d05d4cc0619 (patch)
treecb30d8fbd3f90c651a2a9fd3c21edb0a1d9bcb9d
parentfix the wrong name (diff)
parentFix compile errors in latest (diff)
downloadserver-9c6d0a98c537d1950bc977f8aea02d05d4cc0619.tar.xz
Merge pull request #776 from MaddyUnderStars/fix/member_id
Fix compile errors in latest
-rw-r--r--api/src/routes/guilds/#guild_id/members/#member_id/index.ts24
1 files changed, 14 insertions, 10 deletions
diff --git a/api/src/routes/guilds/#guild_id/members/#member_id/index.ts b/api/src/routes/guilds/#guild_id/members/#member_id/index.ts
index 38f2a529..c285abb3 100644
--- a/api/src/routes/guilds/#guild_id/members/#member_id/index.ts
+++ b/api/src/routes/guilds/#guild_id/members/#member_id/index.ts
@@ -51,7 +51,7 @@ router.patch("/", route({ body: "MemberChangeSchema" }), async (req: Request, re
 router.put("/", route({}), async (req: Request, res: Response) => {
 
 	// TODO: Lurker mode
-	
+
 	const rights = await getRights(req.user_id);
 
 	let { guild_id, member_id } = req.params;
@@ -59,28 +59,33 @@ router.put("/", route({}), async (req: Request, res: Response) => {
 		member_id = req.user_id;
 		rights.hasThrow("JOIN_GUILDS");
 	} else {
-	   // TODO: join others by controller	
+		// TODO: join others by controller	
 	}
 
 	var guild = await Guild.findOneOrFail({
-		where: { id: guild_id }	});
+		where: { id: guild_id }
+	});
 
 	var emoji = await Emoji.find({
-		where: { guild_id: guild_id }	});
+		where: { guild_id: guild_id }
+	});
 
 	var roles = await Role.find({
-		where: { guild_id: guild_id }	});
+		where: { guild_id: guild_id }
+	});
 
 	var stickers = await Sticker.find({
-		where: { guild_id: guild_id }	});
-	
+		where: { guild_id: guild_id }
+	});
+
 	await Member.addToGuild(member_id, guild_id);
-	res.send({...guild, emojis: emoji, roles: roles, stickers: stickers});
+	res.send({ ...guild, emojis: emoji, roles: roles, stickers: stickers });
 });
 
-router.delete("/", route(), async (req: Request, res: Response) => {
+router.delete("/", route({}), async (req: Request, res: Response) => {
 	const permission = await getPermission(req.user_id);
 	const rights = await getRights(req.user_id);
+	const { guild_id, member_id } = req.params;
 	if (member_id !== "@me" || member_id === req.user_id) {
 		// TODO: unless force-joined
 		rights.hasThrow("SELF_LEAVE_GROUPS");
@@ -88,7 +93,6 @@ router.delete("/", route(), async (req: Request, res: Response) => {
 		rights.hasThrow("KICK_BAN_MEMBERS");
 		permission.hasThrow("KICK_MEMBERS");
 	}
-	const { guild_id, member_id } = req.params;
 
 	await Member.removeFromGuild(member_id, guild_id);
 	res.sendStatus(204);