mirror of
https://github.com/documenso/documenso.git
synced 2026-07-27 18:35:05 +10:00
feat: support team webhooks
This commit is contained in:
@@ -4,15 +4,30 @@ import { prisma } from '@documenso/prisma';
|
||||
|
||||
export type EditWebhookOptions = {
|
||||
id: string;
|
||||
data: Prisma.WebhookUpdateInput;
|
||||
data: Omit<Prisma.WebhookUpdateInput, 'id' | 'userId' | 'teamId'>;
|
||||
userId: number;
|
||||
teamId?: number;
|
||||
};
|
||||
|
||||
export const editWebhook = async ({ id, data, userId }: EditWebhookOptions) => {
|
||||
export const editWebhook = async ({ id, data, userId, teamId }: EditWebhookOptions) => {
|
||||
return await prisma.webhook.update({
|
||||
where: {
|
||||
id,
|
||||
userId,
|
||||
...(teamId
|
||||
? {
|
||||
team: {
|
||||
id: teamId,
|
||||
members: {
|
||||
some: {
|
||||
userId,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
: {
|
||||
userId,
|
||||
teamId: null,
|
||||
}),
|
||||
},
|
||||
data: {
|
||||
...data,
|
||||
|
||||
Reference in New Issue
Block a user