summary refs log tree commit diff
path: root/src/routes/guilds/index.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-05-10 15:49:57 +0200
committerGitHub <noreply@github.com>2021-05-10 15:49:57 +0200
commit87bbf118431bd02930dd47221ebab2cb19a86c79 (patch)
tree20836a21a7b1fa0ca151ff7a1d95714063dcbbcc /src/routes/guilds/index.ts
parent:bug: fix channel modify schema (diff)
parentUpdate Member.ts (diff)
downloadserver-87bbf118431bd02930dd47221ebab2cb19a86c79.tar.xz
Merge pull request #136 from notsapinho/master
🐛 Fix channels and joined_at not getting populated
Diffstat (limited to '')
-rw-r--r--src/routes/guilds/index.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/routes/guilds/index.ts b/src/routes/guilds/index.ts

index a655f890..176e4e69 100644 --- a/src/routes/guilds/index.ts +++ b/src/routes/guilds/index.ts
@@ -1,5 +1,5 @@ import { Router, Request, Response } from "express"; -import { RoleModel, GuildModel, Snowflake, Guild } from "@fosscord/server-util"; +import { RoleModel, GuildModel, Snowflake, Guild, RoleDocument } from "@fosscord/server-util"; import { HTTPError } from "lambert-server"; import { check } from "./../../util/instanceOf"; import { GuildCreateSchema } from "../../schema/Guild"; @@ -58,13 +58,13 @@ router.post("/", check(GuildCreateSchema), async (req: Request, res: Response) = welcome_screen: { enabled: false, description: "No description", - welcome_channels: [] + welcome_channels: [], }, widget_channel_id: undefined, widget_enabled: false, }; - await Promise.all([ + const [guild_doc, role] = await Promise.all([ new GuildModel(guild).save(), new RoleModel({ id: guild_id, @@ -79,7 +79,8 @@ router.post("/", check(GuildCreateSchema), async (req: Request, res: Response) = tags: null, }).save(), ]); - await addMember(req.user_id, guild_id, { guild }); + + await addMember(req.user_id, guild_id, { guild: guild_doc }); res.status(201).json({ id: guild.id }); });