summary refs log tree commit diff
path: root/src/api/routes/guilds/#guild_id/bans.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/routes/guilds/#guild_id/bans.ts')
-rw-r--r--src/api/routes/guilds/#guild_id/bans.ts11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/api/routes/guilds/#guild_id/bans.ts b/src/api/routes/guilds/#guild_id/bans.ts
index 9aeb27f0..93018ee5 100644
--- a/src/api/routes/guilds/#guild_id/bans.ts
+++ b/src/api/routes/guilds/#guild_id/bans.ts
@@ -39,6 +39,7 @@ router.get(
 	"/",
 	route({
 		permission: "BAN_MEMBERS",
+		right: "OPERATOR",
 		responses: {
 			200: {
 				body: "GuildBansResponse",
@@ -85,6 +86,7 @@ router.get(
 	"/:user",
 	route({
 		permission: "BAN_MEMBERS",
+		right: "OPERATOR",
 		responses: {
 			200: {
 				body: "BanModeratorSchema",
@@ -123,6 +125,7 @@ router.put(
 	route({
 		requestBody: "BanCreateSchema",
 		permission: "BAN_MEMBERS",
+		right: "OPERATOR",
 		responses: {
 			200: {
 				body: "Ban",
@@ -182,6 +185,7 @@ router.delete(
 	"/:user_id",
 	route({
 		permission: "BAN_MEMBERS",
+		right: "OPERATOR",
 		responses: {
 			204: {},
 			403: {
@@ -195,13 +199,12 @@ router.delete(
 	async (req: Request, res: Response) => {
 		const { guild_id, user_id } = req.params;
 
-		const ban = await Ban.findOneOrFail({
-			where: { guild_id: guild_id, user_id: user_id },
-		});
-
 		const banned_user = await User.getPublicUser(user_id);
 
 		await Promise.all([
+			Ban.findOneOrFail({
+				where: { guild_id: guild_id, user_id: user_id },
+			}),
 			Ban.delete({
 				user_id: user_id,
 				guild_id,