mirror of
https://github.com/documenso/documenso.git
synced 2025-11-10 04:22:32 +10:00
31 lines
599 B
TypeScript
31 lines
599 B
TypeScript
import { prisma } from '@documenso/prisma';
|
|
|
|
export type DeleteWebhookByIdOptions = {
|
|
id: string;
|
|
userId: number;
|
|
teamId?: number;
|
|
};
|
|
|
|
export const deleteWebhookById = async ({ id, userId, teamId }: DeleteWebhookByIdOptions) => {
|
|
return await prisma.webhook.delete({
|
|
where: {
|
|
id,
|
|
...(teamId
|
|
? {
|
|
team: {
|
|
id: teamId,
|
|
members: {
|
|
some: {
|
|
userId,
|
|
},
|
|
},
|
|
},
|
|
}
|
|
: {
|
|
userId,
|
|
teamId: null,
|
|
}),
|
|
},
|
|
});
|
|
};
|