diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-09-14 21:16:15 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-09-14 21:16:15 +0200 |
commit | 8f862f0e5dba3985b4f38406fc19b5c5350324b9 (patch) | |
tree | cf27f5d6990995fa67ef78991b6837d2e58c70b1 | |
parent | fix #128 (diff) | |
download | server-8f862f0e5dba3985b4f38406fc19b5c5350324b9.tar.xz |
fix #129
-rw-r--r-- | api/src/routes/guilds/#guild_id/webhooks.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/api/src/routes/guilds/#guild_id/webhooks.ts b/api/src/routes/guilds/#guild_id/webhooks.ts new file mode 100644 index 00000000..a9dd164a --- /dev/null +++ b/api/src/routes/guilds/#guild_id/webhooks.ts @@ -0,0 +1,17 @@ +import { Router, Response, Request } from "express"; +import { route } from "@fosscord/api"; +import { Webhook } from "@fosscord/util"; + +const router: Router = Router(); + +router.get("/", route({ permission: "MANAGE_WEBHOOKS" }), async (req: Request, res: Response) => { + const webhooks = await Webhook.find({ + where: { guild_id: req.params.guild_id }, + select: ["application", "avatar", "channel_id", "guild_id", "id", "token", "type", "user", "source_guild", "name"], + relations: ["user", "application", "source_guild"] + }); + + return res.json(webhooks); +}); + +export default router; |