Type fixes
This commit is contained in:
1 parent
fbbda20792
commit
0153bc583a
43 files changed
+191
-187
No files matched your search
@@ -1,4 +1,3 @@
|
||||
import { PrismaAdapter } from "@next-auth/prisma-adapter";
|
||||
import { IdentityProvider, UserPermissionRole } from "@prisma/client";
|
||||
import { readFileSync } from "fs";
|
||||
import Handlebars from "handlebars";
|
||||
@@ -185,6 +184,7 @@ if (true) {
|
||||
}
|
||||
const calcomAdapter = CalComAdapter(prisma);
|
||||
export default NextAuth({
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
adapter: calcomAdapter,
|
||||
session: {
|
||||
@@ -203,6 +203,7 @@ export default NextAuth({
|
||||
const autoMergeIdentities = async () => {
|
||||
if (!hostedCal) {
|
||||
const existingUser = await prisma.user.findFirst({
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
where: { email: token.email! },
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { OAuthReqBody } from "@boxyhq/saml-jackson";
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
|
||||
import { HttpError } from "@calcom/lib/http-error";
|
||||
|
||||
import jackson from "@lib/jackson";
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
@@ -12,10 +14,12 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
const { oauthController } = await jackson();
|
||||
const { redirect_url } = await oauthController.authorize(req.query as unknown as OAuthReqBody);
|
||||
res.redirect(302, redirect_url);
|
||||
} catch (err: any) {
|
||||
console.error("authorize error:", err);
|
||||
const { message, statusCode = 500 } = err;
|
||||
|
||||
res.status(statusCode).send(message);
|
||||
} catch (err: unknown) {
|
||||
if (err instanceof HttpError) {
|
||||
console.error("authorize error:", err);
|
||||
const { message, statusCode = 500 } = err;
|
||||
return res.status(statusCode).send(message);
|
||||
}
|
||||
return res.status(500).send("Unknown error");
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
|
||||
import { HttpError } from "@calcom/lib/http-error";
|
||||
|
||||
import jackson from "@lib/jackson";
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
@@ -12,10 +14,12 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
const { redirect_url } = await oauthController.samlResponse(req.body);
|
||||
|
||||
res.redirect(302, redirect_url);
|
||||
} catch (err: any) {
|
||||
console.error("callback error:", err);
|
||||
const { message, statusCode = 500 } = err;
|
||||
|
||||
res.status(statusCode).send(message);
|
||||
} catch (err: unknown) {
|
||||
if (err instanceof HttpError) {
|
||||
console.error("callback error:", err);
|
||||
const { message, statusCode = 500 } = err;
|
||||
return res.status(statusCode).send(message);
|
||||
}
|
||||
return res.status(500).send("Unknown error");
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Prisma, User, Booking, SchedulingType, BookingStatus } from "@prisma/client";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
import rrule from "rrule";
|
||||
|
||||
import EventManager from "@calcom/core/EventManager";
|
||||
import logger from "@calcom/lib/logger";
|
||||
|
||||
@@ -25,7 +25,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (typeof handler !== "function")
|
||||
throw new HttpError({ statusCode: 404, message: `API handler not found` });
|
||||
|
||||
const response = await handler(req, res);
|
||||
await handler(req, res);
|
||||
|
||||
return res.status(200);
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Prisma } from "@prisma/client";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
|
||||
import { getStripeCustomerId } from "@calcom/stripe/customer";
|
||||
|
||||
Reference in new issue
Block a user