Files
documenso/packages/lib/server-only/webhooks/delete-webhook-by-id.ts
David Nguyen 7abfc9e271 fix: wip
2025-05-07 15:03:20 +10:00

20 lines
543 B
TypeScript

import { prisma } from '@documenso/prisma';
import { TEAM_MEMBER_ROLE_PERMISSIONS_MAP } from '../../constants/teams';
import { buildTeamWhereQuery } from '../../utils/teams';
export type DeleteWebhookByIdOptions = {
id: string;
userId: number;
teamId: number;
};
export const deleteWebhookById = async ({ id, userId, teamId }: DeleteWebhookByIdOptions) => {
return await prisma.webhook.delete({
where: {
id,
team: buildTeamWhereQuery(teamId, userId, TEAM_MEMBER_ROLE_PERMISSIONS_MAP['MANAGE_TEAM']),
},
});
};