summary refs log tree commit diff
path: root/src/api/routes/guilds/#guild_id/invites.ts
blob: 4d033e9cc42630a4eeff1158fb4ec12f133c2476 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { getPermission, Invite, PublicInviteRelation } from "@fosscord/util";
import { route } from "@fosscord/api";
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;