mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
feat: support team webhooks
This commit is contained in:
@ -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,
|
||||
}),
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user