summary refs log tree commit diff
path: root/api/src/routes/guilds/#guild_id/bans.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-12 23:28:56 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-12 23:28:56 +0200
commit6ba9c834bd2d5f4fac07e3fb9ded2625ce3c44ad (patch)
tree27c5de63307dc170b0dfa02140b14a306ed55514 /api/src/routes/guilds/#guild_id/bans.ts
parent:construction: :sparkles: new body parser (bans route) (diff)
downloadserver-6ba9c834bd2d5f4fac07e3fb9ded2625ce3c44ad.tar.xz
:sparkles: #307 done
Diffstat (limited to 'api/src/routes/guilds/#guild_id/bans.ts')
-rw-r--r--api/src/routes/guilds/#guild_id/bans.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/api/src/routes/guilds/#guild_id/bans.ts b/api/src/routes/guilds/#guild_id/bans.ts
index 41a97b6a..c7fda9ad 100644
--- a/api/src/routes/guilds/#guild_id/bans.ts
+++ b/api/src/routes/guilds/#guild_id/bans.ts
@@ -2,7 +2,11 @@ import { Request, Response, Router } from "express";
 import { emitEvent, getPermission, GuildBanAddEvent, GuildBanRemoveEvent, Guild, Ban, User, Member } from "@fosscord/util";
 import { HTTPError } from "lambert-server";
 import { getIpAdress, check, route } from "@fosscord/api";
-import { BanCreateSchema } from "@fosscord/api/schema/Ban";
+
+export interface BanCreateSchema {
+	delete_message_days?: string;
+	reason?: string;
+}
 
 const router: Router = Router();
 router.get("/", route({ permission: "BAN_MEMBERS" }), async (req: Request, res: Response) => {
@@ -27,7 +31,7 @@ router.put("/:user_id", route({ body: "BanCreateSchema", permission: "BAN_MEMBER
 	const banned_user = await User.getPublicUser(banned_user_id);
 
 	if (req.user_id === banned_user_id) throw new HTTPError("You can't ban yourself", 400);
-	if (req.permission?.cache.guild?.owner_id === banned_user_id) throw new HTTPError("You can't ban the owner", 400);
+	if (req.permission!.cache.guild?.owner_id === banned_user_id) throw new HTTPError("You can't ban the owner", 400);
 
 	const ban = new Ban({
 		user_id: banned_user_id,