fix: v2 ts config and errors (#14799)

* fix: exclude platform examples

* fix: v2 event-types TS errors

* fix: nest entry file

---------

Co-authored-by: Morgan Vernay <morgan@cal.com>
Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com>
This commit is contained in:
Lauris Skraucis
2024-04-29 16:06:25 +00:00
committed by GitHub
co-authored by Morgan Vernay Morgan
parent 8b28a6f5df
commit bbad2c9d31
7 changed files with 33 additions and 17 deletions
+1
View File
@@ -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": [
+2 -2
View File
@@ -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",
@@ -6,7 +6,7 @@ import { DeleteEventTypeOutput } from "@/ee/event-types/outputs/delete-event-typ
import { 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,
};
}
@@ -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()
@@ -12,7 +12,7 @@ class EventTypeGroup {
eventTypes!: EventTypeOutput[];
}
class GetEventTypesData {
export class GetEventTypesData {
@ValidateNested({ each: true })
@Type(() => EventTypeGroup)
@IsArray()
@@ -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) {
+9 -3
View File
@@ -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"
]
}