Skip to content

Commit 56b29b5

Browse files
chore: rename app.ts to bootstrap.ts on api-v2 (calcom#26604)
1 parent b6c243f commit 56b29b5

85 files changed

Lines changed: 148 additions & 145 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
11
import "./instrument";
22

3-
import { HttpExceptionFilter } from "@/filters/http-exception.filter";
4-
import { PrismaExceptionFilter } from "@/filters/prisma-exception.filter";
5-
import { ZodExceptionFilter } from "@/filters/zod-exception.filter";
6-
import type { ValidationError } from "@nestjs/common";
7-
import { BadRequestException, ValidationPipe, VersioningType } from "@nestjs/common";
8-
import { BaseExceptionFilter, HttpAdapterHost } from "@nestjs/core";
9-
import type { NestExpressApplication } from "@nestjs/platform-express";
10-
import * as cookieParser from "cookie-parser";
11-
import { Request } from "express";
12-
import helmet from "helmet";
13-
3+
import process from "node:process";
144
import {
155
API_VERSIONS,
16-
VERSION_2024_04_15,
176
API_VERSIONS_ENUM,
187
CAL_API_VERSION_HEADER,
8+
VERSION_2024_04_15,
199
X_CAL_CLIENT_ID,
20-
X_CAL_SECRET_KEY,
2110
X_CAL_PLATFORM_EMBED,
11+
X_CAL_SECRET_KEY,
2212
} from "@calcom/platform-constants";
23-
13+
import type { ValidationError } from "@nestjs/common";
14+
import { BadRequestException, ValidationPipe, VersioningType } from "@nestjs/common";
15+
import type { NestExpressApplication } from "@nestjs/platform-express";
16+
import * as cookieParser from "cookie-parser";
17+
import { Request } from "express";
18+
import helmet from "helmet";
19+
import { HttpExceptionFilter } from "@/filters/http-exception.filter";
20+
import { PrismaExceptionFilter } from "@/filters/prisma-exception.filter";
21+
import { ZodExceptionFilter } from "@/filters/zod-exception.filter";
2422
import { CalendarServiceExceptionFilter } from "./filters/calendar-service-exception.filter";
2523
import { TRPCExceptionFilter } from "./filters/trpc-exception.filter";
2624

2725
export const bootstrap = (app: NestExpressApplication): NestExpressApplication => {
2826
app.enableShutdownHooks();
29-
3027
app.enableVersioning({
3128
type: VersioningType.CUSTOM,
3229
extractor: (request: unknown) => {
@@ -38,9 +35,7 @@ export const bootstrap = (app: NestExpressApplication): NestExpressApplication =
3835
},
3936
defaultVersion: VERSION_2024_04_15,
4037
});
41-
4238
app.use(helmet());
43-
4439
app.enableCors({
4540
origin: "*",
4641
methods: ["GET", "PATCH", "DELETE", "HEAD", "POST", "PUT", "OPTIONS"],
@@ -65,14 +60,13 @@ export const bootstrap = (app: NestExpressApplication): NestExpressApplication =
6560
target: true,
6661
value: true,
6762
},
68-
exceptionFactory(errors: ValidationError[]) {
63+
exceptionFactory(errors: ValidationError[]): BadRequestException {
6964
return new BadRequestException({ errors });
7065
},
7166
})
7267
);
7368

7469
// Exception filters, new filters go at the bottom, keep the order
75-
const { httpAdapter } = app.get(HttpAdapterHost);
7670
app.useGlobalFilters(new PrismaExceptionFilter());
7771
app.useGlobalFilters(new ZodExceptionFilter());
7872
app.useGlobalFilters(new HttpExceptionFilter());

apps/api/v2/src/ee/bookings/2024-04-15/controllers/bookings.controller.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { bootstrap } from "@/app";
1+
import { bootstrap } from "@/bootstrap";
22
import { AppModule } from "@/app.module";
33
import { CreateBookingInput_2024_04_15 } from "@/ee/bookings/2024-04-15/inputs/create-booking.input";
44
import { CreateRecurringBookingInput_2024_04_15 } from "@/ee/bookings/2024-04-15/inputs/create-recurring-booking.input";

apps/api/v2/src/ee/bookings/2024-04-15/controllers/managed-user-bookings.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { bootstrap } from "@/app";
1+
import { bootstrap } from "@/bootstrap";
22
import { AppModule } from "@/app.module";
33
import { CreateBookingInput_2024_04_15 } from "@/ee/bookings/2024-04-15/inputs/create-booking.input";
44
import {

apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/add-guests.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { bootstrap } from "@/app";
1+
import { bootstrap } from "@/bootstrap";
22
import { AppModule } from "@/app.module";
33
import { AddGuestsOutput_2024_08_13 } from "@/ee/bookings/2024-08-13/outputs/add-guests.output";
44
import { CreateBookingOutput_2024_08_13 } from "@/ee/bookings/2024-08-13/outputs/create-booking.output";

apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/api-key-bookings.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { bootstrap } from "@/app";
1+
import { bootstrap } from "@/bootstrap";
22
import { AppModule } from "@/app.module";
33
import { CancelBookingOutput_2024_08_13 } from "@/ee/bookings/2024-08-13/outputs/cancel-booking.output";
44
import { CreateBookingOutput_2024_08_13 } from "@/ee/bookings/2024-08-13/outputs/create-booking.output";

apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/booking-access-auth.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { bootstrap } from "@/app";
1+
import { bootstrap } from "@/bootstrap";
22
import { AppModule } from "@/app.module";
33
import { CalVideoService } from "@/ee/bookings/2024-08-13/services/cal-video.service";
44
import { CreateScheduleInput_2024_04_15 } from "@/ee/schedules/schedules_2024_04_15/inputs/create-schedule.input";

apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/booking-fields.e2e-spec.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { bootstrap } from "@/app";
1+
import { bootstrap } from "@/bootstrap";
22
import { AppModule } from "@/app.module";
33
import { CreateBookingOutput_2024_08_13 } from "@/ee/bookings/2024-08-13/outputs/create-booking.output";
44
import { CreateScheduleInput_2024_04_15 } from "@/ee/schedules/schedules_2024_04_15/inputs/create-schedule.input";
@@ -20,7 +20,11 @@ import { randomString } from "test/utils/randomString";
2020
import { withApiAuth } from "test/utils/withApiAuth";
2121

2222
import { CAL_API_VERSION_HEADER, SUCCESS_STATUS, VERSION_2024_08_13 } from "@calcom/platform-constants";
23-
import { CreateBookingInput_2024_08_13, GetBookingOutput_2024_08_13, GetSeatedBookingOutput_2024_08_13 } from "@calcom/platform-types";
23+
import {
24+
CreateBookingInput_2024_08_13,
25+
GetBookingOutput_2024_08_13,
26+
GetSeatedBookingOutput_2024_08_13,
27+
} from "@calcom/platform-types";
2428
import { BookingOutput_2024_08_13 } from "@calcom/platform-types";
2529
import type { Booking, PlatformOAuthClient, Team, User, EventType } from "@calcom/prisma/client";
2630

@@ -1197,4 +1201,4 @@ describe("Bookings Endpoints 2024-08-13", () => {
11971201
function responseDataIsBooking(data: any): data is BookingOutput_2024_08_13 {
11981202
return !Array.isArray(data) && typeof data === "object" && data && "id" in data;
11991203
}
1200-
});
1204+
});

apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/calendar-links.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { bootstrap } from "@/app";
1+
import { bootstrap } from "@/bootstrap";
22
import { AppModule } from "@/app.module";
33
import { CreateScheduleInput_2024_04_15 } from "@/ee/schedules/schedules_2024_04_15/inputs/create-schedule.input";
44
import { SchedulesModule_2024_04_15 } from "@/ee/schedules/schedules_2024_04_15/schedules.module";

apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/confirm-bookings.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { bootstrap } from "@/app";
1+
import { bootstrap } from "@/bootstrap";
22
import { AppModule } from "@/app.module";
33
import { CreateScheduleInput_2024_04_15 } from "@/ee/schedules/schedules_2024_04_15/inputs/create-schedule.input";
44
import { SchedulesModule_2024_04_15 } from "@/ee/schedules/schedules_2024_04_15/schedules.module";

apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/emails/confirm-emails.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { bootstrap } from "@/app";
1+
import { bootstrap } from "@/bootstrap";
22
import { AppModule } from "@/app.module";
33
import { CreateBookingOutput_2024_08_13 } from "@/ee/bookings/2024-08-13/outputs/create-booking.output";
44
import { RescheduleBookingOutput_2024_08_13 } from "@/ee/bookings/2024-08-13/outputs/reschedule-booking.output";

0 commit comments

Comments
 (0)