feat: add recipient creation

This commit is contained in:
Mythie
2024-01-22 17:38:02 +11:00
parent b6aface982
commit 5a28eaa4ff
11 changed files with 187 additions and 218 deletions

View File

@ -1,5 +1,17 @@
import type { NextApiRequest, NextApiResponse } from 'next';
import { createNextRouter } from '@documenso/api/next';
import { ApiContractV1 } from '@documenso/api/v1/contract';
import { ApiContractV1Implementation } from '@documenso/api/v1/implementation';
export default createNextRouter(ApiContractV1, ApiContractV1Implementation);
const nextRouteHandler = createNextRouter(ApiContractV1, ApiContractV1Implementation, {
responseValidation: false,
});
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
// TODO: Dirty hack to make ts-rest handler work with next.js in a more intuitive way.
req.query['ts-rest'] = Array.isArray(req.query['ts-rest']) ? req.query['ts-rest'] : []; // Make `ts-rest` an array.
req.query['ts-rest'].unshift('api', 'v1'); // Prepend our base path to the array.
return await nextRouteHandler(req, res);
}