mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 00:03:33 +10:00
24 lines
583 B
TypeScript
24 lines
583 B
TypeScript
import { prisma } from '@documenso/prisma';
|
|
|
|
import { TEAM_MEMBER_ROLE_PERMISSIONS_MAP } from '../../constants/teams';
|
|
import { buildTeamWhereQuery } from '../../utils/teams';
|
|
|
|
export type GetWebhookByIdOptions = {
|
|
id: string;
|
|
userId: number;
|
|
teamId: number;
|
|
};
|
|
|
|
export const getWebhookById = async ({ id, userId, teamId }: GetWebhookByIdOptions) => {
|
|
return await prisma.webhook.findFirstOrThrow({
|
|
where: {
|
|
id,
|
|
team: buildTeamWhereQuery({
|
|
teamId,
|
|
userId,
|
|
roles: TEAM_MEMBER_ROLE_PERMISSIONS_MAP.MANAGE_TEAM,
|
|
}),
|
|
},
|
|
});
|
|
};
|