summary refs log tree commit diff
path: root/api/src/routes/guilds/#guild_id/vanity-url.ts
diff options
context:
space:
mode:
Diffstat (limited to 'api/src/routes/guilds/#guild_id/vanity-url.ts')
-rw-r--r--api/src/routes/guilds/#guild_id/vanity-url.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/api/src/routes/guilds/#guild_id/vanity-url.ts b/api/src/routes/guilds/#guild_id/vanity-url.ts
index e841b8b3..b4d9f618 100644
--- a/api/src/routes/guilds/#guild_id/vanity-url.ts
+++ b/api/src/routes/guilds/#guild_id/vanity-url.ts
@@ -9,7 +9,7 @@ const InviteRegex = /\W/g;
 
 router.get("/", route({ permission: "MANAGE_GUILD" }), async (req: Request, res: Response) => {
 	const { guild_id } = req.params;
-	const guild = await Guild.findOneOrFail({ id: guild_id });
+	const guild = await Guild.findOneOrFail({ where: { id: guild_id } });
 
 	if (!guild.features.includes("ALIASABLE_NAMES")) {
 		const invite = await Invite.findOne({ where: { guild_id: guild_id, vanity_url: true } });
@@ -37,15 +37,15 @@ router.patch("/", route({ body: "VanityUrlSchema", permission: "MANAGE_GUILD" })
 	const body = req.body as VanityUrlSchema;
 	const code = body.code?.replace(InviteRegex, "");
 
-	const guild = await Guild.findOneOrFail({ id: guild_id });
+	const guild = await Guild.findOneOrFail({ where: { id: guild_id } });
 	if (!guild.features.includes("VANITY_URL")) throw new HTTPError("Your guild doesn't support vanity urls");
 
 	if (!code || code.length === 0) throw new HTTPError("Code cannot be null or empty");
 
-	const invite = await Invite.findOne({ code });
+	const invite = await Invite.findOne({ where: { code } });
 	if (invite) throw new HTTPError("Invite already exists");
 
-	const { id } = await Channel.findOneOrFail({ guild_id, type: ChannelType.GUILD_TEXT });
+	const { id } = await Channel.findOneOrFail({ where: { guild_id, type: ChannelType.GUILD_TEXT } });
 
 	await new Invite({
 		vanity_url: true,
@@ -60,7 +60,7 @@ router.patch("/", route({ body: "VanityUrlSchema", permission: "MANAGE_GUILD" })
 		channel_id: id
 	}).save();
 
-	return res.json({ code: code });
+	return res.json({ where: { code } });
 });
 
 export default router;