diff options
Diffstat (limited to 'api/src')
-rw-r--r-- | api/src/routes/guilds/#guild_id/roles.ts | 6 | ||||
-rw-r--r-- | api/src/routes/guilds/#guild_id/vanity-url.ts | 12 |
2 files changed, 5 insertions, 13 deletions
diff --git a/api/src/routes/guilds/#guild_id/roles.ts b/api/src/routes/guilds/#guild_id/roles.ts index 0a57c6a2..b1875598 100644 --- a/api/src/routes/guilds/#guild_id/roles.ts +++ b/api/src/routes/guilds/#guild_id/roles.ts @@ -17,7 +17,7 @@ const router: Router = Router(); export interface RoleModifySchema { name?: string; - permissions?: bigint; + permissions?: string; color?: number; hoist?: boolean; // whether the role should be displayed separately in the sidebar mentionable?: boolean; // whether the role should be mentionable @@ -57,7 +57,7 @@ router.post("/", route({ body: "RoleModifySchema", permission: "MANAGE_ROLES" }) ...body, guild_id: guild_id, managed: false, - permissions: String(req.permission!.bitfield & (body.permissions || BigInt("0"))), + permissions: String(req.permission!.bitfield & BigInt(body.permissions || "0")), tags: undefined }); @@ -109,7 +109,7 @@ router.patch("/:role_id", route({ body: "RoleModifySchema", permission: "MANAGE_ ...body, id: role_id, guild_id, - permissions: String(req.permission!.bitfield & (body.permissions || BigInt("0"))) + permissions: String(req.permission!.bitfield & BigInt(body.permissions || "0")) }); await Promise.all([ diff --git a/api/src/routes/guilds/#guild_id/vanity-url.ts b/api/src/routes/guilds/#guild_id/vanity-url.ts index 061b317c..63173345 100644 --- a/api/src/routes/guilds/#guild_id/vanity-url.ts +++ b/api/src/routes/guilds/#guild_id/vanity-url.ts @@ -10,7 +10,7 @@ const InviteRegex = /\W/g; router.get("/", route({ permission: "MANAGE_GUILD" }), async (req: Request, res: Response) => { const { guild_id } = req.params; - const invite = await Invite.findOne({ where: {guild_id: guild_id, vanity_url: true} }); + const invite = await Invite.findOne({ where: { guild_id: guild_id, vanity_url: true } }); if (!invite) return res.json({ code: null }); return res.json({ code: invite.code, uses: invite.uses }); @@ -35,15 +35,7 @@ router.patch("/", route({ body: "VanityUrlSchema", permission: "MANAGE_GUILD" }) const { id } = await Channel.findOneOrFail({ guild_id, type: ChannelType.GUILD_TEXT }); - Promise.all([ - new Invite({ - code: code, - uses: 0, - created_at: new Date(), - guild_id, - channel_id: id - }).save() - ]); + await Invite.update({ vanity_url: true, guild_id }, { code: code, channel_id: id }); return res.json({ code: code }); }); |