1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-09-22 02:31:36 +02:00

Update roles.ts

This commit is contained in:
Intevel ツ 2021-05-06 23:14:34 +02:00
parent 7080cc65ed
commit 184da82158

View File

@ -15,6 +15,7 @@ router.get("/", async (req: Request, res: Response) => {
if (!guild) throw new HTTPError("Guild not found", 404);
var roles = await RoleModel.find({ guild_id: guild_id }).exec();
if(!roles) res.send("No roles");
return res.json(toObject(roles));
});
@ -39,6 +40,10 @@ router.post("/", check(RoleCreateSchema), async (req: Request, res: Response) =>
var role = {
...body,
id: role_id,
guild_id: guild_id,
managed: false,
position: 0,
tags: null,
}
const roleNew = await new RoleModel(role).save();