1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-23 02:42:28 +01:00

Update index.ts

This commit is contained in:
Intevel ツ 2021-02-21 16:05:03 +01:00
parent 28ccdb42e9
commit 488f6f3894

View File

@ -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);