feat(views/create): return error if filterBySlateId is invalid

This commit is contained in:
Aminejv 2022-09-12 13:02:16 +01:00
parent 1d798dda54
commit 2d3130840c

View File

@ -18,6 +18,13 @@ export default async (req, res) => {
return res.status(403).send({ decorator: "SERVER_CREATE_VIEW_INVALID_DATA", error: true });
}
if (filterBySlateId) {
const slate = await Data.getSlateById({ id: filterBySlateId });
if (!slate) {
return res.status(403).send({ decorator: "SERVER_CREATE_VIEW_INVALID_DATA", error: true });
}
}
const userInfo = await RequestUtilities.checkAuthorizationInternal(req, res);
if (!userInfo) return;