Merge pull request #92 from calcom/fix/disable-post-hook

fix: disable post
pull/9078/head
Agusti Fernandez Pardo 2022-05-20 22:15:58 +02:00 committed by GitHub
commit 2f9d1b97d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 14 deletions

View File

@ -55,20 +55,19 @@ async function createOrlistAllWebhooks(
* 401:
* description: Authorization information is missing or invalid.
*/
const safe = schemaWebhookCreateBodyParams.safeParse(body);
if (!safe.success) {
res.status(400).json({ message: "Invalid request body" });
return;
}
const data = await prisma.webhook.create({ data: { ...safe.data, userId } });
if (data) res.status(201).json({ webhook: data, message: "Webhook created successfully" });
else
(error: Error) =>
res.status(400).json({
message: "Could not create new webhook",
error,
});
// const safe = schemaWebhookCreateBodyParams.safeParse(body);
// if (!safe.success) {
// res.status(400).json({ message: "Invalid request body" });
// return;
// }
// const data = await prisma.webhook.create({ data: { ...safe.data, userId } });
// if (data) res.status(201).json({ webhook: data, message: "Webhook created successfully" });
// else
// (error: Error) =>
// res.status(400).json({
// message: "Could not create new webhook",
// error,
// });
} else res.status(405).json({ message: `Method ${method} not allowed` });
}