summary refs log tree commit diff
path: root/src/api/routes/guilds/#guild_id/invites.ts
blob: c663df72e4e0a232d25c61a927f4dfd5135aa652 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { route } from "@fosscord/api";
import { Invite, PublicInviteRelation } from "@fosscord/util";
import { Request, Response, Router } from "express";

const router = Router();

router.get("/", route({ permission: "MANAGE_GUILD" }), async (req: Request, res: Response) => {
	const { guild_id } = req.params;

	const invites = await Invite.find({ where: { guild_id }, relations: PublicInviteRelation });

	return res.json(invites);
});

export default router;