1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-09-22 02:31:36 +02:00

Update channels.ts

This commit is contained in:
Intevel ツ 2021-04-24 10:28:25 +02:00
parent 75461b9f6e
commit f41f2cb251

View File

@ -50,22 +50,12 @@ router.get("/", async (req: Request, res: Response) => {
router.post("/", check(DmChannelCreateSchema), async (req, res) => {
const body = req.body as DmChannelCreateSchema;
switch (body.type) {
case ChannelType.GUILD_CATEGORY:
case ChannelType.GUILD_TEXT:
case ChannelType.GUILD_VOICE:
throw new HTTPError("You can't create a dm channel in a guild");
// TODO:
case ChannelType.GUILD_STORE:
throw new HTTPError("Not yet supported");
case ChannelType.GUILD_NEWS:
// TODO: check if guild is community server
}
const channel = {
...body,
owner_id: req.user_id,
id: Snowflake.generate(),
type: ChannelType.DM,
created_at: new Date(),
};
await new ChannelModel(channel).save();