Scheduling infrastructure for absolutely everyone.
fix: v2 ts config and errors (#14799)
Lauris Skraucisbbad2c9d3140
diff --git a/apps/api/v2/nest-cli.json b/apps/api/v2/nest-cli.jsonindex 1eecbdbf688..45d207286db 100644--- a/apps/api/v2/nest-cli.json+++ b/apps/api/v2/nest-cli.json@@ -2,6 +2,7 @@"$schema": "https://json.schemastore.org/nest-cli","collection": "@nestjs/schematics","sourceRoot": "src",+ "entryFile": "./apps/api/v2/src/main.js","compilerOptions": {"deleteOutDir": true,"plugins": [diff --git a/apps/api/v2/package.json b/apps/api/v2/package.jsonindex f2579f48389..b92132db01f 100644--- a/apps/api/v2/package.json+++ b/apps/api/v2/package.json@@ -11,9 +11,9 @@"start": "nest start","dev:build:watch": "yarn workspace @calcom/platform-constants build:watch & yarn workspace @calcom/platform-utils build:watch & yarn workspace @calcom/platform-types build:watch & yarn workspace @calcom/platform-libraries build:watch","dev:build": "yarn workspace @calcom/platform-constants build && yarn workspace @calcom/platform-utils build && yarn workspace @calcom/platform-types build && yarn workspace @calcom/platform-libraries build",- "dev": "yarn dev:build && docker-compose up -d && yarn copy-swagger-module && nest start --watch",+ "dev": "yarn dev:build && docker-compose up -d && yarn copy-swagger-module && yarn start --watch","start:debug": "nest start --debug --watch",- "start:prod": "node dist/src/main",+ "start:prod": "node ./dist/apps/api/v2/src/main.js","test": "yarn dev:build && jest","test:watch": "yarn dev:build && jest --watch","test:cov": "yarn dev:build && jest --coverage",diff --git a/apps/api/v2/src/ee/event-types/controllers/event-types.controller.ts b/apps/api/v2/src/ee/event-types/controllers/event-types.controller.tsindex 3c8c7076fbe..557f55809bc 100644--- a/apps/api/v2/src/ee/event-types/controllers/event-types.controller.ts+++ b/apps/api/v2/src/ee/event-types/controllers/event-types.controller.ts@@ -6,7 +6,7 @@ import { DeleteEventTypeOutput } from "@/ee/event-types/outputs/delete-event-typimport { GetEventTypePublicOutput } from "@/ee/event-types/outputs/get-event-type-public.output";import { GetEventTypeOutput } from "@/ee/event-types/outputs/get-event-type.output";import { GetEventTypesPublicOutput } from "@/ee/event-types/outputs/get-event-types-public.output";-import { GetEventTypesOutput } from "@/ee/event-types/outputs/get-event-types.output";+import { GetEventTypesData, GetEventTypesOutput } from "@/ee/event-types/outputs/get-event-types.output";import { UpdateEventTypeOutput } from "@/ee/event-types/outputs/update-event-type.output";import { EventTypesService } from "@/ee/event-types/services/event-types.service";import { GetUser } from "@/modules/auth/decorators/get-user/get-user.decorator";@@ -96,7 +96,7 @@ export class EventTypesController {return {status: SUCCESS_STATUS,- data: eventTypes,+ data: eventTypes as GetEventTypesData,};}diff --git a/apps/api/v2/src/ee/event-types/outputs/event-type.output.ts b/apps/api/v2/src/ee/event-types/outputs/event-type.output.tsindex a165dfa685f..cd87c5d98e5 100644--- a/apps/api/v2/src/ee/event-types/outputs/event-type.output.ts+++ b/apps/api/v2/src/ee/event-types/outputs/event-type.output.ts@@ -59,7 +59,8 @@ export class EventTypeOutput {@IsInt()@ApiHideProperty()- position!: number;+ @IsOptional()+ position?: number;@IsInt()@ApiHideProperty()@@ -71,7 +72,8 @@ export class EventTypeOutput {@IsInt()@ApiHideProperty()- profileId!: number | null;+ @IsOptional()+ profileId?: number | null;@IsInt()@ApiHideProperty()@@ -83,7 +85,8 @@ export class EventTypeOutput {@IsInt()@ApiHideProperty()- parentId!: number | null;+ @IsOptional()+ parentId?: number | null;@IsOptional()@IsArray()@@ -176,7 +179,8 @@ export class EventTypeOutput {@IsInt()@ApiHideProperty()- scheduleId!: number | null;+ @IsOptional()+ scheduleId?: number | null;@IsNumber()@ApiHideProperty()diff --git a/apps/api/v2/src/ee/event-types/outputs/get-event-types.output.ts b/apps/api/v2/src/ee/event-types/outputs/get-event-types.output.tsindex 735db07b935..5f164a659fc 100644--- a/apps/api/v2/src/ee/event-types/outputs/get-event-types.output.ts+++ b/apps/api/v2/src/ee/event-types/outputs/get-event-types.output.ts@@ -12,7 +12,7 @@ class EventTypeGroup {eventTypes!: EventTypeOutput[];}-class GetEventTypesData {+export class GetEventTypesData {@ValidateNested({ each: true })@Type(() => EventTypeGroup)@IsArray()diff --git a/apps/api/v2/src/ee/event-types/services/event-types.service.ts b/apps/api/v2/src/ee/event-types/services/event-types.service.tsindex e55b0b1eba0..3b84a609d98 100644--- a/apps/api/v2/src/ee/event-types/services/event-types.service.ts+++ b/apps/api/v2/src/ee/event-types/services/event-types.service.ts@@ -2,6 +2,7 @@ import { DEFAULT_EVENT_TYPES } from "@/ee/event-types/constants/constants";import { EventTypesRepository } from "@/ee/event-types/event-types.repository";import { CreateEventTypeInput } from "@/ee/event-types/inputs/create-event-type.input";import { UpdateEventTypeInput } from "@/ee/event-types/inputs/update-event-type.input";+import { EventTypeOutput } from "@/ee/event-types/outputs/event-type.output";import { MembershipsRepository } from "@/modules/memberships/memberships.repository";import { PrismaWriteService } from "@/modules/prisma/prisma-write.service";import { SelectedCalendarsRepository } from "@/modules/selected-calendars/selected-calendars.repository";@@ -22,7 +23,7 @@ export class EventTypesService {private readonly dbWrite: PrismaWriteService) {}- async createUserEventType(user: UserWithProfile, body: CreateEventTypeInput) {+ async createUserEventType(user: UserWithProfile, body: CreateEventTypeInput): Promise<EventTypeOutput> {await this.checkCanCreateEventType(user.id, body);const eventTypeUser = await this.getUserToCreateEvent(user);const { eventType } = await createEventType({@@ -34,7 +35,7 @@ export class EventTypesService {prisma: this.dbWrite.prisma,},});- return eventType;+ return eventType as EventTypeOutput;}async checkCanCreateEventType(userId: number, body: CreateEventTypeInput) {@@ -88,7 +89,7 @@ export class EventTypesService {}this.checkUserOwnsEventType(user.id, eventType.eventType);- return eventType;+ return eventType as { eventType: EventTypeOutput };}async getEventTypesPublicByUsername(username: string): Promise<EventTypesPublic> {@@ -126,9 +127,13 @@ export class EventTypesService {},});- const { eventType } = await this.getUserEventTypeForAtom(user, eventTypeId);+ const eventType = await this.getUserEventTypeForAtom(user, eventTypeId);- return eventType;+ if (!eventType) {+ throw new NotFoundException(`Event type with id ${eventTypeId} not found`);+ }++ return eventType.eventType;}async checkCanUpdateEventType(userId: number, eventTypeId: number) {diff --git a/apps/api/v2/tsconfig.json b/apps/api/v2/tsconfig.jsonindex d15d17d1751..03623b53d81 100644--- a/apps/api/v2/tsconfig.json+++ b/apps/api/v2/tsconfig.json@@ -27,11 +27,17 @@"forceConsistentCasingInFileNames": false,"noFallthroughCasesInSwitch": false},- "exclude": ["./dist", "next-i18next.config.js"],+ "exclude": ["./dist", "./node_modules", "next-i18next.config.js"],"include": ["./**/*.ts","../../../packages/types/*.d.ts",- "../../../packages/platform/**/*.ts",- "../../../packages/platform/**/*.d.ts"+ "../../../packages/platform/libraries/**/*.ts",+ "../../../packages/platform/libraries/**/*.d.ts",+ "../../../packages/platform/constants/**/*.ts",+ "../../../packages/platform/constants/**/*.d.ts",+ "../../../packages/platform/types/**/*.ts",+ "../../../packages/platform/types/**/*.d.ts",+ "../../../packages/platform/utils/**/*.ts",+ "../../../packages/platform/utils/**/*.d.ts"]}