feat: v2 multiple length event types and their bookings (#17598)
* feat: input lengthInMinutesOptions * Revert "feat: input lengthInMinutesOptions" This reverts commit f23fd8a3861097f0972cc6210b47f25511d85183. * feat: handle lengthInMinutesOptions input * feat: handle lengthInMinutesOptions event output * fix: remove it.only * feat: variable length bookings
This commit is contained in:
1 parent
0da3a9fa11
commit
0dde8c1db9
9 files changed
+353
-2
No files matched your search
@@ -64,6 +64,16 @@ export class CreateBookingInput_2024_08_13 {
|
||||
@IsDateString()
|
||||
start!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
@ApiProperty({
|
||||
example: 30,
|
||||
description: `If it is an event type that has multiple possible lengths that attendee can pick from, you can pass the desired booking length here.
|
||||
If not provided then event type default length will be used for the booking.`,
|
||||
})
|
||||
lengthInMinutes?: number;
|
||||
|
||||
@ApiProperty({
|
||||
type: Number,
|
||||
description: "The ID of the event type that is booked.",
|
||||
|
||||
+15
@@ -14,6 +14,8 @@ import {
|
||||
IsEnum,
|
||||
IsArray,
|
||||
ValidateNested,
|
||||
ArrayNotEmpty,
|
||||
ArrayUnique,
|
||||
} from "class-validator";
|
||||
|
||||
import { SchedulingType } from "@calcom/platform-enums";
|
||||
@@ -108,6 +110,19 @@ export class CreateEventTypeInput_2024_06_14 {
|
||||
@DocsProperty({ example: CREATE_EVENT_LENGTH_EXAMPLE })
|
||||
lengthInMinutes!: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ArrayNotEmpty()
|
||||
@ArrayUnique()
|
||||
@IsInt({ each: true })
|
||||
@Min(1, { each: true })
|
||||
@DocsProperty({
|
||||
example: [15, 30, 60],
|
||||
description:
|
||||
"If you want that user can choose between different lengths of the event you can specify them here. Must include the provided `lengthInMinutes`.",
|
||||
})
|
||||
lengthInMinutesOptions?: number[];
|
||||
|
||||
@IsString()
|
||||
@DocsProperty({ example: CREATE_EVENT_TITLE_EXAMPLE })
|
||||
title!: string;
|
||||
|
||||
+24
-1
@@ -5,7 +5,17 @@ import {
|
||||
ApiExtraModels,
|
||||
} from "@nestjs/swagger";
|
||||
import { Type, Transform } from "class-transformer";
|
||||
import { IsString, IsInt, IsBoolean, IsOptional, Min, ValidateNested, IsArray } from "class-validator";
|
||||
import {
|
||||
IsString,
|
||||
IsInt,
|
||||
IsBoolean,
|
||||
IsOptional,
|
||||
Min,
|
||||
ValidateNested,
|
||||
IsArray,
|
||||
ArrayNotEmpty,
|
||||
ArrayUnique,
|
||||
} from "class-validator";
|
||||
|
||||
import { BookerLayouts_2024_06_14 } from "./booker-layouts.input";
|
||||
import type { InputBookingField_2024_06_14 } from "./booking-fields.input";
|
||||
@@ -99,6 +109,19 @@ export class UpdateEventTypeInput_2024_06_14 {
|
||||
@DocsPropertyOptional({ example: CREATE_EVENT_LENGTH_EXAMPLE })
|
||||
lengthInMinutes?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ArrayNotEmpty()
|
||||
@ArrayUnique()
|
||||
@IsInt({ each: true })
|
||||
@Min(1, { each: true })
|
||||
@DocsProperty({
|
||||
example: [15, 30, 60],
|
||||
description:
|
||||
"If you want that user can choose between different lengths of the event you can specify them here. Must include the provided `lengthInMinutes`.",
|
||||
})
|
||||
lengthInMinutesOptions?: number[];
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@DocsPropertyOptional({ example: CREATE_EVENT_TITLE_EXAMPLE })
|
||||
|
||||
+15
@@ -1,6 +1,8 @@
|
||||
import { ApiProperty as DocsProperty, ApiExtraModels, getSchemaPath } from "@nestjs/swagger";
|
||||
import { Type } from "class-transformer";
|
||||
import {
|
||||
ArrayNotEmpty,
|
||||
ArrayUnique,
|
||||
IsArray,
|
||||
IsBoolean,
|
||||
IsEnum,
|
||||
@@ -133,6 +135,19 @@ class BaseEventTypeOutput_2024_06_14 {
|
||||
@DocsProperty({ example: 60 })
|
||||
lengthInMinutes!: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ArrayNotEmpty()
|
||||
@ArrayUnique()
|
||||
@IsInt({ each: true })
|
||||
@Min(1, { each: true })
|
||||
@DocsProperty({
|
||||
example: [15, 30, 60],
|
||||
description:
|
||||
"If you want that user can choose between different lengths of the event you can specify them here. Must include the provided `lengthInMinutes`.",
|
||||
})
|
||||
lengthInMinutesOptions?: number[];
|
||||
|
||||
@IsString()
|
||||
@DocsProperty({ example: "Learn the secrets of masterchief!" })
|
||||
title!: string;
|
||||
|
||||
Reference in new issue
Block a user