diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-09-03 13:23:20 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-09-03 13:23:20 +0200 |
commit | 4484c75ee2e59986c13405800566e9a49a11b1a6 (patch) | |
tree | 02844f3dc7bae625936a39727d58a7e0d26a2d7b /api/src/routes/guilds/index.ts | |
parent | :bug: fix member has no roles in guild create (diff) | |
download | server-4484c75ee2e59986c13405800566e9a49a11b1a6.tar.xz |
:bug: fix member roles + list
Diffstat (limited to 'api/src/routes/guilds/index.ts')
-rw-r--r-- | api/src/routes/guilds/index.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/api/src/routes/guilds/index.ts b/api/src/routes/guilds/index.ts index 51dcf96a..b4f6b3d2 100644 --- a/api/src/routes/guilds/index.ts +++ b/api/src/routes/guilds/index.ts @@ -20,7 +20,7 @@ router.post("/", check(GuildCreateSchema), async (req: Request, res: Response) = const guild_id = Snowflake.generate(); - const guild = await new Guild({ + await Guild.insert({ name: body.name, region: Config.get().regions.default, owner_id: req.user_id, @@ -47,10 +47,10 @@ router.post("/", check(GuildCreateSchema), async (req: Request, res: Response) = welcome_channels: [] }, widget_enabled: false - }).save(); + }); // we have to create the role _after_ the guild because else we would get a "SQLITE_CONSTRAINT: FOREIGN KEY constraint failed" error - const role = await new Role({ + await Role.insert({ id: guild_id, guild_id: guild_id, color: 0, @@ -60,7 +60,7 @@ router.post("/", check(GuildCreateSchema), async (req: Request, res: Response) = name: "@everyone", permissions: String("2251804225"), position: 0 - }).save(); + }); if (!body.channels || !body.channels.length) body.channels = [{ id: "01", type: 0, name: "general" }]; |