feat: support team webhooks

This commit is contained in:
Mythie
2024-02-27 16:56:32 +11:00
parent 7dd2bbd8ab
commit a4b1f7c983
15 changed files with 505 additions and 29 deletions

View File

@ -3,13 +3,28 @@ import { prisma } from '@documenso/prisma';
export type DeleteWebhookByIdOptions = {
id: string;
userId: number;
teamId?: number;
};
export const deleteWebhookById = async ({ id, userId }: DeleteWebhookByIdOptions) => {
export const deleteWebhookById = async ({ id, userId, teamId }: DeleteWebhookByIdOptions) => {
return await prisma.webhook.delete({
where: {
id,
userId,
...(teamId
? {
team: {
id: teamId,
members: {
some: {
userId,
},
},
},
}
: {
userId,
teamId: null,
}),
},
});
};