summary refs log tree commit diff
path: root/src/api/routes/guilds/#guild_id/vanity-url.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/routes/guilds/#guild_id/vanity-url.ts')
-rw-r--r--src/api/routes/guilds/#guild_id/vanity-url.ts24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/api/routes/guilds/#guild_id/vanity-url.ts b/src/api/routes/guilds/#guild_id/vanity-url.ts
index a64ae2c9..1cfa9883 100644
--- a/src/api/routes/guilds/#guild_id/vanity-url.ts
+++ b/src/api/routes/guilds/#guild_id/vanity-url.ts
@@ -17,13 +17,7 @@
 */
 
 import { route } from "@spacebar/api";
-import {
-	Channel,
-	ChannelType,
-	Guild,
-	Invite,
-	VanityUrlSchema,
-} from "@spacebar/util";
+import { Channel, ChannelType, Guild, Invite, VanityUrlSchema } from "@spacebar/util";
 import { Request, Response, Router } from "express";
 import { HTTPError } from "lambert-server";
 
@@ -64,11 +58,9 @@ router.get(
 			});
 			if (!invite || invite.length == 0) return res.json({ code: null });
 
-			return res.json(
-				invite.map((x) => ({ code: x.code, uses: x.uses })),
-			);
+			return res.json(invite.map((x) => ({ code: x.code, uses: x.uses })));
 		}
-	},
+	}
 );
 
 router.patch(
@@ -94,11 +86,9 @@ router.patch(
 		const code = body.code?.replace(InviteRegex, "");
 
 		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 (!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");
+		if (!code || code.length === 0) throw new HTTPError("Code cannot be null or empty");
 
 		const invite = await Invite.findOne({ where: { code } });
 		if (invite) throw new HTTPError("Invite already exists");
@@ -112,7 +102,7 @@ router.patch(
 				{ guild_id },
 				{
 					code: code,
-				},
+				}
 			);
 
 			return res.json({ code });
@@ -132,7 +122,7 @@ router.patch(
 		}).save();
 
 		return res.json({ code: code });
-	},
+	}
 );
 
 export default router;