fix build and pass lint

This commit is contained in:
Agusti Fernandez Pardo committed 2022-05-17 19:33:18 +02:00
1 parent 3366627835
commit 5aa0b37443
30 files changed
+193 -74

No files matched your search

+4 -1
View File
@@ -105,7 +105,10 @@ async function eventTypeById(
case "PATCH":
if (!safeBody.success) {
throw new Error("Invalid request body");
{
res.status(400).json({ message: "Invalid request body" });
return;
}
}
await prisma.eventTypeCustomInput
.update({ where: { id: safeQuery.data.id }, data: safeBody.data })
+4 -1
View File
@@ -59,7 +59,10 @@ async function createOrlistAllEventTypeCustomInputs(
* description: Authorization information is missing or invalid.
*/
const safe = schemaEventTypeCustomInputBodyParams.safeParse(body);
if (!safe.success) throw new Error("Invalid request body");
if (!safe.success) {
res.status(400).json({ message: "Invalid request body" });
return;
}
// Since we're supporting a create or connect relation on eventType, we need to treat them differently
// When using connect on event type, check if userId is the owner of the event
if (safe.data.eventType.connect && !userEventTypes.includes(safe.data.eventType.connect.id as number)) {