fix: v2 seated bookings (#17045)
* fix: rely on booking uid instead of id from handleNewBooking * docs: managed user create input timeZone * fix: make bookingResponsesSchema nullable * Revert "fix: make bookingResponsesSchema nullable" This reverts commit f3127b31dd259d23cae520c994d8e712fc0fa17e. * refactor: define inputs * refactor: define outputs * refactor: bookings controller * test: first seated event test * test: recurring seated event booking * test: multiple bookings for seated event * test: fetching individual seated bookings * test: fetch all bookings * test: make reschedule seated work and test it * wip: cancel seated booking * test: cancel seated booking * refactor: dont return attendee email in seat booking responses * refactor: order of properties in response * refactor: test cleanup * refactor: simplify output booking service * refactor: flaky test * refactor: try to fix test by splitting them * try to fix test * try to fix tests
This commit is contained in:
1 parent
b768cc5b44
commit
bd4a949a7c
26 files changed
+1710
-316
No files matched your search
@@ -0,0 +1,82 @@
|
||||
import type { PipeTransform } from "@nestjs/common";
|
||||
import { Injectable, BadRequestException } from "@nestjs/common";
|
||||
import { plainToClass } from "class-transformer";
|
||||
import type { ValidationError } from "class-validator";
|
||||
import { validateSync } from "class-validator";
|
||||
|
||||
import { CancelBookingInput_2024_08_13, CancelSeatedBookingInput_2024_08_13 } from "./cancel-booking.input";
|
||||
|
||||
export type CancelBookingInput = CancelBookingInput_2024_08_13 | CancelSeatedBookingInput_2024_08_13;
|
||||
|
||||
@Injectable()
|
||||
export class CancelBookingInputPipe implements PipeTransform {
|
||||
// note(Lauris): we need empty constructor otherwise v2 can't be started due to error:
|
||||
// CancelBookingInputPipe is not a constructor
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
constructor() {}
|
||||
|
||||
transform(value: CancelBookingInput): CancelBookingInput {
|
||||
if (!value) {
|
||||
throw new BadRequestException("Body is required");
|
||||
}
|
||||
if (typeof value !== "object") {
|
||||
throw new BadRequestException("Body should be an object");
|
||||
}
|
||||
|
||||
if (this.isCancelSeatedBookingInput(value)) {
|
||||
return this.validateCancelBookingSeated(value);
|
||||
}
|
||||
|
||||
return this.validateCancelBooking(value);
|
||||
}
|
||||
|
||||
validateCancelBooking(value: CancelBookingInput_2024_08_13) {
|
||||
const object = plainToClass(CancelBookingInput_2024_08_13, value);
|
||||
|
||||
const errors = validateSync(object, {
|
||||
whitelist: true,
|
||||
forbidNonWhitelisted: true,
|
||||
skipMissingProperties: false,
|
||||
});
|
||||
|
||||
if (errors.length > 0) {
|
||||
throw new BadRequestException(this.formatErrors(errors));
|
||||
}
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
validateCancelBookingSeated(value: CancelSeatedBookingInput_2024_08_13) {
|
||||
const object = plainToClass(CancelSeatedBookingInput_2024_08_13, value);
|
||||
|
||||
const errors = validateSync(object, {
|
||||
whitelist: true,
|
||||
forbidNonWhitelisted: true,
|
||||
skipMissingProperties: false,
|
||||
});
|
||||
|
||||
if (errors.length > 0) {
|
||||
throw new BadRequestException(this.formatErrors(errors));
|
||||
}
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
private formatErrors(errors: ValidationError[]): string {
|
||||
return errors
|
||||
.map((err) => {
|
||||
const constraints = err.constraints ? Object.values(err.constraints).join(", ") : "";
|
||||
const childrenErrors =
|
||||
err.children && err.children.length > 0 ? `${this.formatErrors(err.children)}` : "";
|
||||
return `${err.property} property is wrong,${constraints} ${childrenErrors}`;
|
||||
})
|
||||
.join(", ");
|
||||
}
|
||||
|
||||
private isCancelSeatedBookingInput(
|
||||
value: CancelBookingInput
|
||||
): value is CancelSeatedBookingInput_2024_08_13 {
|
||||
return value.hasOwnProperty("seatUid");
|
||||
}
|
||||
}
|
||||
@@ -7,3 +7,13 @@ export class CancelBookingInput_2024_08_13 {
|
||||
@ApiProperty({ example: "User requested cancellation" })
|
||||
cancellationReason?: string;
|
||||
}
|
||||
|
||||
export class CancelSeatedBookingInput_2024_08_13 {
|
||||
@ApiProperty({
|
||||
type: String,
|
||||
example: "3be561a9-31f1-4b8e-aefc-9d9a085f0dd1",
|
||||
description: "Uid of the specific seat withing booking.",
|
||||
})
|
||||
@IsString()
|
||||
seatUid!: string;
|
||||
}
|
||||
@@ -185,7 +185,7 @@ export class GetBookingsInput_2024_08_13 {
|
||||
required: false,
|
||||
description:
|
||||
"Sort results by their creation time (when booking was made) in ascending or descending order.",
|
||||
example: "?sortEnd=asc OR ?sortEnd=desc",
|
||||
example: "?sortCreated=asc OR ?sortCreated=desc",
|
||||
enum: SortOrder,
|
||||
})
|
||||
sortCreated?: SortOrderType;
|
||||
|
||||
@@ -4,3 +4,5 @@ export * from "./get-bookings.input";
|
||||
export * from "./reschedule-booking.input";
|
||||
export * from "./cancel-booking.input";
|
||||
export * from "./mark-absent.input";
|
||||
export * from "./reschedule-booking-input.pipe";
|
||||
export * from "./cancel-booking-input.pipe";
|
||||
@@ -0,0 +1,87 @@
|
||||
import type { PipeTransform } from "@nestjs/common";
|
||||
import { Injectable, BadRequestException } from "@nestjs/common";
|
||||
import { plainToClass } from "class-transformer";
|
||||
import type { ValidationError } from "class-validator";
|
||||
import { validateSync } from "class-validator";
|
||||
|
||||
import {
|
||||
RescheduleBookingInput_2024_08_13,
|
||||
RescheduleSeatedBookingInput_2024_08_13,
|
||||
} from "./reschedule-booking.input";
|
||||
|
||||
export type RescheduleBookingInput =
|
||||
| RescheduleBookingInput_2024_08_13
|
||||
| RescheduleSeatedBookingInput_2024_08_13;
|
||||
|
||||
@Injectable()
|
||||
export class RescheduleBookingInputPipe implements PipeTransform {
|
||||
// note(Lauris): we need empty constructor otherwise v2 can't be started due to error:
|
||||
// RescheduleBookingInputPipe is not a constructor
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
constructor() {}
|
||||
|
||||
transform(value: RescheduleBookingInput): RescheduleBookingInput {
|
||||
if (!value) {
|
||||
throw new BadRequestException("Body is required");
|
||||
}
|
||||
if (typeof value !== "object") {
|
||||
throw new BadRequestException("Body should be an object");
|
||||
}
|
||||
|
||||
if (this.isSeatedRescheduleInput(value)) {
|
||||
return this.validateSeatedReschedule(value);
|
||||
}
|
||||
|
||||
return this.validateReschedule(value);
|
||||
}
|
||||
|
||||
validateReschedule(value: RescheduleBookingInput_2024_08_13) {
|
||||
const object = plainToClass(RescheduleBookingInput_2024_08_13, value);
|
||||
|
||||
const errors = validateSync(object, {
|
||||
whitelist: true,
|
||||
forbidNonWhitelisted: true,
|
||||
skipMissingProperties: false,
|
||||
});
|
||||
|
||||
if (errors.length > 0) {
|
||||
throw new BadRequestException(this.formatErrors(errors));
|
||||
}
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
validateSeatedReschedule(value: RescheduleSeatedBookingInput_2024_08_13) {
|
||||
const object = plainToClass(RescheduleSeatedBookingInput_2024_08_13, value);
|
||||
|
||||
const errors = validateSync(object, {
|
||||
whitelist: true,
|
||||
forbidNonWhitelisted: true,
|
||||
skipMissingProperties: false,
|
||||
});
|
||||
|
||||
if (errors.length > 0) {
|
||||
throw new BadRequestException(this.formatErrors(errors));
|
||||
}
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
private formatErrors(errors: ValidationError[]): string {
|
||||
return errors
|
||||
.map((err) => {
|
||||
const constraints = err.constraints ? Object.values(err.constraints).join(", ") : "";
|
||||
const childrenErrors =
|
||||
err.children && err.children.length > 0 ? `${this.formatErrors(err.children)}` : "";
|
||||
return `${err.property} property is wrong,${constraints} ${childrenErrors}`;
|
||||
})
|
||||
.join(", ");
|
||||
}
|
||||
|
||||
private isSeatedRescheduleInput(
|
||||
value: RescheduleBookingInput
|
||||
): value is RescheduleSeatedBookingInput_2024_08_13 {
|
||||
return "seatUid" in value;
|
||||
}
|
||||
}
|
||||
@@ -18,3 +18,20 @@ export class RescheduleBookingInput_2024_08_13 {
|
||||
})
|
||||
reschedulingReason?: string;
|
||||
}
|
||||
|
||||
export class RescheduleSeatedBookingInput_2024_08_13 {
|
||||
@IsDateString()
|
||||
@ApiProperty({
|
||||
description: "Start time in ISO 8601 format for the new booking",
|
||||
example: "2024-08-13T10:00:00Z",
|
||||
})
|
||||
start!: string;
|
||||
|
||||
@ApiProperty({
|
||||
type: String,
|
||||
example: "3be561a9-31f1-4b8e-aefc-9d9a085f0dd1",
|
||||
description: "Uid of the specific seat withing booking.",
|
||||
})
|
||||
@IsString()
|
||||
seatUid!: string;
|
||||
}
|
||||
@@ -40,6 +40,24 @@ class Attendee {
|
||||
absent!: boolean;
|
||||
}
|
||||
|
||||
export class SeatedAttendee extends Attendee {
|
||||
@ApiProperty({ type: String, example: "3be561a9-31f1-4b8e-aefc-9d9a085f0dd1" })
|
||||
@IsString()
|
||||
@Expose()
|
||||
seatUid!: string;
|
||||
|
||||
@ApiProperty({
|
||||
type: Object,
|
||||
description:
|
||||
"Booking field responses consisting of an object with booking field slug as keys and user response as values.",
|
||||
example: { customField: "customValue" },
|
||||
required: false,
|
||||
})
|
||||
@IsObject()
|
||||
@Expose()
|
||||
bookingFieldsResponses!: Record<string, unknown>;
|
||||
}
|
||||
|
||||
class Host {
|
||||
@ApiProperty({ type: Number, example: 1 })
|
||||
@IsInt()
|
||||
@@ -69,7 +87,7 @@ class EventType {
|
||||
slug!: string;
|
||||
}
|
||||
|
||||
export class BookingOutput_2024_08_13 {
|
||||
class BaseBookingOutput_2024_08_13 {
|
||||
@ApiProperty({ type: Number, example: 123 })
|
||||
@IsInt()
|
||||
@Expose()
|
||||
@@ -96,10 +114,10 @@ export class BookingOutput_2024_08_13 {
|
||||
@Expose()
|
||||
hosts!: Host[];
|
||||
|
||||
@ApiProperty({ enum: ["cancelled", "accepted", "rejected", "pending", "rescheduled"], example: "accepted" })
|
||||
@IsEnum(["cancelled", "accepted", "rejected", "pending", "rescheduled"])
|
||||
@ApiProperty({ enum: ["cancelled", "accepted", "rejected", "pending"], example: "accepted" })
|
||||
@IsEnum(["cancelled", "accepted", "rejected", "pending"])
|
||||
@Expose()
|
||||
status!: "cancelled" | "accepted" | "rejected" | "pending" | "rescheduled";
|
||||
status!: "cancelled" | "accepted" | "rejected" | "pending";
|
||||
|
||||
@ApiProperty({ type: String, required: false, example: "User requested cancellation" })
|
||||
@IsString()
|
||||
@@ -149,19 +167,6 @@ export class BookingOutput_2024_08_13 {
|
||||
@Expose()
|
||||
eventType!: EventType;
|
||||
|
||||
@ApiProperty({ type: [Attendee] })
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => Attendee)
|
||||
@Expose()
|
||||
attendees!: Attendee[];
|
||||
|
||||
@ApiProperty({ type: [String], required: false, example: ["[email protected]", "[email protected]"] })
|
||||
@IsArray()
|
||||
@IsString({ each: true })
|
||||
@IsOptional()
|
||||
@Expose()
|
||||
guests?: string[];
|
||||
|
||||
@ApiProperty({
|
||||
type: String,
|
||||
required: false,
|
||||
@@ -183,111 +188,16 @@ export class BookingOutput_2024_08_13 {
|
||||
@IsBoolean()
|
||||
@Expose()
|
||||
absentHost!: boolean;
|
||||
|
||||
@ApiProperty({
|
||||
type: Object,
|
||||
description:
|
||||
"Booking field responses consisting of an object with booking field slug as keys and user response as values.",
|
||||
example: { customField: "customValue" },
|
||||
required: false,
|
||||
})
|
||||
@IsObject()
|
||||
@Expose()
|
||||
bookingFieldsResponses!: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export class RecurringBookingOutput_2024_08_13 {
|
||||
@ApiProperty({ type: Number, example: 456 })
|
||||
@IsInt()
|
||||
@Expose()
|
||||
id!: number;
|
||||
|
||||
@ApiProperty({ type: String, example: "recurring_uid_123" })
|
||||
@IsString()
|
||||
@Expose()
|
||||
uid!: string;
|
||||
|
||||
@ApiProperty({ type: String, example: "Recurring meeting" })
|
||||
@IsString()
|
||||
@Expose()
|
||||
title!: string;
|
||||
|
||||
@ApiProperty({ type: String, example: "Learn how to integrate scheduling into marketplace." })
|
||||
@IsString()
|
||||
@Expose()
|
||||
description!: string;
|
||||
|
||||
@ApiProperty({ type: [Host] })
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => Host)
|
||||
@Expose()
|
||||
hosts!: Host[];
|
||||
|
||||
@ApiProperty({ enum: ["cancelled", "accepted", "rejected", "pending"], example: "pending" })
|
||||
@IsEnum(["cancelled", "accepted", "rejected", "pending"])
|
||||
@Expose()
|
||||
status!: "cancelled" | "accepted" | "rejected" | "pending";
|
||||
|
||||
@ApiProperty({ type: String, required: false, example: "Event was cancelled" })
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@Expose()
|
||||
cancellationReason?: string;
|
||||
|
||||
@ApiProperty({ type: String, required: false, example: "Event was rescheduled" })
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@Expose()
|
||||
reschedulingReason?: string;
|
||||
|
||||
@ApiProperty({ type: String, required: false, example: "previous_recurring_uid_123" })
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@Expose()
|
||||
rescheduledFromUid?: string;
|
||||
|
||||
@ApiProperty({ type: String, example: "2024-08-13T15:30:00Z" })
|
||||
@IsDateString()
|
||||
@Expose()
|
||||
start!: string;
|
||||
|
||||
@ApiProperty({ type: String, example: "2024-08-13T16:30:00Z" })
|
||||
@IsDateString()
|
||||
@Expose()
|
||||
end!: string;
|
||||
|
||||
@ApiProperty({ type: Number, example: 30 })
|
||||
@IsInt()
|
||||
@Expose()
|
||||
duration!: number;
|
||||
|
||||
@ApiProperty({
|
||||
type: Number,
|
||||
example: 50,
|
||||
deprecated: true,
|
||||
description: "Deprecated - rely on 'eventType' object containing the id instead.",
|
||||
})
|
||||
@IsInt()
|
||||
@Expose()
|
||||
eventTypeId!: number;
|
||||
|
||||
@ApiProperty({ type: EventType })
|
||||
@Type(() => EventType)
|
||||
@Expose()
|
||||
eventType!: EventType;
|
||||
|
||||
@ApiProperty({ type: String, example: "recurring_uid_987" })
|
||||
@IsString()
|
||||
@Expose()
|
||||
recurringBookingUid!: string;
|
||||
|
||||
export class BookingOutput_2024_08_13 extends BaseBookingOutput_2024_08_13 {
|
||||
@ApiProperty({ type: [Attendee] })
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => Attendee)
|
||||
@Expose()
|
||||
attendees!: Attendee[];
|
||||
|
||||
@ApiProperty({ type: [String], required: false, example: ["guest3@example.com", "guest4@example.com"] })
|
||||
@ApiProperty({ type: [String], required: false, example: ["guest1@example.com", "guest2@example.com"] })
|
||||
@IsArray()
|
||||
@IsString({ each: true })
|
||||
@IsOptional()
|
||||
@@ -295,26 +205,22 @@ export class RecurringBookingOutput_2024_08_13 {
|
||||
guests?: string[];
|
||||
|
||||
@ApiProperty({
|
||||
type: String,
|
||||
type: Object,
|
||||
description:
|
||||
"Booking field responses consisting of an object with booking field slug as keys and user response as values.",
|
||||
example: { customField: "customValue" },
|
||||
required: false,
|
||||
description: "Deprecated - rely on 'location' field instead.",
|
||||
example: "https://example.com/recurring-meeting",
|
||||
deprecated: true,
|
||||
})
|
||||
@IsUrl()
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
@Expose()
|
||||
meetingUrl?: string;
|
||||
bookingFieldsResponses!: Record<string, unknown>;
|
||||
}
|
||||
|
||||
@ApiProperty({ type: String, required: false, example: "https://example.com/recurring-meeting" })
|
||||
@IsOptional()
|
||||
export class RecurringBookingOutput_2024_08_13 extends BookingOutput_2024_08_13 {
|
||||
@ApiProperty({ type: String, example: "recurring_uid_987" })
|
||||
@IsString()
|
||||
@Expose()
|
||||
location!: string;
|
||||
|
||||
@ApiProperty({ type: Boolean, example: false })
|
||||
@IsBoolean()
|
||||
@Expose()
|
||||
absentHost!: boolean;
|
||||
recurringBookingUid!: string;
|
||||
|
||||
@ApiProperty({
|
||||
type: Object,
|
||||
@@ -327,3 +233,61 @@ export class RecurringBookingOutput_2024_08_13 {
|
||||
@Expose()
|
||||
bookingFieldsResponses!: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export class GetSeatedBookingOutput_2024_08_13 extends BaseBookingOutput_2024_08_13 {
|
||||
@ApiProperty({ type: [SeatedAttendee] })
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => SeatedAttendee)
|
||||
@Expose()
|
||||
attendees!: SeatedAttendee[];
|
||||
}
|
||||
|
||||
export class GetRecurringSeatedBookingOutput_2024_08_13 extends BaseBookingOutput_2024_08_13 {
|
||||
@ApiProperty({ type: [SeatedAttendee] })
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => SeatedAttendee)
|
||||
@Expose()
|
||||
attendees!: SeatedAttendee[];
|
||||
|
||||
@ApiProperty({ type: String, example: "recurring_uid_987" })
|
||||
@IsString()
|
||||
@Expose()
|
||||
recurringBookingUid!: string;
|
||||
}
|
||||
|
||||
// note(Lauris): CreateSeatedBookingOutput_2024_08_13 is the same as GetSeatedBookingOutput_2024_08_13 except it has seatUid, so instead of extending BaseBookingOutput_2024_08_13
|
||||
// we could extend GetSeatedBookingOutput_2024_08_13 but the problem then is that attendees end up at the top of the response even above id
|
||||
// or uid keys making it harder to read and understand the response, so i decided to duplicate the fields here and the response is as expected - with seatUid and attendees at the bottom.
|
||||
export class CreateSeatedBookingOutput_2024_08_13 extends BaseBookingOutput_2024_08_13 {
|
||||
@ApiProperty({ type: String, example: "3be561a9-31f1-4b8e-aefc-9d9a085f0dd1" })
|
||||
@IsString()
|
||||
@Expose()
|
||||
seatUid!: string;
|
||||
|
||||
@ApiProperty({ type: [SeatedAttendee] })
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => SeatedAttendee)
|
||||
@Expose()
|
||||
attendees!: SeatedAttendee[];
|
||||
}
|
||||
|
||||
// note(Lauris): CreateRecurringSeatedBookingOutput_2024_08_13 is the same as GetRecurringSeatedBookingOutput_2024_08_13 except it has seatUid, so instead of extending BaseBookingOutput_2024_08_13
|
||||
// we could extend GetRecurringSeatedBookingOutput_2024_08_13 but the problem then is that attendees and recurringBookingUid end up at the top of the response even above id
|
||||
// or uid keys making it harder to read and understand the response, so i decided to duplicate the fields here and the response is as expected - with seatUid, attendees and recurringBookingUid at the bottom.
|
||||
export class CreateRecurringSeatedBookingOutput_2024_08_13 extends BaseBookingOutput_2024_08_13 {
|
||||
@ApiProperty({ type: String, example: "3be561a9-31f1-4b8e-aefc-9d9a085f0dd1" })
|
||||
@IsString()
|
||||
@Expose()
|
||||
seatUid!: string;
|
||||
|
||||
@ApiProperty({ type: [SeatedAttendee] })
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => SeatedAttendee)
|
||||
@Expose()
|
||||
attendees!: SeatedAttendee[];
|
||||
|
||||
@ApiProperty({ type: String, example: "recurring_uid_987" })
|
||||
@IsString()
|
||||
@Expose()
|
||||
recurringBookingUid!: string;
|
||||
}
|
||||
@@ -3,7 +3,12 @@ import { Type } from "class-transformer";
|
||||
import { IsEnum, ValidateNested } from "class-validator";
|
||||
|
||||
import { SUCCESS_STATUS, ERROR_STATUS } from "@calcom/platform-constants";
|
||||
import { BookingOutput_2024_08_13, RecurringBookingOutput_2024_08_13 } from "@calcom/platform-types";
|
||||
import {
|
||||
BookingOutput_2024_08_13,
|
||||
GetSeatedBookingOutput_2024_08_13,
|
||||
RecurringBookingOutput_2024_08_13,
|
||||
GetRecurringSeatedBookingOutput_2024_08_13,
|
||||
} from "@calcom/platform-types";
|
||||
|
||||
@ApiExtraModels(BookingOutput_2024_08_13, RecurringBookingOutput_2024_08_13)
|
||||
export class GetBookingOutput_2024_08_13 {
|
||||
@@ -17,12 +22,21 @@ export class GetBookingOutput_2024_08_13 {
|
||||
{ $ref: getSchemaPath(BookingOutput_2024_08_13) },
|
||||
{ $ref: getSchemaPath(RecurringBookingOutput_2024_08_13) },
|
||||
{ type: "array", items: { $ref: getSchemaPath(RecurringBookingOutput_2024_08_13) } },
|
||||
{ $ref: getSchemaPath(GetSeatedBookingOutput_2024_08_13) },
|
||||
{ $ref: getSchemaPath(GetRecurringSeatedBookingOutput_2024_08_13) },
|
||||
{ type: "array", items: { $ref: getSchemaPath(GetRecurringSeatedBookingOutput_2024_08_13) } },
|
||||
],
|
||||
description:
|
||||
"Booking data, which can be either a BookingOutput object, a RecurringBookingOutput object, or an array of RecurringBookingOutput objects",
|
||||
})
|
||||
@Type(() => Object)
|
||||
data!: BookingOutput_2024_08_13 | RecurringBookingOutput_2024_08_13 | RecurringBookingOutput_2024_08_13[];
|
||||
data!:
|
||||
| BookingOutput_2024_08_13
|
||||
| RecurringBookingOutput_2024_08_13
|
||||
| RecurringBookingOutput_2024_08_13[]
|
||||
| GetSeatedBookingOutput_2024_08_13
|
||||
| GetRecurringSeatedBookingOutput_2024_08_13
|
||||
| GetRecurringSeatedBookingOutput_2024_08_13[];
|
||||
|
||||
error?: Error;
|
||||
}
|
||||
@@ -2,7 +2,12 @@ import { ApiProperty, ApiExtraModels, getSchemaPath } from "@nestjs/swagger";
|
||||
import { IsEnum, ValidateNested } from "class-validator";
|
||||
|
||||
import { SUCCESS_STATUS, ERROR_STATUS } from "@calcom/platform-constants";
|
||||
import { BookingOutput_2024_08_13, RecurringBookingOutput_2024_08_13 } from "@calcom/platform-types";
|
||||
import {
|
||||
BookingOutput_2024_08_13,
|
||||
GetRecurringSeatedBookingOutput_2024_08_13,
|
||||
GetSeatedBookingOutput_2024_08_13,
|
||||
RecurringBookingOutput_2024_08_13,
|
||||
} from "@calcom/platform-types";
|
||||
|
||||
@ApiExtraModels(BookingOutput_2024_08_13, RecurringBookingOutput_2024_08_13)
|
||||
export class GetBookingsOutput_2024_08_13 {
|
||||
@@ -16,13 +21,20 @@ export class GetBookingsOutput_2024_08_13 {
|
||||
oneOf: [
|
||||
{ $ref: getSchemaPath(BookingOutput_2024_08_13) },
|
||||
{ $ref: getSchemaPath(RecurringBookingOutput_2024_08_13) },
|
||||
{ $ref: getSchemaPath(GetSeatedBookingOutput_2024_08_13) },
|
||||
{ $ref: getSchemaPath(GetRecurringSeatedBookingOutput_2024_08_13) },
|
||||
],
|
||||
},
|
||||
description:
|
||||
"Array of booking data, which can contain either BookingOutput objects or RecurringBookingOutput objects",
|
||||
})
|
||||
@ValidateNested({ each: true })
|
||||
data!: (BookingOutput_2024_08_13 | RecurringBookingOutput_2024_08_13)[];
|
||||
data!: (
|
||||
| BookingOutput_2024_08_13
|
||||
| RecurringBookingOutput_2024_08_13
|
||||
| GetSeatedBookingOutput_2024_08_13
|
||||
| GetRecurringSeatedBookingOutput_2024_08_13
|
||||
)[];
|
||||
|
||||
error?: Error;
|
||||
}
|
||||
Reference in new issue
Block a user