Fix API types, detach from main repo
parent
ff69481cb9
commit
b7e65e31d6
|
@ -9,7 +9,7 @@ const LOCAL_CONSOLE_URL = process.env.NEXT_PUBLIC_CONSOLE_URL || CONSOLE_URL;
|
|||
export const customPrismaClient: NextMiddleware = async (req, res, next) => {
|
||||
const {
|
||||
query: { key },
|
||||
}: { query: { key?: string } } = req;
|
||||
} = req;
|
||||
// If no custom api Id is provided, attach to request the regular cal.com prisma client.
|
||||
if (!key) {
|
||||
req.prisma = new PrismaClient();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { NextApiRequest } from "next/types";
|
||||
import type { NextApiRequest } from "next";
|
||||
|
||||
import { UserPermissionRole } from "@calcom/prisma/enums";
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
import type { Session } from "next-auth";
|
||||
import type { NextApiRequest as BaseNextApiRequest } from "next/types";
|
||||
|
||||
import type { PrismaClient } from "@calcom/prisma/client";
|
||||
|
||||
export type * from "next/types";
|
||||
|
||||
export declare module "next" {
|
||||
interface NextApiRequest extends BaseNextApiRequest {
|
||||
session?: Session | null;
|
||||
|
||||
userId: number;
|
||||
method: string;
|
||||
prisma: PrismaClient;
|
||||
// session: { user: { id: number } };
|
||||
// query: Partial<{ [key: string]: string | string[] }>;
|
||||
isAdmin: boolean;
|
||||
isCustomPrisma: boolean;
|
||||
pagination: { take: number; skip: number };
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
import modifyRes from "modify-response-middleware";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
import { use } from "next-api-middleware";
|
||||
import { withSwagger } from "next-swagger-doc";
|
||||
import type { NextApiRequest, NextApiResponse } from "next/types";
|
||||
|
||||
import pjson from "~/package.json";
|
||||
|
||||
|
|
Loading…
Reference in New Issue