feat: migrate nextjs to rr7

This commit is contained in:
David Nguyen
2025-01-02 15:33:37 +11:00
parent 9183f668d3
commit 383b5f78f0
898 changed files with 31175 additions and 24615 deletions

View File

@ -1,16 +1,20 @@
import type { NextApiRequest, NextApiResponse } from 'next';
import type { Webhook } from '@prisma/client';
import { findDocuments } from '@documenso/lib/server-only/document/find-documents';
import { getRecipientsForDocument } from '@documenso/lib/server-only/recipient/get-recipients-for-document';
import type { Webhook } from '@documenso/prisma/client';
import { getWebhooksByTeamId } from '../get-webhooks-by-team-id';
import { getWebhooksByUserId } from '../get-webhooks-by-user-id';
import { validateApiToken } from './validateApiToken';
export const listDocumentsHandler = async (req: NextApiRequest, res: NextApiResponse) => {
export const listDocumentsHandler = async (req: Request) => {
try {
const { authorization } = req.headers;
const authorization = req.headers.get('authorization');
if (!authorization) {
return new Response('Unauthorized', { status: 401 });
}
const { user, userId, teamId } = await validateApiToken({ authorization });
let allWebhooks: Webhook[] = [];
@ -55,13 +59,16 @@ export const listDocumentsHandler = async (req: NextApiRequest, res: NextApiResp
},
};
return res.status(200).json([testWebhook]);
return Response.json([testWebhook]);
}
return res.status(200).json([]);
return Response.json([]);
} catch (err) {
return res.status(500).json({
message: 'Internal Server Error',
});
return Response.json(
{
message: 'Internal Server Error',
},
{ status: 500 },
);
}
};