mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-11 13:14:06 +01:00
Update roles.ts
This commit is contained in:
parent
7080cc65ed
commit
184da82158
@ -15,6 +15,7 @@ router.get("/", async (req: Request, res: Response) => {
|
|||||||
if (!guild) throw new HTTPError("Guild not found", 404);
|
if (!guild) throw new HTTPError("Guild not found", 404);
|
||||||
|
|
||||||
var roles = await RoleModel.find({ guild_id: guild_id }).exec();
|
var roles = await RoleModel.find({ guild_id: guild_id }).exec();
|
||||||
|
if(!roles) res.send("No roles");
|
||||||
return res.json(toObject(roles));
|
return res.json(toObject(roles));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -39,6 +40,10 @@ router.post("/", check(RoleCreateSchema), async (req: Request, res: Response) =>
|
|||||||
var role = {
|
var role = {
|
||||||
...body,
|
...body,
|
||||||
id: role_id,
|
id: role_id,
|
||||||
|
guild_id: guild_id,
|
||||||
|
managed: false,
|
||||||
|
position: 0,
|
||||||
|
tags: null,
|
||||||
}
|
}
|
||||||
|
|
||||||
const roleNew = await new RoleModel(role).save();
|
const roleNew = await new RoleModel(role).save();
|
||||||
|
Loading…
Reference in New Issue
Block a user