mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 16:23:06 +10:00
Currently the majority of folder mutations only work if the user is the owner of the folder.
31 lines
627 B
TypeScript
31 lines
627 B
TypeScript
import type { WebhookTriggerEvents } from '@prisma/client';
|
|
|
|
import { prisma } from '@documenso/prisma';
|
|
|
|
import { buildTeamWhereQuery } from '../../utils/teams';
|
|
|
|
export type GetAllWebhooksByEventTriggerOptions = {
|
|
event: WebhookTriggerEvents;
|
|
userId: number;
|
|
teamId: number;
|
|
};
|
|
|
|
export const getAllWebhooksByEventTrigger = async ({
|
|
event,
|
|
userId,
|
|
teamId,
|
|
}: GetAllWebhooksByEventTriggerOptions) => {
|
|
return prisma.webhook.findMany({
|
|
where: {
|
|
enabled: true,
|
|
eventTriggers: {
|
|
has: event,
|
|
},
|
|
team: buildTeamWhereQuery({
|
|
teamId,
|
|
userId,
|
|
}),
|
|
},
|
|
});
|
|
};
|