🐛 fix handleFile()
This commit is contained in:
@@ -43,8 +43,8 @@ router.patch("/", check(GuildUpdateSchema), async (req: Request, res: Response)
|
||||
const perms = await getPermission(req.user_id, guild_id);
|
||||
perms.hasThrow("MANAGE_GUILD");
|
||||
|
||||
body.icon = await handleFile("icons", body.icon);
|
||||
body.banner = await handleFile("banners", body.banner);
|
||||
body.icon = await handleFile(`/icons/${guild_id}`, body.icon);
|
||||
body.banner = await handleFile(`/banners/${guild_id}`, body.banner);
|
||||
|
||||
const guild = await GuildModel.findOneAndUpdate({ id: guild_id }, body)
|
||||
.populate({ path: "joined_at", match: { id: req.user_id } })
|
||||
|
||||
@@ -14,7 +14,7 @@ router.get("/", async (req: Request, res: Response) => {
|
||||
|
||||
router.patch("/", check(UserModifySchema), async (req: Request, res: Response) => {
|
||||
const body = req.body as UserModifySchema;
|
||||
body.avatar = await handleFile(body.avatar as string);
|
||||
body.avatar = await handleFile(`/avatars/${req.user_id}`, body.avatar as string);
|
||||
|
||||
const user = await UserModel.findOneAndUpdate({ id: req.user_id }, body, { projection: PublicUserProjection }).exec();
|
||||
// TODO: dispatch user update event
|
||||
|
||||
Reference in New Issue
Block a user