cal.pub0.org/lib/helpers/extendRequest.ts

23 lines
721 B
TypeScript
Raw Normal View History

2022-06-06 16:17:10 +00:00
import type { IncomingMessage } from "http";
import { NextMiddleware } from "next-api-middleware";
2022-06-17 23:52:37 +00:00
import type { PrismaClient } from "@calcom/prisma/client";
2022-06-06 16:17:10 +00:00
2022-06-08 16:52:25 +00:00
/** @todo figure how to use the one from `@calcom/types` */
2022-06-06 16:17:10 +00:00
/** @todo: remove once `@calcom/types` is updated with it.*/
declare module "next" {
export interface NextApiRequest extends IncomingMessage {
2022-06-08 16:52:25 +00:00
// eslint-disable-next-line @typescript-eslint/no-explicit-any
body: any;
2022-06-06 16:17:10 +00:00
userId: number;
method: string;
prisma: PrismaClient;
2022-06-08 16:52:25 +00:00
session: { user: { id: number } };
2022-06-06 16:17:10 +00:00
query: { [key: string]: string | string[] };
2022-06-17 23:52:37 +00:00
isAdmin: boolean;
2022-06-06 16:17:10 +00:00
}
}
export const extendRequest: NextMiddleware = async (req, res, next) => {
await next();
};