summary refs log tree commit diff
path: root/api/src/routes/guilds/index.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-02 21:31:44 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-02 21:31:44 +0200
commit4c4bc248a5456e95b11102ee293fc5e7b37a83fa (patch)
tree984b7b8c6528d3a1a4bddeb81a2101e6258906c3 /api/src/routes/guilds/index.ts
parentMerge branch 'master' of https://github.com/fosscord/fosscord-api (diff)
downloadserver-4c4bc248a5456e95b11102ee293fc5e7b37a83fa.tar.xz
:bug: fix entity missing an id (replace .insert with new Entity().save)
Diffstat (limited to '')
-rw-r--r--api/src/routes/guilds/index.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/api/src/routes/guilds/index.ts b/api/src/routes/guilds/index.ts

index 92525317..a87f926c 100644 --- a/api/src/routes/guilds/index.ts +++ b/api/src/routes/guilds/index.ts
@@ -21,7 +21,7 @@ router.post("/", check(GuildCreateSchema), async (req: Request, res: Response) = const guild_id = Snowflake.generate(); const [guild, role] = await Promise.all([ - Guild.insert({ + new Guild({ name: body.name, region: Config.get().regions.default, owner_id: req.user_id, @@ -48,8 +48,8 @@ router.post("/", check(GuildCreateSchema), async (req: Request, res: Response) = welcome_channels: [] }, widget_enabled: false - }), - Role.insert({ + }).save(), + new Role({ id: guild_id, guild_id: guild_id, color: 0, @@ -59,7 +59,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" }];