Skip to content

Scheduling infrastructure for absolutely everyone.

chore: api v2 esModuleInterop more imports (#26755)

Morganc7cd25b7d5d2
diff --git a/apps/api/v2/src/middleware/body/json.body.middleware.ts b/apps/api/v2/src/middleware/body/json.body.middleware.ts
index 8f454090cf4..242353bea75 100644
--- a/apps/api/v2/src/middleware/body/json.body.middleware.ts
+++ b/apps/api/v2/src/middleware/body/json.body.middleware.ts
@@ -1,10 +1,10 @@
import { Injectable, NestMiddleware } from "@nestjs/common";
-import * as bodyParser from "body-parser";
+import { json } from "body-parser";
import type { Request, Response } from "express";
@Injectable()
export class JsonBodyMiddleware implements NestMiddleware {
- use(req: Request, res: Response, next: () => any) {
- bodyParser.json()(req, res, next);
+ use(req: Request, res: Response, next: () => any): void {
+ json()(req, res, next);
}
}
diff --git a/apps/api/v2/src/middleware/body/raw.body.middleware.ts b/apps/api/v2/src/middleware/body/raw.body.middleware.ts
index 6cdae2f6176..6b3406d1a40 100644
--- a/apps/api/v2/src/middleware/body/raw.body.middleware.ts
+++ b/apps/api/v2/src/middleware/body/raw.body.middleware.ts
@@ -1,10 +1,10 @@
import { Injectable, NestMiddleware } from "@nestjs/common";
-import * as bodyParser from "body-parser";
+import { raw } from "body-parser";
import type { Request, Response } from "express";
@Injectable()
export class RawBodyMiddleware implements NestMiddleware {
- use(req: Request, res: Response, next: () => any) {
- bodyParser.raw({ type: "*/*" })(req, res, next);
+ use(req: Request, res: Response, next: () => any): void {
+ raw({ type: "*/*" })(req, res, next);
}
}
diff --git a/apps/api/v2/src/modules/auth/oauth2/controllers/oauth2.controller.e2e-spec.ts b/apps/api/v2/src/modules/auth/oauth2/controllers/oauth2.controller.e2e-spec.ts
index 83dba9f1160..4a823fd29b5 100644
--- a/apps/api/v2/src/modules/auth/oauth2/controllers/oauth2.controller.e2e-spec.ts
+++ b/apps/api/v2/src/modules/auth/oauth2/controllers/oauth2.controller.e2e-spec.ts
@@ -4,7 +4,7 @@ import { AccessScope, OAuthClientType } from "@calcom/prisma/enums";
import { INestApplication } from "@nestjs/common";
import { NestExpressApplication } from "@nestjs/platform-express";
import { Test, TestingModule } from "@nestjs/testing";
-import * as nextAuthJwt from "next-auth/jwt";
+import { getToken } from "next-auth/jwt";
import request from "supertest";
import { MembershipRepositoryFixture } from "test/fixtures/repository/membership.repository.fixture";
import { OAuth2ClientRepositoryFixture } from "test/fixtures/repository/oauth2-client.repository.fixture";
@@ -24,7 +24,7 @@ import { UsersModule } from "@/modules/users/users.module";
jest.mock("next-auth/jwt", () => ({
getToken: jest.fn(),
}));
-const mockGetToken = nextAuthJwt.getToken as jest.MockedFunction<typeof nextAuthJwt.getToken>;
+const mockGetToken = getToken as jest.MockedFunction<typeof getToken>;
describe("OAuth2 Controller Endpoints", () => {
describe("User Not Authenticated", () => {