mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
chore: use cuids for webhooks
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import { prisma } from '@documenso/prisma';
|
||||
|
||||
export type DeleteWebhookByIdOptions = {
|
||||
id: number;
|
||||
id: string;
|
||||
userId: number;
|
||||
};
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ import type { Prisma } from '@prisma/client';
|
||||
import { prisma } from '@documenso/prisma';
|
||||
|
||||
export type EditWebhookOptions = {
|
||||
id: number;
|
||||
id: string;
|
||||
data: Prisma.WebhookUpdateInput;
|
||||
userId: number;
|
||||
};
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { prisma } from '@documenso/prisma';
|
||||
|
||||
export type GetWebhookByIdOptions = {
|
||||
id: number;
|
||||
id: string;
|
||||
userId: number;
|
||||
};
|
||||
|
||||
|
||||
@ -7,7 +7,9 @@ import { validateApiToken } from './validateApiToken';
|
||||
export const subscribeHandler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
try {
|
||||
const { authorization } = req.headers;
|
||||
|
||||
const { webhookUrl, eventTrigger } = req.body;
|
||||
|
||||
const user = await validateApiToken({ authorization });
|
||||
|
||||
const createdWebhook = await prisma.webhook.create({
|
||||
|
||||
@ -7,7 +7,9 @@ import { validateApiToken } from './validateApiToken';
|
||||
export const unsubscribeHandler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
try {
|
||||
const { authorization } = req.headers;
|
||||
|
||||
const { webhookId } = req.body;
|
||||
|
||||
const user = await validateApiToken({ authorization });
|
||||
|
||||
const deletedWebhook = await prisma.webhook.delete({
|
||||
|
||||
Reference in New Issue
Block a user