🐛 fix post/patch channel
This commit is contained in:
@@ -23,15 +23,18 @@ router.get("/", async (req: Request, res: Response) => {
|
||||
res.json(toObject(channels));
|
||||
});
|
||||
|
||||
// TODO: check if channel type is permitted
|
||||
// TODO: check if parent_id exists
|
||||
router.post("/", check(ChannelModifySchema), async (req: Request, res: Response) => {
|
||||
const { guild_id } = req.params;
|
||||
const body = req.body as ChannelModifySchema;
|
||||
|
||||
const channel = await createChannel({ ...body, guild_id }, req.user_id);
|
||||
|
||||
res.json(channel);
|
||||
res.json(toObject(channel));
|
||||
});
|
||||
|
||||
// TODO: check if parent_id exists
|
||||
router.patch("/", check(ChannelModifySchema), async (req: Request, res: Response) => {
|
||||
const { guild_id } = req.params;
|
||||
const body = req.body as ChannelModifySchema;
|
||||
@@ -41,7 +44,7 @@ router.patch("/", check(ChannelModifySchema), async (req: Request, res: Response
|
||||
|
||||
await emitEvent({ event: "CHANNEL_UPDATE", data: channel } as ChannelUpdateEvent);
|
||||
|
||||
res.json(channel);
|
||||
res.json(toObject(channel));
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
Reference in New Issue
Block a user