Feature: Routing Forms Webhook for Form Responses (#3444)
Co-authored-by: Omar López <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
15 files changed
+164
-22
No files matched your search
@@ -71,11 +71,13 @@ export const webhookRouter = createProtectedRouter()
|
||||
input: z
|
||||
.object({
|
||||
eventTypeId: z.number().optional(),
|
||||
appId: z.string().optional(),
|
||||
})
|
||||
.optional(),
|
||||
async resolve({ ctx, input }) {
|
||||
const where: Prisma.WebhookWhereInput = {
|
||||
AND: [{ appId: null /* Don't mixup zapier webhooks with normal ones */ }],
|
||||
/* Don't mixup zapier webhooks with normal ones */
|
||||
AND: [{ appId: !input?.appId ? null : input.appId }],
|
||||
};
|
||||
if (Array.isArray(where.AND)) {
|
||||
if (input?.eventTypeId) {
|
||||
@@ -84,6 +86,7 @@ export const webhookRouter = createProtectedRouter()
|
||||
where.AND?.push({ userId: ctx.user.id });
|
||||
}
|
||||
}
|
||||
|
||||
return await ctx.prisma.webhook.findMany({
|
||||
where,
|
||||
});
|
||||
@@ -108,6 +111,7 @@ export const webhookRouter = createProtectedRouter()
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return await ctx.prisma.webhook.create({
|
||||
data: {
|
||||
id: v4(),
|
||||
|
||||
Reference in new issue
Block a user