diff options
author | Intevel ツ <59223342+Intevel@users.noreply.github.com> | 2021-02-21 16:05:03 +0100 |
---|---|---|
committer | Intevel ツ <59223342+Intevel@users.noreply.github.com> | 2021-02-21 16:05:03 +0100 |
commit | 488f6f3894959dcb66cb6f7e503871031694f907 (patch) | |
tree | 38f6c4751b023692e98f86549e1cd0d7e199a68e /src/routes | |
parent | Update index.ts (diff) | |
download | server-488f6f3894959dcb66cb6f7e503871031694f907.tar.xz |
Update index.ts
Diffstat (limited to 'src/routes')
-rw-r--r-- | src/routes/api/v8/guilds/index.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/routes/api/v8/guilds/index.ts b/src/routes/api/v8/guilds/index.ts index 85fc0bc9..d7b82ea9 100644 --- a/src/routes/api/v8/guilds/index.ts +++ b/src/routes/api/v8/guilds/index.ts @@ -214,10 +214,21 @@ router.delete("/:id", async (req: Request, res: Response) => { }); router.get("/:id/bans", async (req: Request, res: Response) => { + const guild = await GuildModel.findOne({ id: BigInt(req.params.id) }).exec(); + + if (!guild) throw new HTTPError("Guild not found", 404); var bans = await BanModel.find({ guild_id: BigInt(req.params.id) }).exec(); return res.json(bans); }); +router.get("/:id/members", async (req: Request, res: Response) => { + const guild = await GuildModel.findOne({ id: BigInt(req.params.id) }).exec(); + + if (!guild) throw new HTTPError("Guild not found", 404); + var members = await MemberModel.find({ guild_id: BigInt(req.params.id) }).exec(); + return res.json(members); +}); + router.post("/:id/bans/:userid", check(BanCreateSchema), async (req: Request, res: Response) => { try { var guildID = BigInt(req.params.id); |