refactor: added ApiPropertyOptional decorator for optional fields in api for better documentation (#18208)

* update decorators 1

* update decorators 2

* update decorators 3

* update decorators 4

* update decorators 4

* update decorators 6

* update decorators 7

* added documentation,json and openapi.json

* implemented feedback

* remove default values from update dto's

* update

* removed default from redirectUris
This commit is contained in:
Somay Chauhan
2024-12-17 10:29:07 +00:00
committed by GitHub
parent 5fad7c9478
commit a613c975d3
68 changed files with 1506 additions and 614 deletions
@@ -1,3 +1,4 @@
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Transform, Type } from "class-transformer";
import {
IsBoolean,
@@ -13,53 +14,66 @@ import {
class Location {
@IsString()
@ApiProperty()
optionValue!: string;
@IsString()
@ApiProperty()
value!: string;
}
class Response {
@IsString()
@ApiProperty()
name!: string;
@IsEmail()
@ApiProperty()
email!: string;
@IsArray()
@IsString({ each: true })
@ApiProperty({ type: [String] })
guests!: string[];
@IsOptional()
@ValidateNested()
@Type(() => Location)
@ApiPropertyOptional({ type: Location })
location?: Location;
@IsOptional()
@IsString()
@ApiPropertyOptional()
notes?: string;
}
export class CreateBookingInput_2024_04_15 {
@IsString()
@IsOptional()
@ApiPropertyOptional()
end?: string;
@IsString()
@ApiProperty()
start!: string;
@IsNumber()
@ApiProperty()
eventTypeId!: number;
@IsString()
@IsOptional()
@ApiPropertyOptional()
eventTypeSlug?: string;
@IsString()
@IsOptional()
@ApiPropertyOptional()
rescheduleUid?: string;
@IsTimeZone()
@ApiProperty()
timeZone!: string;
@Transform(({ value }: { value: string | string[] }) => {
@@ -68,38 +82,48 @@ export class CreateBookingInput_2024_04_15 {
@IsOptional()
@IsArray()
@IsString({ each: true })
@ApiPropertyOptional({ type: [String] })
user?: string[];
@IsString()
@ApiProperty()
language!: string;
@IsString()
@IsOptional()
@ApiPropertyOptional()
bookingUid?: string;
@IsObject()
@ApiProperty({ type: Object })
metadata!: Record<string, string>;
@IsBoolean()
@IsOptional()
@ApiPropertyOptional()
hasHashedBookingLink?: boolean;
@IsString()
@IsOptional()
@ApiPropertyOptional()
hashedLink!: string | null;
@IsString()
@IsOptional()
@ApiPropertyOptional()
seatReferenceUid?: string;
@Type(() => Response)
@ApiProperty({ type: Response })
responses!: Response;
@IsString()
@IsOptional()
@ApiPropertyOptional()
orgSlug?: string;
@IsString()
@IsOptional()
@ApiPropertyOptional()
locationUrl?: string;
}
@@ -1,4 +1,5 @@
import { CreateBookingInput_2024_04_15 } from "@/ee/bookings/2024-04-15/inputs/create-booking.input";
import { ApiPropertyOptional } from "@nestjs/swagger";
import { IsBoolean, IsString, IsNumber, IsOptional } from "class-validator";
import type { AppsStatus } from "@calcom/platform-libraries";
@@ -6,23 +7,29 @@ import type { AppsStatus } from "@calcom/platform-libraries";
export class CreateRecurringBookingInput_2024_04_15 extends CreateBookingInput_2024_04_15 {
@IsBoolean()
@IsOptional()
@ApiPropertyOptional()
noEmail?: boolean;
@IsOptional()
@IsNumber()
@ApiPropertyOptional()
recurringCount?: number;
@IsOptional()
@ApiPropertyOptional({ type: [Object] })
appsStatus?: AppsStatus[] | undefined;
@IsOptional()
@ApiPropertyOptional({ type: [Object] })
allRecurringDates?: Record<string, string>[];
@IsOptional()
@IsNumber()
@ApiPropertyOptional()
currentRecurringIndex?: number;
@IsString()
@IsOptional()
@ApiPropertyOptional()
recurringEventId?: string;
}
@@ -1,22 +1,27 @@
import { ApiPropertyOptional, ApiProperty } from "@nestjs/swagger";
import { Type } from "class-transformer";
import { IsOptional, IsArray, IsEmail, IsBoolean, ValidateNested } from "class-validator";
class Attendee {
@IsEmail()
@ApiProperty()
email!: string;
@IsBoolean()
@ApiProperty()
noShow!: boolean;
}
export class MarkNoShowInput_2024_04_15 {
@IsBoolean()
@IsOptional()
@ApiPropertyOptional()
noShowHost?: boolean;
@ValidateNested()
@Type(() => Attendee)
@IsArray()
@IsOptional()
@ApiPropertyOptional({ type: [Attendee] })
attendees?: Attendee[];
}
@@ -1,4 +1,4 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Type } from "class-transformer";
import {
IsString,
@@ -17,145 +17,185 @@ import { SUCCESS_STATUS, ERROR_STATUS } from "@calcom/platform-constants";
class Metadata {
@IsUrl()
@ApiProperty()
videoCallUrl!: string;
}
class Location {
@IsString()
@ApiProperty()
optionValue!: string;
@IsString()
@ApiProperty()
value!: string;
}
class Response {
@IsString()
@ApiProperty()
name!: string;
@IsEmail()
@ApiProperty()
email!: string;
@IsString()
@ApiProperty()
notes!: string;
@IsArray()
@IsString({ each: true })
@ApiProperty({ type: [String] })
guests!: string[];
@ValidateNested()
@Type(() => Location)
@ApiProperty({ type: Location })
location!: Location;
}
class User {
@IsInt()
@ApiProperty()
id!: number;
@IsString()
@ApiProperty({ type: String, nullable: true })
name!: string | null;
@IsEmail()
@ApiProperty()
email!: string;
@IsString()
@ApiProperty({ type: String, nullable: true })
username!: string | null;
@IsString()
@ApiProperty()
timeZone!: string;
}
class Attendee {
@IsString()
@ApiProperty()
name!: string;
@IsEmail()
@ApiProperty()
email!: string;
@IsString()
@ApiProperty()
timeZone!: string;
}
class EventType {
@IsOptional()
@IsString()
@ApiProperty({ type: String, nullable: true })
eventName!: string | null;
@IsString()
@ApiProperty()
slug!: string;
@IsOptional()
@IsString()
@ApiProperty({ type: String, nullable: true })
timeZone!: string | null;
}
class GetBookingData_2024_04_15 {
@IsString()
@ApiProperty()
title!: string;
@IsInt()
@ApiProperty()
id!: number;
@IsString()
@ApiProperty()
uid!: string;
@IsString()
@ApiProperty({ type: String, nullable: true })
description!: string | null;
@IsObject()
@ApiProperty({ type: Object })
customInputs!: any;
@IsOptional()
@IsString()
@ApiProperty({ type: String, nullable: true })
smsReminderNumber!: string | null;
@IsOptional()
@IsString()
@ApiProperty({ type: String, nullable: true })
recurringEventId!: string | null;
@IsDateString()
@ApiProperty()
startTime!: Date;
@IsDateString()
@ApiProperty()
endTime!: Date;
@IsUrl()
@ApiProperty({ type: String, nullable: true })
location!: string | null;
@IsString()
@ApiProperty()
status!: string;
@Type(() => Metadata)
@ApiProperty({ type: Metadata })
metadata!: Metadata | any;
@IsOptional()
@IsString()
@ApiProperty({ type: String, nullable: true })
cancellationReason!: string | null;
@ValidateNested()
@Type(() => Response)
@ApiProperty({ type: Response })
responses!: Response | any;
@IsOptional()
@IsString()
@ApiProperty({ type: String, nullable: true })
rejectionReason!: string | null;
@IsString()
@IsEmail()
@ApiProperty({ type: String, nullable: true })
userPrimaryEmail!: string | null;
@ValidateNested()
@Type(() => User)
@ApiProperty({ type: User, nullable: true })
user!: User | null;
@ValidateNested()
@Type(() => Attendee)
@IsArray()
@ApiProperty({ type: [Attendee] })
attendees!: Attendee[];
@IsInt()
@ApiProperty({ type: Number, nullable: true })
eventTypeId!: number | null;
@ValidateNested()
@Type(() => EventType)
@ApiProperty({ type: EventType, nullable: true })
eventType!: EventType | null;
}
@@ -1,4 +1,4 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Type } from "class-transformer";
import {
IsString,
@@ -26,179 +26,230 @@ enum Status {
class Attendee {
@IsInt()
@ApiProperty()
id!: number;
@IsEmail()
@ApiProperty()
email!: string;
@IsString()
@ApiProperty()
name!: string;
@IsString()
@ApiProperty()
timeZone!: string;
@IsString()
@ApiProperty({ type: String, nullable: true })
locale!: string | null;
@IsInt()
@ApiProperty({ type: Number, nullable: true })
bookingId!: number | null;
}
class EventType {
@IsString()
@IsOptional()
@IsString()
@ApiPropertyOptional()
slug?: string;
@IsOptional()
@IsInt()
@ApiPropertyOptional()
id?: number;
@IsOptional()
@IsString()
@ApiProperty({ type: String, nullable: true })
eventName?: string | null;
@IsInt()
@ApiProperty()
price!: number;
@IsOptional()
@ApiPropertyOptional()
recurringEvent?: any;
@IsString()
@ApiProperty()
currency!: string;
@IsObject()
@ApiProperty()
metadata!: any;
@IsBoolean()
@IsOptional()
seatsShowAttendees?: boolean | undefined | null;
@ApiPropertyOptional({ type: Boolean, nullable: true })
seatsShowAttendees?: boolean | null;
@IsBoolean()
@IsOptional()
seatsShowAvailabilityCount?: boolean | undefined | null;
@ApiPropertyOptional({ type: Boolean, nullable: true })
seatsShowAvailabilityCount?: boolean | null;
@IsOptional()
@ApiPropertyOptional({ nullable: true })
team?: any | null;
}
class Reference {
@IsInt()
@ApiProperty()
id!: number;
@IsString()
@ApiProperty()
type!: string;
@IsString()
@ApiProperty()
uid!: string;
@IsOptional()
@IsString()
@ApiProperty({ type: String, nullable: true })
meetingId?: string | null;
@IsOptional()
@IsString()
@ApiProperty({ type: String, nullable: true })
thirdPartyRecurringEventId?: string | null;
@IsString()
@ApiProperty({ type: String, nullable: true })
meetingPassword!: string | null;
@IsOptional()
@IsString()
@ApiProperty({ type: String, nullable: true })
meetingUrl?: string | null;
@IsInt()
@ApiProperty({ type: Number, nullable: true })
bookingId!: number | null;
@IsEmail()
@ApiProperty({ type: String, nullable: true })
externalCalendarId!: string | null;
@IsOptional()
@ApiPropertyOptional()
deleted?: any;
@IsInt()
@ApiProperty({ type: Number, nullable: true })
credentialId!: number | null;
}
class User {
@IsInt()
@ApiProperty()
id!: number;
@IsString()
@ApiProperty({ type: String, nullable: true })
name!: string | null;
@IsEmail()
@ApiProperty()
email!: string;
}
class GetBookingsDataEntry {
@IsInt()
@ApiProperty()
id!: number;
@IsString()
@ApiProperty()
title!: string;
@IsOptional()
@IsEmail()
@ApiProperty({ type: String, nullable: true })
userPrimaryEmail?: string | null;
@IsString()
@ApiProperty({ type: String, nullable: true })
description!: string | null;
@IsObject()
@ApiProperty({ type: Object })
customInputs!: object | any;
@IsDateString()
@ApiProperty()
startTime!: string;
@IsDateString()
@ApiProperty()
endTime!: string;
@ValidateNested({ each: true })
@Type(() => Attendee)
@IsArray()
@ApiProperty({ type: [Attendee] })
attendees!: Attendee[];
@ApiProperty()
metadata!: any;
@IsString()
@ApiProperty()
uid!: string;
@IsOptional()
@IsString()
@ApiProperty({ type: String, nullable: true })
recurringEventId!: string | null;
@IsUrl()
@ApiProperty({ type: String, nullable: true })
location!: string | null;
@ValidateNested()
@Type(() => EventType)
@ApiProperty({ type: EventType })
eventType!: EventType;
@IsEnum(Status)
status!: "CANCELLED" | "REJECTED" | "ACCEPTED" | "PENDING" | "AWAITING_HOST";
@ApiProperty({ enum: Status, type: String })
status!: Status;
@IsBoolean()
@ApiProperty({ type: Boolean })
paid!: boolean;
@IsArray()
@ApiProperty()
payment!: any[];
@ValidateNested()
@Type(() => Reference)
@IsArray()
@ApiProperty({ type: [Reference] })
references!: Reference[];
@IsBoolean()
@ApiProperty({ type: Boolean })
isRecorded!: boolean;
@IsArray()
@ApiProperty()
seatsReferences!: any[];
@ValidateNested()
@Type(() => User)
@ApiProperty({ type: User })
user!: User | null;
@IsOptional()
@ApiPropertyOptional()
rescheduled?: any;
}
@@ -206,17 +257,20 @@ class GetBookingsData_2024_04_15 {
@ValidateNested()
@Type(() => GetBookingsDataEntry)
@IsArray()
@ApiProperty({ type: [GetBookingsDataEntry] })
bookings!: GetBookingsDataEntry[];
@IsArray()
@ApiProperty()
recurringInfo!: any[];
@IsInt()
@ApiProperty({ type: Number, nullable: true })
nextCursor!: number | null;
}
export class GetBookingsOutput_2024_04_15 {
@ApiProperty({ example: SUCCESS_STATUS, enum: [SUCCESS_STATUS, ERROR_STATUS] })
@ApiProperty({ example: SUCCESS_STATUS, enum: [SUCCESS_STATUS, ERROR_STATUS], type: String })
@IsEnum([SUCCESS_STATUS, ERROR_STATUS])
status!: typeof SUCCESS_STATUS | typeof ERROR_STATUS;
@@ -1,4 +1,4 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Type } from "class-transformer";
import { IsString, IsEnum, IsOptional, ValidateNested, IsArray, IsEmail, IsBoolean } from "class-validator";
@@ -6,24 +6,29 @@ import { SUCCESS_STATUS, ERROR_STATUS } from "@calcom/platform-constants";
class Attendee {
@IsEmail()
@ApiProperty()
email!: string;
@IsBoolean()
@ApiProperty()
noShow!: boolean;
}
class HandleMarkNoShowData_2024_04_15 {
@IsString()
@ApiProperty()
message!: string;
@IsBoolean()
@IsOptional()
@ApiPropertyOptional()
noShowHost?: boolean;
@ValidateNested()
@Type(() => Attendee)
@IsArray()
@IsOptional()
@ApiPropertyOptional({ type: [Attendee] })
attendees?: Attendee[];
}
@@ -1,4 +1,4 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import {
ArrayNotEmpty,
IsBoolean,
@@ -50,11 +50,10 @@ export class CreateIcsFeedInputDto {
urls!: string[];
@IsBoolean()
@ApiProperty({
@ApiPropertyOptional({
example: false,
description: "Whether to allowing writing to the calendar or not",
type: "boolean",
required: false,
default: true,
})
@IsOptional()
@@ -1,4 +1,4 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Type } from "class-transformer";
import { IsArray, IsDate, IsEnum, IsOptional, IsString, ValidateNested } from "class-validator";
@@ -6,13 +6,16 @@ import { SUCCESS_STATUS, ERROR_STATUS } from "@calcom/platform-constants";
export class BusyTimesOutput {
@IsDate()
@ApiProperty({ type: Date })
start!: Date;
@IsDate()
@ApiProperty({ type: Date })
end!: Date;
@IsOptional()
@IsString()
@ApiPropertyOptional({ type: String, nullable: true })
source?: string | null;
}
@@ -24,5 +27,6 @@ export class GetBusyTimesOutput {
@ValidateNested()
@Type(() => BusyTimesOutput)
@IsArray()
@ApiProperty({ type: [BusyTimesOutput] })
data!: BusyTimesOutput[];
}
@@ -1,4 +1,4 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Type } from "class-transformer";
import {
IsArray,
@@ -18,195 +18,246 @@ import { SUCCESS_STATUS, ERROR_STATUS } from "@calcom/platform-constants";
class Integration {
@IsOptional()
@IsObject()
@ApiPropertyOptional({ type: Object, nullable: true })
appData?: object | null;
@IsOptional()
@IsString()
@ApiPropertyOptional()
dirName?: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
__template?: string;
@IsString()
@ApiProperty()
name!: string;
@IsString()
@ApiProperty()
description!: string;
@IsOptional()
@IsBoolean()
@ApiPropertyOptional()
installed?: boolean;
@IsString()
@ApiProperty()
type!: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
title?: string;
@IsString()
@ApiProperty()
variant!: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
category?: string;
@IsArray()
@IsString({ each: true })
@ApiProperty({ type: [String] })
categories!: string[];
@IsString()
@ApiProperty()
logo!: string;
@IsString()
@ApiProperty()
publisher!: string;
@IsString()
@ApiProperty()
slug!: string;
@IsUrl()
@ApiProperty()
url!: string;
@IsEmail()
@ApiProperty()
email!: string;
@IsOptional()
@IsObject()
@ApiProperty({ type: Object, nullable: true })
locationOption!: object | null;
}
class Primary {
@IsEmail()
@ApiProperty()
externalId!: string;
@IsString()
@IsOptional()
@ApiPropertyOptional()
integration?: string;
@IsOptional()
@IsEmail()
@ApiPropertyOptional()
name?: string;
@IsBoolean()
@ApiProperty({ type: Boolean, nullable: true })
primary!: boolean | null;
@IsBoolean()
@ApiProperty()
readOnly!: boolean;
@IsEmail()
@IsOptional()
@ApiPropertyOptional()
email?: string;
@IsBoolean()
@ApiProperty()
isSelected!: boolean;
@IsInt()
@ApiProperty()
credentialId!: number;
}
export class Calendar {
@IsEmail()
@ApiProperty()
externalId!: string;
@IsString()
@IsOptional()
@ApiPropertyOptional()
integration?: string;
@IsEmail()
@IsOptional()
@ApiPropertyOptional()
name?: string;
@IsOptional()
@IsBoolean()
@ApiPropertyOptional({ type: Boolean, nullable: true })
primary?: boolean | null;
@IsBoolean()
@ApiProperty()
readOnly!: boolean;
@IsEmail()
@IsOptional()
@ApiPropertyOptional()
email?: string;
@IsBoolean()
@ApiProperty()
isSelected!: boolean;
@IsInt()
@ApiProperty()
credentialId!: number;
}
export class ConnectedCalendar {
@ValidateNested()
@IsObject()
@ApiProperty({ type: Integration })
integration!: Integration;
@IsInt()
@ApiProperty()
credentialId!: number;
@ValidateNested()
@IsObject()
@IsOptional()
@ApiPropertyOptional({ type: Primary })
primary?: Primary;
@ValidateNested({ each: true })
@IsArray()
@IsOptional()
@ApiPropertyOptional({ type: [Calendar] })
calendars?: Calendar[];
}
class DestinationCalendar {
@IsInt()
@ApiProperty()
id!: number;
@IsString()
@ApiProperty()
integration!: string;
@IsEmail()
@ApiProperty()
externalId!: string;
@IsEmail()
@ApiProperty({ type: String, nullable: true })
primaryEmail!: string | null;
@IsInt()
@ApiProperty({ nullable: true })
userId!: number | null;
@IsOptional()
@IsInt()
@ApiProperty({ type: Number, nullable: true })
eventTypeId!: number | null;
@IsInt()
@ApiProperty({ type: Number, nullable: true })
credentialId!: number | null;
@IsString()
@IsOptional()
@ApiPropertyOptional({ type: String, nullable: true })
name?: string | null;
@IsBoolean()
@IsOptional()
@ApiPropertyOptional()
primary?: boolean;
@IsBoolean()
@IsOptional()
@ApiPropertyOptional()
readOnly?: boolean;
@IsEmail()
@IsOptional()
@ApiPropertyOptional()
email?: string;
@IsString()
@IsOptional()
@ApiPropertyOptional()
integrationTitle?: string;
}
export class ConnectedCalendarsData {
@ValidateNested({ each: true })
@IsArray()
@ApiProperty({ type: [ConnectedCalendar] })
connectedCalendars!: ConnectedCalendar[];
@ValidateNested()
@IsObject()
@ApiProperty({ type: DestinationCalendar })
destinationCalendar!: DestinationCalendar;
}
export class ConnectedCalendarsOutput {
@ApiProperty({ example: SUCCESS_STATUS, enum: [SUCCESS_STATUS, ERROR_STATUS] })
@IsEnum([SUCCESS_STATUS, ERROR_STATUS])
@@ -214,5 +265,6 @@ export class ConnectedCalendarsOutput {
@ValidateNested()
@Type(() => ConnectedCalendarsData)
@ApiProperty({ type: ConnectedCalendarsData })
data!: ConnectedCalendarsData;
}
@@ -1,5 +1,5 @@
import { EventTypeLocation_2024_04_15 } from "@/ee/event-types/event-types_2024_04_15/inputs/event-type-location.input";
import { ApiProperty as DocsProperty, ApiHideProperty } from "@nestjs/swagger";
import { ApiProperty as DocsProperty, ApiPropertyOptional, ApiHideProperty } from "@nestjs/swagger";
import { Type } from "class-transformer";
import {
IsString,
@@ -36,7 +36,10 @@ export class CreateEventTypeInput_2024_04_15 {
@IsOptional()
@IsString()
@DocsProperty({ example: CREATE_EVENT_DESCRIPTION_EXAMPLE })
@ApiPropertyOptional({
type: String,
example: CREATE_EVENT_DESCRIPTION_EXAMPLE,
})
description?: string;
@IsOptional()
@@ -48,30 +51,38 @@ export class CreateEventTypeInput_2024_04_15 {
@ValidateNested({ each: true })
@Type(() => EventTypeLocation_2024_04_15)
@IsArray()
@ApiPropertyOptional({
type: [EventTypeLocation_2024_04_15],
})
locations?: EventTypeLocation_2024_04_15[];
@IsBoolean()
@IsOptional()
@IsBoolean()
@ApiPropertyOptional()
disableGuests?: boolean;
@IsOptional()
@IsInt()
@Min(0)
@IsOptional()
@ApiPropertyOptional()
slotInterval?: number;
@IsOptional()
@IsInt()
@Min(0)
@IsOptional()
@ApiPropertyOptional()
minimumBookingNotice?: number;
@IsOptional()
@IsInt()
@Min(0)
@IsOptional()
@ApiPropertyOptional()
beforeEventBuffer?: number;
@IsOptional()
@IsInt()
@Min(0)
@IsOptional()
@ApiPropertyOptional()
afterEventBuffer?: number;
// @ApiHideProperty()
@@ -1,4 +1,4 @@
import { ApiProperty as DocsProperty, ApiHideProperty } from "@nestjs/swagger";
import { ApiProperty, ApiHideProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { IsString, IsNumber, IsBoolean, IsOptional, IsUrl } from "class-validator";
// note(Lauris): We will gradually expose more properties if any customer needs them.
@@ -6,7 +6,7 @@ import { IsString, IsNumber, IsBoolean, IsOptional, IsUrl } from "class-validato
export class EventTypeLocation_2024_04_15 {
@IsString()
@DocsProperty({ example: "link" })
@ApiProperty({ example: "link" })
type!: string;
@IsOptional()
@@ -16,7 +16,7 @@ export class EventTypeLocation_2024_04_15 {
@IsOptional()
@IsUrl()
@DocsProperty({ example: "https://masterchief.com/argentina/flan/video/9129412" })
@ApiPropertyOptional({ example: "https://masterchief.com/argentina/flan/video/9129412" })
link?: string;
@IsOptional()
@@ -1,4 +1,4 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiPropertyOptional } from "@nestjs/swagger";
import { Transform } from "class-transformer";
import { IsBoolean, IsOptional, IsString } from "class-validator";
@@ -6,11 +6,11 @@ export class GetPublicEventTypeQueryParams_2024_04_15 {
@Transform(({ value }: { value: string }) => value === "true")
@IsBoolean()
@IsOptional()
@ApiProperty({ required: false })
@ApiPropertyOptional()
isTeamEvent?: boolean;
@ApiProperty({ required: false })
@IsString()
@IsOptional()
@IsString()
@ApiPropertyOptional({ type: String, nullable: true })
org?: string | null;
}
@@ -2,6 +2,7 @@ import { Editable } from "@/ee/event-types/event-types_2024_04_15/inputs/enums/e
import { BaseField } from "@/ee/event-types/event-types_2024_04_15/inputs/enums/field-type";
import { Frequency } from "@/ee/event-types/event-types_2024_04_15/inputs/enums/frequency";
import { EventTypeLocation_2024_04_15 } from "@/ee/event-types/event-types_2024_04_15/inputs/event-type-location.input";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Type } from "class-transformer";
import {
IsString,
@@ -21,206 +22,259 @@ import {
class Option {
@IsString()
@ApiProperty()
value!: string;
@IsString()
@ApiProperty()
label!: string;
}
class Source {
@IsString()
@ApiProperty()
id!: string;
@IsString()
@ApiProperty()
type!: string;
@IsString()
@ApiProperty()
label!: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
editUrl?: string;
@IsOptional()
@IsBoolean()
@ApiPropertyOptional()
fieldRequired?: boolean;
}
class View {
@IsString()
@ApiProperty()
id!: string;
@IsString()
@ApiProperty()
label!: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
description?: string;
}
class OptionsInput {
@IsString()
@ApiProperty({
description: 'Type of the field, can be one of "address", "text", or "phone".',
enum: ["address", "text", "phone"],
example: "text",
})
type!: "address" | "text" | "phone";
@IsOptional()
@IsBoolean()
@ApiPropertyOptional()
required?: boolean;
@IsOptional()
@IsString()
@ApiPropertyOptional()
placeholder?: string;
}
class VariantField {
@IsString()
@ApiProperty()
type!: BaseField;
@IsString()
@ApiProperty()
name!: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
label?: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
labelAsSafeHtml?: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
placeholder?: string;
@IsOptional()
@IsBoolean()
@ApiPropertyOptional()
required?: boolean;
}
class Variant {
@ValidateNested({ each: true })
@Type(() => VariantField)
@ApiProperty({ type: [VariantField] })
fields!: VariantField[];
}
class VariantsConfig {
@ApiProperty({ type: Object })
variants!: Record<string, Variant>;
}
export class BookingField_2024_04_15 {
@IsEnum(BaseField)
@ApiProperty({ enum: BaseField })
type!: BaseField;
@IsString()
@ApiProperty()
name!: string;
@IsOptional()
@ValidateNested({ each: true })
@Type(() => Option)
@ApiPropertyOptional({ type: [Option] })
options?: Option[];
@IsOptional()
@IsString()
@ApiPropertyOptional()
label?: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
labelAsSafeHtml?: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
defaultLabel?: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
placeholder?: string;
@IsOptional()
@IsBoolean()
@ApiPropertyOptional()
required?: boolean;
@IsOptional()
@IsString()
@ApiPropertyOptional()
getOptionsAt?: string;
@IsOptional()
@IsArray()
@ValidateNested({ each: true })
@Type(() => OptionsInput)
@ApiPropertyOptional()
optionsInputs?: Record<string, OptionsInput>;
@IsOptional()
@IsString()
@ApiPropertyOptional()
variant?: string;
@IsOptional()
@ValidateNested()
@Type(() => VariantsConfig)
@ApiPropertyOptional({ type: VariantsConfig })
variantsConfig?: VariantsConfig;
@IsOptional()
@ValidateNested({ each: true })
@Type(() => View)
@ApiPropertyOptional({ type: [View] })
views?: View[];
@IsOptional()
@IsBoolean()
@ApiPropertyOptional()
hideWhenJustOneOption?: boolean;
@IsOptional()
@IsBoolean()
@ApiPropertyOptional()
hidden?: boolean;
@IsOptional()
@IsEnum(Editable)
@ApiPropertyOptional()
editable?: Editable;
@IsOptional()
@ValidateNested({ each: true })
@Type(() => Source)
@ApiPropertyOptional({ type: [Source] })
sources?: Source[];
@IsOptional()
@IsBoolean()
@ApiPropertyOptional()
disableOnPrefill?: boolean;
}
export class RecurringEvent_2024_04_15 {
@IsDate()
@IsOptional()
@ApiPropertyOptional({ type: Date })
dtstart?: Date;
@IsInt()
@ApiProperty()
interval!: number;
@IsInt()
@ApiProperty()
count!: number;
@IsEnum(Frequency)
@ApiProperty({ enum: Frequency })
freq!: Frequency;
@IsDate()
@IsOptional()
@ApiPropertyOptional({ type: Date })
until?: Date;
@IsString()
@IsOptional()
@ApiPropertyOptional()
tzid?: string;
}
export class IntervalLimits_2024_04_15 {
@IsNumber()
@IsOptional()
@ApiPropertyOptional()
PER_DAY?: number;
@IsNumber()
@IsOptional()
@ApiPropertyOptional()
PER_WEEK?: number;
@IsNumber()
@IsOptional()
@ApiPropertyOptional()
PER_MONTH?: number;
@IsNumber()
@IsOptional()
@ApiPropertyOptional()
PER_YEAR?: number;
}
@@ -228,27 +282,33 @@ export class UpdateEventTypeInput_2024_04_15 {
@IsInt()
@Min(1)
@IsOptional()
@ApiPropertyOptional()
length?: number;
@IsString()
@IsOptional()
@ApiPropertyOptional()
slug?: string;
@IsString()
@IsOptional()
@ApiPropertyOptional()
title?: string;
@IsString()
@IsOptional()
@ApiPropertyOptional()
description?: string;
@IsBoolean()
@IsOptional()
@ApiPropertyOptional()
hidden?: boolean;
@ValidateNested({ each: true })
@Type(() => EventTypeLocation_2024_04_15)
@IsOptional()
@ApiPropertyOptional({ type: [EventTypeLocation_2024_04_15] })
locations?: EventTypeLocation_2024_04_15[];
// @IsInt()
@@ -283,6 +343,7 @@ export class UpdateEventTypeInput_2024_04_15 {
@IsArray()
@ValidateNested({ each: true })
@Type(() => BookingField_2024_04_15)
@ApiPropertyOptional({ type: [BookingField_2024_04_15] })
bookingFields?: BookingField_2024_04_15[];
// @IsString()
@@ -328,6 +389,7 @@ export class UpdateEventTypeInput_2024_04_15 {
@IsBoolean()
@IsOptional()
@ApiPropertyOptional()
disableGuests?: boolean;
// @IsBoolean()
@@ -337,16 +399,19 @@ export class UpdateEventTypeInput_2024_04_15 {
@IsInt()
@Min(0)
@IsOptional()
@ApiPropertyOptional()
minimumBookingNotice?: number;
@IsInt()
@Min(0)
@IsOptional()
@ApiPropertyOptional()
beforeEventBuffer?: number;
@IsInt()
@Min(0)
@IsOptional()
@ApiPropertyOptional()
afterEventBuffer?: number;
// @IsInt()
@@ -384,6 +449,7 @@ export class UpdateEventTypeInput_2024_04_15 {
@IsInt()
@Min(0)
@IsOptional()
@ApiPropertyOptional()
slotInterval?: number;
// @IsString()
@@ -12,7 +12,7 @@ import {
IntervalLimits_2024_04_15,
RecurringEvent_2024_04_15,
} from "@/ee/event-types/event-types_2024_04_15/inputs/update-event-type.input";
import { ApiProperty as DocsProperty, ApiHideProperty } from "@nestjs/swagger";
import { ApiHideProperty, ApiProperty } from "@nestjs/swagger";
import { Type } from "class-transformer";
import {
IsArray,
@@ -29,23 +29,23 @@ import {
export class EventTypeOutput {
@IsInt()
@DocsProperty({ example: 1 })
@ApiProperty({ example: 1 })
id!: number;
@IsInt()
@DocsProperty({ example: CREATE_EVENT_LENGTH_EXAMPLE })
@ApiProperty({ example: CREATE_EVENT_LENGTH_EXAMPLE })
length!: number;
@IsString()
@DocsProperty({ example: CREATE_EVENT_SLUG_EXAMPLE })
@ApiProperty({ example: CREATE_EVENT_SLUG_EXAMPLE })
slug!: string;
@IsString()
@DocsProperty({ example: CREATE_EVENT_TITLE_EXAMPLE })
@ApiProperty({ example: CREATE_EVENT_TITLE_EXAMPLE })
title!: string;
@IsString()
@DocsProperty({ example: CREATE_EVENT_DESCRIPTION_EXAMPLE })
@ApiProperty({ example: CREATE_EVENT_DESCRIPTION_EXAMPLE, nullable: true })
description!: string | null;
@IsBoolean()
@@ -55,6 +55,7 @@ export class EventTypeOutput {
@ValidateNested({ each: true })
@Type(() => EventTypeLocation_2024_04_15)
@IsArray()
@ApiProperty({ type: [EventTypeLocation_2024_04_15], nullable: true })
locations!: EventTypeLocation_2024_04_15[] | null;
@IsInt()
@@ -1,4 +1,4 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Type } from "class-transformer";
import {
IsBoolean,
@@ -17,330 +17,421 @@ import { SUCCESS_STATUS, ERROR_STATUS } from "@calcom/platform-constants";
class Location {
@IsString()
@ApiProperty()
type!: string;
}
class Source {
@IsString()
@ApiProperty()
id!: string;
@IsString()
@ApiProperty()
type!: string;
@IsString()
@ApiProperty()
label!: string;
}
class OptionInput {
@IsString()
@ApiProperty()
type!: string;
@IsBoolean()
@IsOptional()
@ApiPropertyOptional()
required?: boolean;
@IsString()
@IsOptional()
@ApiPropertyOptional()
placeholder?: string;
}
class BookingField {
@IsString()
@ApiProperty()
name!: string;
@IsString()
@ApiProperty()
type!: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
defaultLabel?: string;
@IsString()
@IsOptional()
@ApiPropertyOptional()
label?: string;
@IsString()
@IsOptional()
@ApiPropertyOptional()
placeholder?: string;
@IsBoolean()
@IsOptional()
@ApiPropertyOptional()
required?: boolean;
@IsOptional()
@ApiPropertyOptional()
getOptionsAt?: string;
@IsObject()
@IsOptional()
@ApiPropertyOptional()
optionsInputs?: { [key: string]: OptionInput };
@IsBoolean()
@IsOptional()
@ApiPropertyOptional()
hideWhenJustOneOption?: boolean;
@IsString()
@IsOptional()
@ApiPropertyOptional()
editable?: string;
@IsArray()
@ValidateNested({ each: true })
@Type(() => Source)
@IsOptional()
@ApiPropertyOptional({ type: [Source] })
sources?: Source[];
@IsOptional()
@IsBoolean()
@ApiPropertyOptional()
disableOnPrefill?: boolean;
}
class Organization {
@IsInt()
@ApiProperty()
id!: number;
@IsString()
@IsOptional()
@ApiPropertyOptional({ type: String, nullable: true })
slug?: string | null;
@IsString()
@ApiProperty()
name!: string;
@IsOptional()
metadata!: Record<string, any>;
@ApiPropertyOptional({ type: Object })
metadata?: Record<string, any>;
}
class Profile {
@IsString()
@ApiProperty({ type: String, nullable: true })
username!: string | null;
@IsInt()
@ApiProperty({ type: Number, nullable: true })
id!: number | null;
@IsInt()
@IsOptional()
@ApiPropertyOptional()
userId?: number;
@IsString()
@IsOptional()
@ApiPropertyOptional()
uid?: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
name?: string;
@IsInt()
@ApiProperty({ type: Number, nullable: true })
organizationId!: number | null;
@ValidateNested()
@Type(() => Organization)
@ApiPropertyOptional({ type: Organization, nullable: true })
organization?: Organization | null;
@IsString()
@ApiProperty()
upId!: string;
@IsString()
@IsOptional()
@ApiPropertyOptional()
image?: string;
@IsString()
@IsOptional()
@ApiPropertyOptional()
brandColor?: string;
@IsString()
@IsOptional()
@ApiPropertyOptional()
darkBrandColor?: string;
@IsString()
@IsOptional()
@ApiPropertyOptional()
theme?: string;
@IsOptional()
@ApiPropertyOptional()
bookerLayouts?: any;
}
class Owner {
@IsInt()
@ApiProperty()
id!: number;
@IsString()
@IsOptional()
@ApiPropertyOptional({ type: String, nullable: true })
avatarUrl?: string | null;
@IsString()
@ApiProperty({ type: String, nullable: true })
username!: string | null;
@IsString()
@ApiProperty({ type: String, nullable: true })
name!: string | null;
@IsString()
@ApiProperty()
weekStart!: string;
@IsString()
@IsOptional()
@ApiPropertyOptional({ type: String, nullable: true })
brandColor?: string | null;
@IsString()
@IsOptional()
@ApiPropertyOptional({ type: String, nullable: true })
darkBrandColor?: string | null;
@IsString()
@IsOptional()
@ApiPropertyOptional({ type: String, nullable: true })
theme?: string | null;
@IsOptional()
metadata!: any;
@ApiPropertyOptional()
metadata?: any;
@IsInt()
@IsOptional()
@ApiPropertyOptional({ type: Number, nullable: true })
defaultScheduleId?: number | null;
@IsString()
@ApiProperty({ type: String, nullable: true })
nonProfileUsername!: string | null;
@ValidateNested()
@Type(() => Profile)
@ApiProperty({ type: Profile })
profile!: Profile;
}
class User {
@IsString()
@ApiProperty({ type: String, nullable: true })
username!: string | null;
@IsString()
@ApiProperty({ type: String, nullable: true })
name!: string | null;
@IsString()
@ApiProperty()
weekStart!: string;
@IsInt()
@IsOptional()
@ApiPropertyOptional()
organizationId?: number;
@IsString()
@IsOptional()
@ApiPropertyOptional({ type: String, nullable: true })
avatarUrl?: string | null;
@ValidateNested()
@ApiProperty({ type: Profile })
profile!: Profile;
@IsString()
@ApiProperty()
bookerUrl!: string;
}
class Schedule {
@IsInt()
@ApiProperty()
id!: number;
@IsString()
@ApiProperty({ type: String, nullable: true })
timeZone!: string | null;
}
class PublicEventTypeOutput {
@IsInt()
@ApiProperty()
id!: number;
@IsString()
@ApiProperty()
title!: string;
@IsString()
@ApiProperty()
description!: string;
@IsString()
@IsOptional()
@ApiPropertyOptional({ type: String, nullable: true })
eventName?: string | null;
@IsString()
@ApiProperty()
slug!: string;
@IsBoolean()
@ApiProperty()
isInstantEvent!: boolean;
@IsOptional()
@ApiPropertyOptional()
aiPhoneCallConfig?: any;
@IsOptional()
@ApiPropertyOptional()
schedulingType?: any;
@IsInt()
@ApiProperty()
length!: number;
@IsArray()
@ValidateNested({ each: true })
@Type(() => Location)
@ApiProperty({ type: [Location] })
locations!: Location[];
@IsArray()
@ApiProperty({ type: [Object] })
customInputs!: any[];
@IsBoolean()
@ApiProperty()
disableGuests!: boolean;
@IsObject()
@ApiProperty({ type: Object, nullable: true })
metadata!: object | null;
@IsBoolean()
@ApiProperty()
lockTimeZoneToggleOnBookingPage!: boolean;
@IsBoolean()
@ApiProperty()
requiresConfirmation!: boolean;
@IsBoolean()
@ApiProperty()
requiresBookerEmailVerification!: boolean;
@IsOptional()
@ApiPropertyOptional()
recurringEvent?: any;
@IsNumber()
@ApiProperty()
price!: number;
@IsString()
@ApiProperty()
currency!: string;
@IsOptional()
@ApiPropertyOptional({ type: Number, nullable: true })
seatsPerTimeSlot?: number | null;
@IsBoolean()
@ApiProperty({ type: Boolean, nullable: true })
seatsShowAvailabilityCount!: boolean | null;
@IsArray()
@ValidateNested({ each: true })
@Type(() => BookingField)
@ApiProperty({ type: [BookingField] })
bookingFields!: BookingField[];
@IsOptional()
@ApiPropertyOptional()
team?: any;
@IsOptional()
@IsUrl()
@ApiPropertyOptional({ type: String, nullable: true })
successRedirectUrl?: string | null;
@IsArray()
@ApiProperty()
workflows!: any[];
@IsArray()
@ApiProperty()
hosts!: any[];
@ValidateNested()
@Type(() => Owner)
@ApiProperty({ type: Owner, nullable: true })
owner!: Owner | null;
@ValidateNested()
@Type(() => Schedule)
@ApiProperty({ type: Schedule, nullable: true })
schedule!: Schedule | null;
@IsBoolean()
@ApiProperty()
hidden!: boolean;
@IsBoolean()
@ApiProperty()
assignAllTeamMembers!: boolean;
@IsOptional()
@ApiPropertyOptional()
bookerLayouts?: any;
@IsArray()
@ValidateNested({ each: true })
@Type(() => User)
@ApiProperty({ type: [User] })
users!: User[];
@IsObject()
@ApiProperty({ type: Object })
entity!: object;
@IsBoolean()
@@ -1,4 +1,4 @@
import { ApiProperty as DocsProperty } from "@nestjs/swagger";
import { ApiProperty as DocsProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Transform } from "class-transformer";
import { IsString, IsBoolean, IsOptional, IsEnum, Matches } from "class-validator";
@@ -38,34 +38,34 @@ export class CreatePhoneCallInput {
@IsOptional()
@IsString()
@DocsProperty({ description: "Scheduler name" })
@ApiPropertyOptional({ description: "Scheduler name" })
schedulerName?: string;
@IsOptional()
@IsString()
@Transform(({ value }) => (value ? value : undefined))
@DocsProperty({ description: "Guest name" })
@ApiPropertyOptional({ description: "Guest name" })
guestName?: string;
@IsOptional()
@IsString()
@Transform(({ value }) => (value ? value : undefined))
@DocsProperty({ description: "Guest email" })
@ApiPropertyOptional({ description: "Guest email" })
guestEmail?: string;
@IsOptional()
@IsString()
@Transform(({ value }) => (value ? value : undefined))
@DocsProperty({ description: "Guest company" })
@ApiPropertyOptional({ description: "Guest company" })
guestCompany?: string;
@IsOptional()
@IsString()
@DocsProperty({ description: "Begin message" })
@ApiPropertyOptional({ description: "Begin message" })
beginMessage?: string;
@IsOptional()
@IsString()
@DocsProperty({ description: "General prompt" })
@ApiPropertyOptional({ description: "General prompt" })
generalPrompt?: string;
}
+14 -2
View File
@@ -1,39 +1,51 @@
import { ApiProperty as DocsProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Type } from "class-transformer";
import { IsInt, IsEmail, IsOptional, IsString, ValidateNested } from "class-validator";
import { IsString, IsOptional, IsInt, IsEmail, ValidateNested } from "class-validator";
export class MeOrgOutput {
@DocsProperty()
isPlatform!: boolean;
@DocsProperty()
id!: number;
}
export class MeOutput {
@IsInt()
@DocsProperty()
id!: number;
@IsString()
@DocsProperty()
username!: string;
@IsEmail()
@DocsProperty()
email!: string;
@IsInt()
@DocsProperty()
timeFormat!: number;
@IsInt()
@IsOptional()
@DocsProperty({ type: Number, nullable: true })
defaultScheduleId!: number | null;
@IsString()
@DocsProperty()
weekStart!: string;
@IsString()
@DocsProperty()
timeZone!: string;
@IsInt()
@DocsProperty({ type: Number, nullable: true })
organizationId!: number | null;
@IsOptional()
@ValidateNested()
@Type(() => MeOrgOutput)
@ApiPropertyOptional({ type: MeOrgOutput })
organization?: MeOrgOutput;
}
@@ -1,20 +1,25 @@
import { CreateAvailabilityInput_2024_04_15 } from "@/ee/schedules/schedules_2024_04_15/inputs/create-availability.input";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Type } from "class-transformer";
import { IsArray, IsBoolean, IsTimeZone, IsOptional, IsString, ValidateNested } from "class-validator";
export class CreateScheduleInput_2024_04_15 {
@IsString()
@ApiProperty()
name!: string;
@IsTimeZone()
@ApiProperty()
timeZone!: string;
@IsArray()
@ValidateNested({ each: true })
@Type(() => CreateAvailabilityInput_2024_04_15)
@IsOptional()
@ApiPropertyOptional({ type: [CreateAvailabilityInput_2024_04_15] })
availabilities?: CreateAvailabilityInput_2024_04_15[];
@IsBoolean()
@ApiProperty()
isDefault!: boolean;
}
@@ -1,95 +1,117 @@
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Type } from "class-transformer";
import { IsBoolean, IsInt, IsOptional, IsString, ValidateNested, IsArray } from "class-validator";
class EventTypeModel_2024_04_15 {
@IsInt()
@ApiProperty()
id!: number;
@IsOptional()
@IsString()
@ApiPropertyOptional({ type: String, nullable: true })
eventName?: string | null;
}
class AvailabilityModel_2024_04_15 {
@IsInt()
@ApiProperty()
id!: number;
@IsOptional()
@IsInt()
@ApiPropertyOptional({ type: Number, nullable: true })
userId?: number | null;
@IsOptional()
@IsInt()
@ApiPropertyOptional({ type: Number, nullable: true })
scheduleId?: number | null;
@IsOptional()
@IsInt()
@ApiPropertyOptional({ type: Number, nullable: true })
eventTypeId?: number | null;
@IsArray()
@IsInt({ each: true })
@ApiProperty({ type: [Number] })
days!: number[];
@IsOptional()
@Type(() => Date)
@IsString() // Assuming date is serialized/deserialized appropriately
@IsString()
@ApiPropertyOptional()
startTime?: Date;
@IsOptional()
@Type(() => Date)
@IsString() // Assuming date is serialized/deserialized appropriately
@IsString()
@ApiPropertyOptional()
endTime?: Date;
@IsOptional()
@Type(() => Date)
@IsString() // Assuming date is serialized/deserialized appropriately
@IsString()
@ApiPropertyOptional({ type: String, nullable: true })
date?: Date | null;
}
class ScheduleModel_2024_04_15 {
@IsInt()
@ApiProperty()
id!: number;
@IsInt()
@ApiProperty()
userId!: number;
@IsString()
@ApiProperty()
name!: string;
@IsOptional()
@IsString()
@ApiPropertyOptional({ type: String, nullable: true })
timeZone?: string | null;
@IsOptional()
@ValidateNested({ each: true })
@Type(() => EventTypeModel_2024_04_15)
@IsArray()
@ApiPropertyOptional({ type: [EventTypeModel_2024_04_15] })
eventType?: EventTypeModel_2024_04_15[];
@IsOptional()
@ValidateNested({ each: true })
@Type(() => AvailabilityModel_2024_04_15)
@IsArray()
@ApiPropertyOptional({ type: [AvailabilityModel_2024_04_15] })
availability?: AvailabilityModel_2024_04_15[];
}
export class UpdatedScheduleOutput_2024_04_15 {
@ValidateNested()
@Type(() => ScheduleModel_2024_04_15)
@ApiProperty({ type: ScheduleModel_2024_04_15 })
schedule!: ScheduleModel_2024_04_15;
@IsBoolean()
@ApiProperty()
isDefault!: boolean;
@IsOptional()
@IsString()
@ApiPropertyOptional()
timeZone?: string;
@IsOptional()
@IsInt()
@ApiPropertyOptional({ type: Number, nullable: true })
prevDefaultId?: number | null;
@IsOptional()
@IsInt()
@ApiPropertyOptional({ type: Number, nullable: true })
currentDefaultId?: number | null;
}
@@ -1,105 +1,132 @@
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Type } from "class-transformer";
import { IsDate, IsOptional, IsArray, IsBoolean, IsInt, IsString, ValidateNested } from "class-validator";
class AvailabilityModel {
@IsInt()
@ApiProperty()
id!: number;
@IsOptional()
@IsInt()
@ApiPropertyOptional({ type: Number, nullable: true })
userId?: number | null;
@IsOptional()
@IsInt()
@ApiPropertyOptional({ type: Number, nullable: true })
eventTypeId?: number | null;
@IsArray()
@IsInt({ each: true })
@ApiProperty({ type: [Number] })
days!: number[];
@IsDate()
@Type(() => Date)
@ApiProperty({ type: Date })
startTime!: Date;
@IsDate()
@Type(() => Date)
@ApiProperty({ type: Date })
endTime!: Date;
@IsOptional()
@IsDate()
@Type(() => Date)
@ApiPropertyOptional({ type: Date, nullable: true })
date?: Date | null;
@IsOptional()
@IsInt()
@ApiPropertyOptional({ type: Number, nullable: true })
scheduleId?: number | null;
}
class WorkingHours {
@IsArray()
@IsInt({ each: true })
@ApiProperty({ type: [Number] })
days!: number[];
@IsInt()
@ApiProperty()
startTime!: number;
@IsInt()
@ApiProperty()
endTime!: number;
@IsOptional()
@IsInt()
@ApiPropertyOptional({ type: Number, nullable: true })
userId?: number | null;
}
class TimeRange {
@IsOptional()
@IsInt()
@ApiPropertyOptional({ type: Number, nullable: true })
userId?: number | null;
@IsDate()
@ApiProperty({ type: Date })
start!: Date;
@IsDate()
@ApiProperty({ type: Date })
end!: Date;
}
export class ScheduleOutput {
@IsInt()
@ApiProperty()
id!: number;
@IsString()
@ApiProperty()
name!: string;
@IsBoolean()
@ApiProperty()
isManaged!: boolean;
@ValidateNested({ each: true })
@Type(() => WorkingHours)
@ApiProperty({ type: [WorkingHours] })
workingHours!: WorkingHours[];
@ValidateNested({ each: true })
@Type(() => AvailabilityModel)
@IsArray()
@ApiProperty({ type: [AvailabilityModel] })
schedule!: AvailabilityModel[];
@ApiProperty({ type: [[TimeRange]] })
availability!: TimeRange[][];
@IsString()
@ApiProperty()
timeZone!: string;
@ValidateNested({ each: true })
@IsArray()
@ApiPropertyOptional({ type: [Object] })
// note(Lauris) it should be
// dateOverrides!: { ranges: TimeRange[] }[];
// but docs aren't generating correctly it results in array of strings
dateOverrides!: unknown[];
@IsBoolean()
@ApiProperty()
isDefault!: boolean;
@IsBoolean()
@ApiProperty()
isLastSchedule!: boolean;
@IsBoolean()
@ApiProperty()
readOnly!: boolean;
}
@@ -1,10 +1,12 @@
import { Transform, Type } from "class-transformer";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Transform } from "class-transformer";
import { ArrayNotEmpty, IsArray, IsInt, IsNumber, IsOptional } from "class-validator";
export class EventTypesAppInput {
@Transform(({ value }: { value: string }) => value && parseInt(value))
@IsNumber()
@IsOptional()
@ApiPropertyOptional()
teamId?: number;
}
@@ -12,5 +14,6 @@ export class BulkUpdateEventTypeToDefaultLocationDto {
@IsArray()
@ArrayNotEmpty()
@IsInt({ each: true })
@ApiProperty({ type: [Number] })
eventTypeIds!: number[];
}
@@ -1,4 +1,4 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Expose, Type } from "class-transformer";
import { IsString, ValidateNested, IsEnum, IsNumber, IsOptional, IsBoolean } from "class-validator";
@@ -20,7 +20,11 @@ export class ConferencingAppsOutputDto {
@IsNumber()
userId!: number;
@ApiProperty({ example: true, description: "Whether if the connection is working or not." })
@ApiPropertyOptional({
example: true,
description: "Whether if the connection is working or not.",
nullable: true,
})
@Expose()
@IsBoolean()
@IsOptional()
@@ -28,24 +32,26 @@ export class ConferencingAppsOutputDto {
}
export class ConferencingAppsOutputResponseDto {
@ApiProperty({ example: SUCCESS_STATUS, enum: [SUCCESS_STATUS, ERROR_STATUS] })
@ApiProperty({ type: String, enum: [SUCCESS_STATUS, ERROR_STATUS] })
@IsEnum([SUCCESS_STATUS, ERROR_STATUS])
status!: typeof SUCCESS_STATUS | typeof ERROR_STATUS;
@Expose()
@ValidateNested()
@ValidateNested({ each: true })
@Type(() => ConferencingAppsOutputDto)
@ApiProperty({ type: [ConferencingAppsOutputDto] })
data!: ConferencingAppsOutputDto[];
}
export class ConferencingAppOutputResponseDto {
@ApiProperty({ example: SUCCESS_STATUS, enum: [SUCCESS_STATUS, ERROR_STATUS] })
@ApiProperty({ type: String, enum: [SUCCESS_STATUS, ERROR_STATUS] })
@IsEnum([SUCCESS_STATUS, ERROR_STATUS])
status!: typeof SUCCESS_STATUS | typeof ERROR_STATUS;
@Expose()
@ValidateNested()
@Type(() => ConferencingAppsOutputDto)
@ApiProperty({ type: ConferencingAppsOutputDto })
data!: ConferencingAppsOutputDto;
}
@@ -10,10 +10,10 @@ export class ManagedUserOutput {
@ApiProperty({ example: "alice+cluo37fwd0001khkzqqynkpj3@example.com" })
email!: string;
@ApiProperty({ example: "alice" })
@ApiProperty({ example: "alice", nullable: true })
username!: string | null;
@ApiProperty({ example: "alice" })
@ApiProperty({ example: "alice", nullable: true })
name!: string | null;
@ApiProperty({ example: "America/New_York" })
@@ -22,19 +22,19 @@ export class ManagedUserOutput {
@ApiProperty({ example: "Sunday" })
weekStart!: string;
@ApiProperty({ example: "2024-04-01T00:00:00.000Z", type: "string" })
@ApiProperty({ type: String, example: "2024-04-01T00:00:00.000Z" })
@Transform(({ value }) => value.toISOString())
createdDate!: Date;
@ApiProperty({ example: 12, nullable: true })
@ApiProperty({ type: Number, example: 12, nullable: true })
timeFormat!: number | null;
@ApiProperty({ example: null })
@ApiProperty({ type: Number, example: null, nullable: true })
defaultScheduleId!: number | null;
@IsEnum(Locales)
@IsOptional()
@ApiProperty({ example: Locales.EN, enum: Locales })
@ApiPropertyOptional({ type: String, example: Locales.EN, enum: Locales })
locale?: Locales;
@IsUrl()
@@ -43,7 +43,7 @@ export class ManagedUserOutput {
type: String,
example: "https://cal.com/api/avatar/2b735186-b01b-46d3-87da-019b8f61776b.png",
description: `URL of the user's avatar image`,
required: false,
nullable: true,
})
avatarUrl?: string | null;
}
@@ -1,4 +1,4 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Type } from "class-transformer";
import {
IsArray,
@@ -30,7 +30,7 @@ export class PlatformOAuthClientDto {
@IsNumber()
permissions!: number;
@ApiProperty({ example: "https://example.com/logo.png", required: false })
@ApiPropertyOptional({ example: "https://example.com/logo.png" })
@IsOptional()
@IsString()
logo!: string | null;
@@ -54,9 +54,7 @@ export class GetOAuthClientResponseDto {
@IsEnum([SUCCESS_STATUS, ERROR_STATUS])
status!: typeof SUCCESS_STATUS | typeof ERROR_STATUS;
@ApiProperty({
type: PlatformOAuthClientDto,
})
@ApiProperty({ type: PlatformOAuthClientDto })
@IsNotEmptyObject()
@ValidateNested()
@Type(() => PlatformOAuthClientDto)
@@ -1,32 +1,40 @@
import { ApiPropertyOptional } from "@nestjs/swagger";
import { IsArray, IsBoolean, IsOptional, IsString } from "class-validator";
export class UpdateOAuthClientInput {
@IsOptional()
@IsString()
@ApiPropertyOptional()
logo?: string;
@IsString()
@IsOptional()
@ApiPropertyOptional()
name?: string;
@IsArray()
@IsOptional()
@IsString({ each: true })
redirectUris?: string[] = [];
@ApiPropertyOptional({ type: [String] })
redirectUris?: string[];
@IsOptional()
@IsString()
@ApiPropertyOptional()
bookingRedirectUri?: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
bookingCancelRedirectUri?: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
bookingRescheduleRedirectUri?: string;
@IsOptional()
@IsBoolean()
@ApiPropertyOptional()
areEmailsEnabled?: boolean;
}
@@ -1,17 +1,21 @@
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { IsNotEmpty, IsOptional, IsString } from "class-validator";
export class AssignOrganizationAttributeOptionToUserInput {
@IsOptional()
@IsString()
@IsNotEmpty()
@ApiPropertyOptional()
readonly value?: string;
@IsOptional()
@IsString()
@IsNotEmpty()
@ApiPropertyOptional()
readonly attributeOptionId?: string;
@IsNotEmpty()
@IsString()
@ApiProperty()
readonly attributeId!: string;
}
@@ -1,4 +1,5 @@
import { CreateOrganizationAttributeOptionInput } from "@/modules/organizations/inputs/attributes/options/create-organization-attribute-option.input";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { AttributeType } from "@prisma/client";
import { Type } from "class-transformer";
import {
@@ -14,22 +15,27 @@ import {
export class CreateOrganizationAttributeInput {
@IsString()
@IsNotEmpty()
@ApiProperty()
readonly name!: string;
@IsString()
@IsNotEmpty()
@ApiProperty()
readonly slug!: string;
@IsEnum(AttributeType)
@IsNotEmpty()
@ApiProperty({ enum: AttributeType })
readonly type!: AttributeType;
@IsArray()
@ValidateNested()
@ValidateNested({ each: true })
@Type(() => CreateOrganizationAttributeOptionInput)
@ApiProperty({ type: [CreateOrganizationAttributeOptionInput] })
readonly options!: CreateOrganizationAttributeOptionInput[];
@IsBoolean()
@IsOptional()
@ApiPropertyOptional()
readonly enabled?: boolean;
}
@@ -1,11 +1,14 @@
import { IsNotEmpty, IsOptional, IsString } from "class-validator";
import { ApiPropertyOptional } from "@nestjs/swagger";
import { IsString, IsOptional } from "class-validator";
export class UpdateOrganizationAttributeOptionInput {
@IsString()
@IsOptional()
@ApiPropertyOptional()
readonly value?: string;
@IsString()
@IsOptional()
@ApiPropertyOptional()
readonly slug?: string;
}
@@ -1,20 +1,25 @@
import { ApiPropertyOptional } from "@nestjs/swagger";
import { AttributeType } from "@prisma/client";
import { IsBoolean, IsEnum, IsOptional, IsString } from "class-validator";
export class UpdateOrganizationAttributeInput {
@IsString()
@IsOptional()
@ApiPropertyOptional()
readonly name?: string;
@IsString()
@IsOptional()
@ApiPropertyOptional()
readonly slug?: string;
@IsEnum(AttributeType)
@IsOptional()
@ApiPropertyOptional({ enum: AttributeType })
readonly type?: AttributeType;
@IsBoolean()
@IsOptional()
@ApiPropertyOptional()
readonly enabled?: boolean;
}
@@ -1,13 +1,15 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { MembershipRole } from "@prisma/client";
import { IsBoolean, IsOptional, IsEnum, IsInt } from "class-validator";
export class CreateOrgMembershipDto {
@IsInt()
@ApiProperty()
readonly userId!: number;
@IsOptional()
@IsBoolean()
@ApiPropertyOptional({ type: Boolean, default: false })
readonly accepted?: boolean = false;
@IsEnum(MembershipRole)
@@ -16,5 +18,6 @@ export class CreateOrgMembershipDto {
@IsOptional()
@IsBoolean()
@ApiPropertyOptional({ type: Boolean, default: false })
readonly disableImpersonation?: boolean = false;
}
@@ -1,12 +1,14 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { MembershipRole } from "@prisma/client";
import { IsBoolean, IsOptional, IsEnum, IsInt } from "class-validator";
export class CreateOrgTeamMembershipDto {
@IsInt()
@ApiProperty()
readonly userId!: number;
@IsOptional()
@ApiPropertyOptional({ type: Boolean, default: false })
@IsBoolean()
readonly accepted?: boolean = false;
@@ -15,6 +17,7 @@ export class CreateOrgTeamMembershipDto {
readonly role: MembershipRole = MembershipRole.MEMBER;
@IsOptional()
@ApiPropertyOptional({ type: Boolean, default: false })
@IsBoolean()
readonly disableImpersonation?: boolean = false;
}
@@ -9,7 +9,7 @@ export class CreateOrgTeamDto {
@IsOptional()
@IsString()
@ApiPropertyOptional({ type: String, description: "Team slug", example: "caltel", required: false })
@ApiPropertyOptional({ type: String, description: "Team slug", example: "caltel" })
readonly slug?: string;
@IsOptional()
@@ -18,52 +18,62 @@ export class CreateOrgTeamDto {
type: String,
example: "https://i.cal.com/api/avatar/b0b58752-68ad-4c0d-8024-4fa382a77752.png",
description: `URL of the teams logo image`,
required: false,
})
readonly logoUrl?: string;
@IsOptional()
@IsUrl()
@ApiPropertyOptional()
readonly calVideoLogo?: string;
@IsOptional()
@IsUrl()
@ApiPropertyOptional()
readonly appLogo?: string;
@IsOptional()
@IsUrl()
@ApiPropertyOptional()
readonly appIconLogo?: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
readonly bio?: string;
@IsOptional()
@IsBoolean()
@ApiPropertyOptional({ type: Boolean, default: false })
readonly hideBranding?: boolean = false;
@IsOptional()
@IsBoolean()
@ApiPropertyOptional()
readonly isPrivate?: boolean;
@IsOptional()
@IsBoolean()
@ApiPropertyOptional()
readonly hideBookATeamMember?: boolean;
@IsOptional()
@IsString()
@ApiPropertyOptional()
readonly metadata?: string; // Assuming metadata is a JSON string. Adjust accordingly if it's a nested object.
@IsOptional()
@IsString()
@ApiPropertyOptional()
readonly theme?: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
readonly brandColor?: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
readonly darkBrandColor?: string;
@IsOptional()
@@ -78,6 +88,7 @@ export class CreateOrgTeamDto {
@IsOptional()
@IsString()
@ApiPropertyOptional()
readonly timeFormat?: number;
@IsOptional()
@@ -96,12 +107,12 @@ export class CreateOrgTeamDto {
@ApiPropertyOptional({
type: String,
example: "Monday",
required: false,
default: "Sunday",
})
readonly weekStart?: string = "Sunday";
@IsOptional()
@IsBoolean()
@ApiPropertyOptional({ type: Boolean, default: true })
readonly autoAcceptCreator?: boolean = true;
}
@@ -1,17 +1,21 @@
import { CreateUserInput } from "@/modules/users/inputs/create-user.input";
import { ApiPropertyOptional } from "@nestjs/swagger";
import { MembershipRole } from "@prisma/client";
import { IsString, IsOptional, IsBoolean, IsEnum } from "class-validator";
export class CreateOrganizationUserInput extends CreateUserInput {
@IsOptional()
@IsString()
@ApiPropertyOptional({ type: String, default: "en" })
locale = "en";
@IsOptional()
@IsEnum(MembershipRole)
@ApiPropertyOptional({ enum: MembershipRole, default: MembershipRole.MEMBER })
organizationRole: MembershipRole = MembershipRole.MEMBER;
@IsOptional()
@IsBoolean()
@ApiPropertyOptional({ type: Boolean, default: true })
autoAccept = true;
}
@@ -1,17 +1,20 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiPropertyOptional } from "@nestjs/swagger";
import { MembershipRole } from "@prisma/client";
import { IsBoolean, IsOptional, IsEnum } from "class-validator";
export class UpdateOrgMembershipDto {
@IsOptional()
@IsBoolean()
readonly accepted?: boolean = false;
@ApiPropertyOptional()
readonly accepted?: boolean;
@IsOptional()
@IsEnum(MembershipRole)
@ApiProperty({ enum: ["MEMBER", "OWNER", "ADMIN"] })
readonly role?: MembershipRole = MembershipRole.MEMBER;
@ApiPropertyOptional({ enum: ["MEMBER", "OWNER", "ADMIN"] })
readonly role?: MembershipRole;
@IsOptional()
@IsBoolean()
readonly disableImpersonation?: boolean = false;
@ApiPropertyOptional()
readonly disableImpersonation?: boolean;
}
@@ -1,17 +1,20 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiPropertyOptional } from "@nestjs/swagger";
import { MembershipRole } from "@prisma/client";
import { IsBoolean, IsOptional, IsEnum } from "class-validator";
export class UpdateOrgTeamMembershipDto {
@IsOptional()
@IsBoolean()
readonly accepted?: boolean = false;
@ApiPropertyOptional()
readonly accepted?: boolean;
@IsOptional()
@IsEnum(MembershipRole)
@ApiProperty({ enum: ["MEMBER", "OWNER", "ADMIN"] })
readonly role?: MembershipRole = MembershipRole.MEMBER;
@ApiPropertyOptional({ enum: ["MEMBER", "OWNER", "ADMIN"] })
readonly role?: MembershipRole;
@IsOptional()
@IsBoolean()
readonly disableImpersonation?: boolean = false;
@ApiPropertyOptional()
readonly disableImpersonation?: boolean;
}
@@ -4,12 +4,12 @@ import { IsBoolean, IsOptional, IsString, IsUrl, Length } from "class-validator"
export class UpdateOrgTeamDto {
@IsString()
@Length(1)
@ApiPropertyOptional({ description: "Name of the team", example: "CalTeam", required: false })
@ApiPropertyOptional({ description: "Name of the team", example: "CalTeam" })
readonly name?: string;
@IsOptional()
@IsString()
@ApiPropertyOptional({ type: String, description: "Team slug", example: "caltel", required: false })
@ApiPropertyOptional({ type: String, description: "Team slug", example: "caltel" })
readonly slug?: string;
@IsOptional()
@@ -18,52 +18,62 @@ export class UpdateOrgTeamDto {
type: String,
example: "https://i.cal.com/api/avatar/b0b58752-68ad-4c0d-8024-4fa382a77752.png",
description: `URL of the teams logo image`,
required: false,
})
readonly logoUrl?: string;
@IsOptional()
@IsUrl()
@ApiPropertyOptional()
readonly calVideoLogo?: string;
@IsOptional()
@IsUrl()
@ApiPropertyOptional()
readonly appLogo?: string;
@IsOptional()
@IsUrl()
@ApiPropertyOptional()
readonly appIconLogo?: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
readonly bio?: string;
@IsOptional()
@IsBoolean()
readonly hideBranding?: boolean = false;
@ApiPropertyOptional()
readonly hideBranding?: boolean;
@IsOptional()
@IsBoolean()
@ApiPropertyOptional()
readonly isPrivate?: boolean;
@IsOptional()
@IsBoolean()
@ApiPropertyOptional()
readonly hideBookATeamMember?: boolean;
@IsOptional()
@IsString()
@ApiPropertyOptional()
readonly metadata?: string; // Assuming metadata is a JSON string. Adjust accordingly if it's a nested object.
@IsOptional()
@IsString()
@ApiPropertyOptional()
readonly theme?: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
readonly brandColor?: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
readonly darkBrandColor?: string;
@IsOptional()
@@ -72,12 +82,12 @@ export class UpdateOrgTeamDto {
type: String,
example: "https://i.cal.com/api/avatar/949be534-7a88-4185-967c-c020b0c0bef3.png",
description: `URL of the teams banner image which is shown on booker`,
required: false,
})
readonly bannerUrl?: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
readonly timeFormat?: number;
@IsOptional()
@@ -86,26 +96,24 @@ export class UpdateOrgTeamDto {
type: String,
example: "America/New_York",
description: `Timezone is used to create teams's default schedule from Monday to Friday from 9AM to 5PM. It will default to Europe/London if not passed.`,
required: false,
default: "Europe/London",
})
readonly timeZone?: string = "Europe/London";
readonly timeZone?: string;
@IsOptional()
@IsString()
@ApiPropertyOptional({
type: String,
example: "Monday",
required: false,
default: "Sunday",
})
readonly weekStart?: string = "Sunday";
readonly weekStart?: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
readonly bookingLimits?: string;
@IsOptional()
@IsBoolean()
@ApiPropertyOptional()
readonly includeManagedEventsInLimits?: boolean;
}
@@ -2,21 +2,21 @@ import { Attribute } from "@/modules/organizations/outputs/attributes/attribute.
import { BaseOutputDTO } from "@/modules/organizations/outputs/attributes/base.output";
import { ApiProperty } from "@nestjs/swagger";
import { Expose, Type } from "class-transformer";
import { IsBoolean, IsInt, IsString, IsEnum, ValidateNested, IsOptional } from "class-validator";
import { AttributeType } from "@calcom/prisma/client";
import { IsOptional, ValidateNested } from "class-validator";
export class GetSingleAttributeOutput extends BaseOutputDTO {
@Expose()
@ValidateNested()
@IsOptional()
@Type(() => Attribute)
@ApiProperty({ type: Attribute, nullable: true })
data!: Attribute | null;
}
export class GetOrganizationAttributesOutput extends BaseOutputDTO {
@Expose()
@ValidateNested()
@ValidateNested({ each: true })
@Type(() => Attribute)
@ApiProperty({ type: [Attribute] })
data!: Attribute[];
}
@@ -1,4 +1,4 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { MembershipRole } from "@prisma/client";
import { Expose } from "class-transformer";
import { IsBoolean, IsInt, IsOptional, IsString } from "class-validator";
@@ -6,18 +6,22 @@ import { IsBoolean, IsInt, IsOptional, IsString } from "class-validator";
export class OrgMembershipOutputDto {
@IsInt()
@Expose()
@ApiProperty()
readonly id!: number;
@IsInt()
@Expose()
@ApiProperty()
readonly userId!: number;
@IsInt()
@Expose()
@ApiProperty()
readonly teamId!: number;
@IsBoolean()
@Expose()
@ApiProperty()
readonly accepted!: boolean;
@IsString()
@@ -28,5 +32,6 @@ export class OrgMembershipOutputDto {
@IsOptional()
@IsBoolean()
@Expose()
@ApiPropertyOptional()
readonly disableImpersonation?: boolean;
}
@@ -1,4 +1,4 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { MembershipRole } from "@prisma/client";
import { Expose, Type } from "class-transformer";
import { IsArray, IsBoolean, IsEnum, IsInt, IsOptional, IsString, ValidateNested } from "class-validator";
@@ -9,38 +9,46 @@ export class MembershipUserOutputDto {
@IsOptional()
@IsString()
@Expose()
@ApiPropertyOptional()
readonly avatarUrl?: string;
@IsOptional()
@IsString()
@Expose()
@ApiPropertyOptional()
readonly username?: string;
@IsOptional()
@IsString()
@Expose()
@ApiPropertyOptional()
readonly name?: string;
@IsBoolean()
@Expose()
@ApiProperty()
readonly email!: string;
}
export class OrgTeamMembershipOutputDto {
@IsInt()
@Expose()
@ApiProperty()
readonly id!: number;
@IsInt()
@Expose()
@ApiProperty()
readonly userId!: number;
@IsInt()
@Expose()
@ApiProperty()
readonly teamId!: number;
@IsBoolean()
@Expose()
@ApiProperty()
readonly accepted!: boolean;
@IsString()
@@ -51,11 +59,13 @@ export class OrgTeamMembershipOutputDto {
@IsOptional()
@IsBoolean()
@Expose()
@ApiPropertyOptional()
readonly disableImpersonation?: boolean;
@ValidateNested()
@Type(() => MembershipUserOutputDto)
@Expose()
@ApiProperty({ type: MembershipUserOutputDto })
user!: MembershipUserOutputDto;
}
@@ -68,6 +78,7 @@ export class OrgTeamMembershipsOutputResponseDto {
@ValidateNested()
@Type(() => OrgTeamMembershipOutputDto)
@IsArray()
@ApiProperty({ type: [OrgTeamMembershipOutputDto] })
data!: OrgTeamMembershipOutputDto[];
}
@@ -79,5 +90,6 @@ export class OrgTeamMembershipOutputResponseDto {
@Expose()
@ValidateNested()
@Type(() => OrgTeamMembershipOutputDto)
@ApiProperty({ type: OrgTeamMembershipOutputDto })
data!: OrgTeamMembershipOutputDto;
}
@@ -1,20 +1,24 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { MembershipRole } from "@prisma/client";
import { IsBoolean, IsOptional, IsEnum, IsInt } from "class-validator";
export class CreateTeamMembershipInput {
@IsInt()
@ApiProperty({ type: Number })
readonly userId!: number;
@IsOptional()
@IsBoolean()
@ApiPropertyOptional({ type: Boolean, default: false })
readonly accepted?: boolean = false;
@IsOptional()
@IsEnum(MembershipRole)
@ApiProperty({ enum: ["MEMBER", "OWNER", "ADMIN"] })
@ApiPropertyOptional({ enum: ["MEMBER", "OWNER", "ADMIN"], default: "MEMBER" })
readonly role: MembershipRole = MembershipRole.MEMBER;
@IsOptional()
@IsBoolean()
@ApiPropertyOptional({ type: Boolean, default: false })
readonly disableImpersonation?: boolean = false;
}
@@ -1,17 +1,20 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { MembershipRole } from "@prisma/client";
import { IsBoolean, IsOptional, IsEnum } from "class-validator";
export class UpdateTeamMembershipInput {
@IsOptional()
@IsBoolean()
readonly accepted?: boolean = false;
@ApiPropertyOptional({ type: Boolean })
readonly accepted?: boolean;
@IsOptional()
@IsEnum(MembershipRole)
@ApiProperty({ enum: ["MEMBER", "OWNER", "ADMIN"] })
readonly role?: MembershipRole = MembershipRole.MEMBER;
@ApiPropertyOptional({ enum: ["MEMBER", "OWNER", "ADMIN"] })
readonly role?: MembershipRole;
@IsOptional()
@IsBoolean()
readonly disableImpersonation?: boolean = false;
@ApiPropertyOptional({ type: Boolean })
readonly disableImpersonation?: boolean;
}
@@ -1,4 +1,4 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { MembershipRole } from "@prisma/client";
import { Expose } from "class-transformer";
import { IsBoolean, IsInt, IsOptional, IsString } from "class-validator";
@@ -6,18 +6,22 @@ import { IsBoolean, IsInt, IsOptional, IsString } from "class-validator";
export class TeamMembershipOutput {
@IsInt()
@Expose()
@ApiProperty()
readonly id!: number;
@IsInt()
@Expose()
@ApiProperty()
readonly userId!: number;
@IsInt()
@Expose()
@ApiProperty()
readonly teamId!: number;
@IsBoolean()
@Expose()
@ApiProperty()
readonly accepted!: boolean;
@IsString()
@@ -28,5 +32,6 @@ export class TeamMembershipOutput {
@IsOptional()
@IsBoolean()
@Expose()
@ApiPropertyOptional()
readonly disableImpersonation?: boolean;
}
@@ -16,12 +16,12 @@ export class CreateManagedUserInput {
@IsOptional()
@IsIn([12, 24], { message: "timeFormat must be a number either 12 or 24" })
@ApiProperty({ example: 12, enum: [12, 24], description: "Must be a number 12 or 24" })
@ApiPropertyOptional({ example: 12, enum: [12, 24], description: "Must be a number 12 or 24" })
timeFormat?: TimeFormat;
@IsOptional()
@IsString()
@ApiProperty({
@ApiPropertyOptional({
example: "Monday",
enum: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
})
@@ -30,7 +30,7 @@ export class CreateManagedUserInput {
@IsTimeZone()
@IsOptional()
@CapitalizeTimeZone()
@ApiProperty({
@ApiPropertyOptional({
example: "America/New_York",
description: `Timezone is used to create user's default schedule from Monday to Friday from 9AM to 5PM. If it is not passed then user does not have
a default schedule and it must be created manually via the /schedules endpoint. Until the schedule is created, the user can't access availability atom to set his / her availability nor booked.
@@ -49,7 +49,6 @@ export class CreateManagedUserInput {
type: String,
example: "https://cal.com/api/avatar/2b735186-b01b-46d3-87da-019b8f61776b.png",
description: `URL of the user's avatar image`,
required: false,
})
avatarUrl?: string;
}
@@ -1,4 +1,4 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Transform } from "class-transformer";
import { IsOptional, Validate } from "class-validator";
@@ -12,7 +12,8 @@ export class GetUsersInput extends SkipTakePagination {
@Transform(({ value }: { value: string | string[] }) => {
return typeof value === "string" ? [value] : value;
})
@ApiProperty({
@ApiPropertyOptional({
type: [String],
description: "The email address or an array of email addresses to filter by",
})
emails?: string[];
@@ -1,31 +1,34 @@
import { Locales } from "@/lib/enums/locales";
import { CapitalizeTimeZone } from "@/lib/inputs/capitalize-timezone";
import { TimeFormat, WeekDay } from "@/modules/users/inputs/create-managed-user.input";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { ApiPropertyOptional } from "@nestjs/swagger";
import { IsEnum, IsIn, IsNumber, IsOptional, IsString, IsTimeZone, IsUrl } from "class-validator";
export class UpdateManagedUserInput {
@IsString()
@IsOptional()
@ApiPropertyOptional()
email?: string;
@IsString()
@IsOptional()
@ApiPropertyOptional()
name?: string;
@IsOptional()
@IsIn([12, 24])
@ApiProperty({ example: 12, enum: [12, 24], description: "Must be 12 or 24" })
@ApiPropertyOptional({ example: 12, enum: [12, 24], description: "Must be 12 or 24" })
timeFormat?: TimeFormat;
@IsNumber()
@IsOptional()
@ApiPropertyOptional()
defaultScheduleId?: number;
@IsOptional()
@IsString()
@IsIn(["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"])
@ApiProperty({
@ApiPropertyOptional({
example: "Monday",
enum: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
})
@@ -34,11 +37,12 @@ export class UpdateManagedUserInput {
@IsTimeZone()
@IsOptional()
@CapitalizeTimeZone()
@ApiPropertyOptional()
timeZone?: string;
@IsEnum(Locales)
@IsOptional()
@ApiProperty({ example: Locales.EN, enum: Locales })
@ApiPropertyOptional({ example: Locales.EN, enum: Locales })
locale?: Locales;
@IsUrl()
@@ -47,7 +51,6 @@ export class UpdateManagedUserInput {
type: String,
example: "https://cal.com/api/avatar/2b735186-b01b-46d3-87da-019b8f61776b.png",
description: `URL of the user's avatar image`,
required: false,
})
avatarUrl?: string;
}
@@ -1,4 +1,4 @@
import { ApiProperty, PartialType } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional, PartialType } from "@nestjs/swagger";
import { WebhookTriggerEvents } from "@prisma/client";
import { IsArray, IsBoolean, IsEnum, IsOptional, IsString } from "class-validator";
@@ -19,9 +19,11 @@ export class CreateWebhookInputDto {
payloadTemplate?: string;
@IsBoolean()
@ApiProperty()
active!: boolean;
@IsString()
@ApiProperty()
subscriberUrl!: string;
@IsArray()
@@ -43,6 +45,7 @@ export class CreateWebhookInputDto {
@IsString()
@IsOptional()
@ApiPropertyOptional()
secret?: string;
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,4 +1,4 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Type, Transform } from "class-transformer";
import {
ValidateNested,
@@ -26,25 +26,30 @@ class Filters {
@IsOptional()
@IsArray()
@Type(() => Number)
@ApiPropertyOptional({ type: [Number] })
teamsIds?: number[];
@IsOptional()
@IsArray()
@Type(() => Number)
@ApiPropertyOptional({ type: [Number] })
userIds?: number[];
@IsEnum(Status_2024_04_15)
@ApiProperty({ enum: Status_2024_04_15 })
status!: BookingStatus;
@IsOptional()
@IsArray()
@Type(() => Number)
@ApiPropertyOptional({ type: [Number] })
eventTypeIds?: number[];
}
export class GetBookingsInput_2024_04_15 {
@ValidateNested({ each: true })
@Type(() => Filters)
@ApiProperty({ type: Filters })
filters!: Filters;
@Transform(({ value }: { value: string }) => value && parseInt(value))
@@ -52,37 +57,45 @@ export class GetBookingsInput_2024_04_15 {
@Min(1)
@Max(100)
@IsOptional()
@ApiPropertyOptional({ description: "Maximum number of bookings to retrieve.", example: 50 })
limit?: number;
@Transform(({ value }: { value: string }) => value && parseInt(value))
@IsNumber()
@IsOptional()
@ApiPropertyOptional({ description: "Cursor for pagination.", example: 10, nullable: true })
cursor?: number | null;
}
export class CancelBookingInput_2024_04_15 {
@IsNumber()
@IsOptional()
@ApiProperty()
@ApiPropertyOptional({ description: "Booking ID to cancel.", example: 123 })
id?: number;
@IsString()
@IsOptional()
@ApiProperty()
@ApiPropertyOptional()
uid?: string;
@IsBoolean()
@IsOptional()
@ApiProperty()
@ApiPropertyOptional({
example: true,
})
allRemainingBookings?: boolean;
@IsString()
@IsOptional()
@ApiProperty()
@ApiPropertyOptional({
type: String,
description: "Reason for cancellation.",
example: "Scheduling conflict",
})
cancellationReason?: string;
@IsString()
@IsOptional()
@ApiProperty()
@ApiPropertyOptional()
seatReferenceUid?: string;
}
@@ -1,17 +1,17 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { IsBoolean, IsOptional, IsString } from "class-validator";
export class CancelBookingInput_2024_08_13 {
@IsString()
@IsOptional()
@ApiProperty({ example: "User requested cancellation" })
@ApiPropertyOptional({ example: "User requested cancellation" })
cancellationReason?: string;
@IsBoolean()
@IsOptional()
@ApiProperty({
@ApiPropertyOptional({
description:
"For recurring non-seated booking - if true, cancel booking with the bookingUid of the individual recorrence and all recurrences that come after it.",
"For recurring non-seated booking - if true, cancel booking with the bookingUid of the individual recurrence and all recurrences that come after it.",
})
cancelSubsequentBookings?: boolean;
}
@@ -20,7 +20,7 @@ export class CancelSeatedBookingInput_2024_08_13 {
@ApiProperty({
type: String,
example: "3be561a9-31f1-4b8e-aefc-9d9a085f0dd1",
description: "Uid of the specific seat withing booking.",
description: "Uid of the specific seat within booking.",
})
@IsString()
seatUid!: string;
@@ -68,7 +68,7 @@ export class CreateBookingInput_2024_08_13 {
@IsOptional()
@IsInt()
@Min(1)
@ApiProperty({
@ApiPropertyOptional({
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.`,
@@ -1,12 +1,11 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiPropertyOptional } from "@nestjs/swagger";
import { IsOptional, IsString } from "class-validator";
export class DeclineBookingInput_2024_08_13 {
@IsString()
@IsOptional()
@ApiProperty({
@ApiPropertyOptional({
example: "Host has to take another call",
required: false,
description: "Reason for declining a booking that requires a confirmation",
})
reason?: string;
@@ -1,4 +1,4 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Type } from "class-transformer";
import { IsOptional, IsBoolean, IsEmail, IsArray, ArrayMinSize, ValidateNested } from "class-validator";
@@ -15,18 +15,14 @@ class Attendee {
export class MarkAbsentBookingInput_2024_08_13 {
@IsBoolean()
@IsOptional()
@ApiProperty({ example: false, required: false, description: "Whether the host was absent" })
@ApiPropertyOptional({ example: false, description: "Whether the host was absent" })
host?: boolean;
@ArrayMinSize(1)
@ApiProperty({
type: [String],
description: "Toggle whether an attendee was absent or not.",
example: [{ absent: true, email: "someone@gmail.com" }],
})
@ValidateNested()
@Type(() => Attendee)
@IsArray()
@ValidateNested({ each: true })
@Type(() => Attendee)
@IsOptional()
@ApiPropertyOptional({ type: [Attendee] })
attendees?: Attendee[];
}
@@ -1,12 +1,11 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiPropertyOptional } from "@nestjs/swagger";
import { IsOptional, IsString } from "class-validator";
export class ReassignToUserBookingInput_2024_08_13 {
@IsString()
@IsOptional()
@ApiProperty({
@ApiPropertyOptional({
example: "Host has to take another call",
required: false,
description: "Reason for reassigning the booking",
})
reason?: string;
@@ -1,4 +1,4 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { IsDateString, IsOptional, IsString } from "class-validator";
export class RescheduleBookingInput_2024_08_13 {
@@ -11,10 +11,9 @@ export class RescheduleBookingInput_2024_08_13 {
@IsString()
@IsOptional()
@ApiProperty({
@ApiPropertyOptional({
example: "User requested reschedule",
description: "Reason for rescheduling the booking",
required: false,
})
reschedulingReason?: string;
}
@@ -30,7 +29,7 @@ export class RescheduleSeatedBookingInput_2024_08_13 {
@ApiProperty({
type: String,
example: "3be561a9-31f1-4b8e-aefc-9d9a085f0dd1",
description: "Uid of the specific seat withing booking.",
description: "Uid of the specific seat within booking.",
})
@IsString()
seatUid!: string;
@@ -1,4 +1,4 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Expose, Type } from "class-transformer";
import {
IsArray,
@@ -34,7 +34,7 @@ class Attendee {
@Expose()
timeZone!: string;
@ApiProperty({ enum: BookingLanguage, required: false, example: "en" })
@ApiPropertyOptional({ enum: BookingLanguage, example: "en" })
@IsEnum(BookingLanguage)
@Expose()
@IsOptional()
@@ -57,16 +57,15 @@ export class SeatedAttendee extends Attendee {
description:
"Booking field responses consisting of an object with booking field slug as keys and user response as values.",
example: { customField: "customValue" },
required: false,
required: true,
})
@IsObject()
@Expose()
bookingFieldsResponses!: Record<string, unknown>;
@ApiProperty({
@ApiPropertyOptional({
type: Object,
example: { key: "value" },
required: false,
})
@IsObject()
@IsOptional()
@@ -140,19 +139,19 @@ class BaseBookingOutput_2024_08_13 {
@Expose()
status!: "cancelled" | "accepted" | "rejected" | "pending";
@ApiProperty({ type: String, required: false, example: "User requested cancellation" })
@ApiPropertyOptional({ type: String, example: "User requested cancellation" })
@IsString()
@IsOptional()
@Expose()
cancellationReason?: string;
@ApiProperty({ type: String, required: false, example: "User rescheduled the event" })
@ApiPropertyOptional({ type: String, example: "User rescheduled the event" })
@IsString()
@IsOptional()
@Expose()
reschedulingReason?: string;
@ApiProperty({ type: String, required: false, example: "previous_uid_123" })
@ApiPropertyOptional({ type: String, example: "previous_uid_123" })
@IsString()
@IsOptional()
@Expose()
@@ -188,9 +187,9 @@ class BaseBookingOutput_2024_08_13 {
@Expose()
eventType!: EventType;
@ApiProperty({
@ApiPropertyOptional({
type: String,
required: false,
description: "Deprecated - rely on 'location' field instead.",
example: "https://example.com/recurring-meeting",
deprecated: true,
@@ -200,8 +199,7 @@ class BaseBookingOutput_2024_08_13 {
@Expose()
meetingUrl?: string;
@ApiProperty({ type: String, required: false, example: "https://example.com/meeting" })
@IsOptional()
@ApiProperty({ type: String, example: "https://example.com/meeting" })
@Expose()
location!: string;
@@ -215,10 +213,9 @@ class BaseBookingOutput_2024_08_13 {
@Expose()
createdAt!: string;
@ApiProperty({
@ApiPropertyOptional({
type: Object,
example: { key: "value" },
required: false,
})
@IsObject()
@IsOptional()
@@ -233,7 +230,10 @@ export class BookingOutput_2024_08_13 extends BaseBookingOutput_2024_08_13 {
@Expose()
attendees!: Attendee[];
@ApiProperty({ type: [String], required: false, example: ["guest1@example.com", "guest2@example.com"] })
@ApiPropertyOptional({
type: [String],
example: ["guest1@example.com", "guest2@example.com"],
})
@IsArray()
@IsString({ each: true })
@IsOptional()
@@ -245,7 +245,6 @@ export class BookingOutput_2024_08_13 extends BaseBookingOutput_2024_08_13 {
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()
@@ -263,7 +262,6 @@ export class RecurringBookingOutput_2024_08_13 extends BookingOutput_2024_08_13
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()
+5
View File
@@ -8,9 +8,11 @@ import { IsYearMonthDays } from "./validators/isYearMonthDays";
export class Calendar {
@Transform(({ value }: { value: string }) => value && parseInt(value))
@IsNumber()
@ApiProperty()
credentialId!: number;
@IsString()
@ApiProperty()
externalId!: string;
}
@@ -27,6 +29,7 @@ export class CalendarBusyTimesInput {
required: false,
description: "The starting date for the busy times query",
example: "2023-10-01",
nullable: true,
})
@IsString()
@IsOptional()
@@ -37,6 +40,7 @@ export class CalendarBusyTimesInput {
required: false,
description: "The ending date for the busy times query",
example: "2023-10-31",
nullable: true,
})
@IsString()
@IsOptional()
@@ -44,6 +48,7 @@ export class CalendarBusyTimesInput {
dateTo?: string | null;
@ApiProperty({
type: [Calendar],
required: true,
description: "An array of Calendar objects representing the calendars to be loaded",
example: `[{ credentialId: "1", externalId: "AQgtJE7RnHEeyisVq2ENs2gAAAgEGAAAACgtJE7RnHEeyisVq2ENs2gAAAhSDAAAA" }, { credentialId: "2", externalId: "AQM7RnHEeyisVq2ENs2gAAAhFDBBBBB" }]`,
@@ -49,6 +49,7 @@ export class BaseBookingLimitsCount_2024_06_14 {
@IsOptional()
@IsBoolean()
@ApiPropertyOptional({ type: Boolean, default: false })
disabled?: boolean = false;
}
@@ -60,6 +61,7 @@ class BookingLimitsCountValidator implements ValidatorConstraintInterface {
invalidLimit?: string;
comparedLimit?: string;
} = {};
validate(value: BookingLimitsCount_2024_06_14) {
if (!value) return false;
if ("disabled" in value) {
@@ -101,10 +103,10 @@ class BookingLimitsCountValidator implements ValidatorConstraintInterface {
}
}
export function ValidateBookingLimistsCount(validationOptions?: ValidationOptions) {
export function ValidateBookingLimitsCount(validationOptions?: ValidationOptions) {
return function (object: any, propertyName: string) {
registerDecorator({
name: "ValidateBookingLimistsCount",
name: "ValidateBookingLimitsCount",
target: object.constructor,
propertyName: propertyName,
options: validationOptions,
@@ -38,7 +38,7 @@ import {
import type { InputBookingField_2024_06_14 } from "./booking-fields.input";
import { ValidateInputBookingFields_2024_06_14 } from "./booking-fields.input";
import type { BookingLimitsCount_2024_06_14 } from "./booking-limits-count.input";
import { BaseBookingLimitsCount_2024_06_14, ValidateBookingLimistsCount } from "./booking-limits-count.input";
import { BaseBookingLimitsCount_2024_06_14, ValidateBookingLimitsCount } from "./booking-limits-count.input";
import type { BookingLimitsDuration_2024_06_14 } from "./booking-limits-duration.input";
import {
BaseBookingLimitsDuration_2024_06_14,
@@ -226,7 +226,7 @@ export class CreateEventTypeInput_2024_06_14 {
scheduleId?: number;
@IsOptional()
@ValidateBookingLimistsCount()
@ValidateBookingLimitsCount()
@DocsPropertyOptional({
description: "Limit how many times this event can be booked",
oneOf: [
@@ -35,7 +35,7 @@ import {
ValidateInputBookingFields_2024_06_14,
} from "./booking-fields.input";
import type { BookingLimitsCount_2024_06_14 } from "./booking-limits-count.input";
import { BaseBookingLimitsCount_2024_06_14, ValidateBookingLimistsCount } from "./booking-limits-count.input";
import { BaseBookingLimitsCount_2024_06_14, ValidateBookingLimitsCount } from "./booking-limits-count.input";
import type { BookingLimitsDuration_2024_06_14 } from "./booking-limits-duration.input";
import {
BaseBookingLimitsDuration_2024_06_14,
@@ -227,7 +227,7 @@ export class UpdateEventTypeInput_2024_06_14 {
scheduleId?: number;
@IsOptional()
@ValidateBookingLimistsCount()
@ValidateBookingLimitsCount()
@DocsPropertyOptional({
description: "Limit how many times this event can be booked",
oneOf: [
@@ -1,4 +1,9 @@
import { ApiProperty as DocsProperty, ApiExtraModels, getSchemaPath } from "@nestjs/swagger";
import {
ApiProperty as DocsProperty,
ApiPropertyOptional,
ApiExtraModels,
getSchemaPath,
} from "@nestjs/swagger";
import { Type } from "class-transformer";
import {
ArrayNotEmpty,
@@ -71,27 +76,35 @@ export type EventTypesOutputSchedulingType = "ROUND_ROBIN" | "COLLECTIVE" | "MAN
class User_2024_06_14 {
@IsInt()
@DocsProperty()
id!: number;
@IsString()
@DocsProperty({ nullable: true })
name!: string | null;
@IsString()
@DocsProperty({ nullable: true, type: String })
username!: string | null;
@IsString()
@DocsProperty({ nullable: true, type: String })
avatarUrl!: string | null;
@IsString()
@DocsProperty({ type: String })
weekStart!: string;
@IsString()
@DocsProperty({ type: String, nullable: true })
brandColor!: string | null;
@IsString()
@DocsProperty({ type: String, nullable: true })
darkBrandColor!: string | null;
@Type(() => Object)
@DocsProperty({ type: Object })
metadata!: Record<string, unknown>;
}
@@ -141,7 +154,8 @@ class BaseEventTypeOutput_2024_06_14 {
@ArrayUnique()
@IsInt({ each: true })
@Min(1, { each: true })
@DocsProperty({
@ApiPropertyOptional({
type: [Number],
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`.",
@@ -164,6 +178,7 @@ class BaseEventTypeOutput_2024_06_14 {
@ValidateOutputLocations_2024_06_14()
@DocsProperty({
required: true,
oneOf: [
{ $ref: getSchemaPath(OutputAddressLocation_2024_06_14) },
{ $ref: getSchemaPath(OutputLinkLocation_2024_06_14) },
@@ -180,6 +195,7 @@ class BaseEventTypeOutput_2024_06_14 {
@ValidateOutputBookingFields_2024_06_14()
@DocsProperty()
@DocsProperty({
required: true,
oneOf: [
{ $ref: getSchemaPath(NameDefaultFieldOutput_2024_06_14) },
{ $ref: getSchemaPath(EmailDefaultFieldOutput_2024_06_14) },
@@ -211,31 +227,38 @@ class BaseEventTypeOutput_2024_06_14 {
@IsInt()
@IsOptional()
@DocsProperty({ example: 60, type: Number })
@ApiPropertyOptional({ example: 60, nullable: true })
slotInterval?: number | null;
@IsOptional()
@IsInt()
@Min(0)
@IsOptional()
@DocsProperty({ example: 0 })
@ApiPropertyOptional({ example: 0 })
minimumBookingNotice?: number;
@IsInt()
@IsOptional()
@DocsProperty({ example: 0 })
@IsInt()
@Min(0)
@ApiPropertyOptional({ example: 0 })
beforeEventBuffer?: number;
@IsInt()
@IsOptional()
@DocsProperty({ example: 0 })
@IsInt()
@Min(0)
@ApiPropertyOptional({ example: 0 })
afterEventBuffer?: number;
@Type(() => Recurrence_2024_06_14)
@DocsProperty()
@DocsProperty({
type: Recurrence_2024_06_14,
nullable: true,
})
recurrence!: Recurrence_2024_06_14 | null;
@Type(() => Object)
@DocsProperty()
@DocsProperty({
type: Object,
})
metadata!: Record<string, unknown>;
@IsInt()
@@ -251,16 +274,16 @@ class BaseEventTypeOutput_2024_06_14 {
lockTimeZoneToggleOnBookingPage!: boolean;
@IsInt()
@DocsProperty()
@ApiPropertyOptional({ nullable: true })
@IsOptional()
seatsPerTimeSlot?: number | null;
@IsBoolean()
@DocsProperty()
@DocsProperty({ nullable: true })
forwardParamsSuccessRedirect!: boolean | null;
@IsString()
@DocsProperty()
@DocsProperty({ nullable: true })
successRedirectUrl!: string | null;
@IsBoolean()
@@ -269,28 +292,28 @@ class BaseEventTypeOutput_2024_06_14 {
@IsOptional()
@IsBoolean()
@DocsProperty()
@ApiPropertyOptional({ type: Boolean, nullable: true })
seatsShowAvailabilityCount?: boolean | null;
@IsInt()
@DocsProperty()
@DocsProperty({ type: Number, nullable: true })
scheduleId!: number | null;
@IsOptional()
@DocsProperty()
@ApiPropertyOptional()
bookingLimitsCount?: BookingLimitsCount_2024_06_14;
@IsOptional()
@IsBoolean()
@DocsProperty()
@ApiPropertyOptional()
onlyShowFirstAvailableSlot?: boolean;
@IsOptional()
@DocsProperty()
@ApiPropertyOptional()
bookingLimitsDuration?: BookingLimitsDuration_2024_06_14;
@IsOptional()
@DocsProperty({
@ApiPropertyOptional({
description: "Limit how far in the future this event can be booked",
oneOf: [
{ $ref: getSchemaPath(BusinessDaysWindow_2024_06_14) },
@@ -304,57 +327,57 @@ class BaseEventTypeOutput_2024_06_14 {
@IsOptional()
@Type(() => BookerLayouts_2024_06_14)
@DocsProperty()
@ApiPropertyOptional()
bookerLayouts?: BookerLayouts_2024_06_14;
@IsOptional()
@DocsProperty()
@ApiPropertyOptional()
confirmationPolicy?: ConfirmationPolicy_2024_06_14;
@IsOptional()
@IsBoolean()
@DocsProperty()
@ApiPropertyOptional()
requiresBookerEmailVerification?: boolean;
@IsOptional()
@IsBoolean()
@DocsProperty()
@ApiPropertyOptional()
hideCalendarNotes?: boolean;
@IsOptional()
@Type(() => EventTypeColor_2024_06_14)
@DocsProperty()
@ApiPropertyOptional({ type: EventTypeColor_2024_06_14 })
color?: EventTypeColor_2024_06_14;
@IsOptional()
@Type(() => Seats_2024_06_14)
@DocsProperty()
@ApiPropertyOptional({ type: Seats_2024_06_14 })
seats?: Seats_2024_06_14;
@IsOptional()
@IsInt()
@Min(1)
@DocsProperty()
@ApiPropertyOptional()
offsetStart?: number;
@IsOptional()
@IsString()
@DocsProperty()
@ApiPropertyOptional()
customName?: string;
@IsOptional()
@Type(() => DestinationCalendar_2024_06_14)
@DocsProperty()
@ApiPropertyOptional({ type: DestinationCalendar_2024_06_14 })
destinationCalendar?: DestinationCalendar_2024_06_14;
@IsOptional()
@IsBoolean()
@DocsProperty()
@ApiPropertyOptional()
useDestinationCalendarEmail?: boolean;
@IsOptional()
@IsBoolean()
@DocsProperty()
@ApiPropertyOptional()
hideCalendarEventDetails?: boolean;
}
@@ -365,7 +388,10 @@ export class TeamEventTypeResponseHost extends TeamEventTypeHostInput {
@IsString()
@IsOptional()
@DocsProperty({ example: "https://cal.com/api/avatar/d95949bc-ccb1-400f-acf6-045c51a16856.png" })
@ApiPropertyOptional({
example: "https://cal.com/api/avatar/d95949bc-ccb1-400f-acf6-045c51a16856.png",
nullable: true,
})
avatarUrl?: string | null;
}
@@ -383,19 +409,20 @@ export class EventTypeOutput_2024_06_14 extends BaseEventTypeOutput_2024_06_14 {
export class TeamEventTypeOutput_2024_06_14 extends BaseEventTypeOutput_2024_06_14 {
@IsInt()
@IsOptional()
@DocsProperty()
@ApiPropertyOptional({ nullable: true })
teamId?: number | null;
@IsInt()
@IsOptional()
@DocsProperty()
@ApiPropertyOptional({ nullable: true })
ownerId?: number | null;
@IsInt()
@IsOptional()
@DocsProperty({
@ApiPropertyOptional({
description:
"For managed event types, parent event type is the event type that this event type is based on",
nullable: true,
})
parentEventTypeId?: number | null;
@@ -407,20 +434,20 @@ export class TeamEventTypeOutput_2024_06_14 extends BaseEventTypeOutput_2024_06_
@IsBoolean()
@IsOptional()
@DocsProperty()
@ApiPropertyOptional()
assignAllTeamMembers?: boolean;
@IsEnum(SchedulingTypeEnum)
@DocsProperty({ enum: SchedulingTypeEnum })
@DocsProperty({ enum: SchedulingTypeEnum, nullable: true })
schedulingType!: EventTypesOutputSchedulingType | null;
@IsOptional()
@IsBoolean()
@DocsProperty()
@ApiPropertyOptional()
hideCalendarEventDetails?: boolean;
@IsString()
@IsOptional()
@DocsProperty()
@ApiPropertyOptional()
bannerUrl?: string;
}
@@ -1,5 +1,5 @@
import { BadRequestException } from "@nestjs/common";
import { ApiProperty as DocsProperty } from "@nestjs/swagger";
import { ApiPropertyOptional, ApiProperty as DocsProperty } from "@nestjs/swagger";
import { plainToInstance } from "class-transformer";
import { IsUrl, IsIn, IsOptional, IsNumber, IsString } from "class-validator";
import type { ValidationOptions, ValidatorConstraintInterface } from "class-validator";
@@ -61,19 +61,29 @@ export type OutputIntegration_2024_06_14 = (typeof integrationsValues)[number];
export class OutputIntegrationLocation_2024_06_14 {
@IsIn(outputLocations)
@DocsProperty({ example: "integration", description: "only allowed value for type is `integration`" })
@DocsProperty({
example: "integration",
description: "Only allowed value for type is `integration`",
})
type!: "integration";
@IsIn(integrationsValues)
@DocsProperty({ example: integrationsValues[0], enum: integrationsValues })
integration!: OutputIntegration_2024_06_14;
@IsUrl()
@IsOptional()
@IsUrl()
@ApiPropertyOptional({
type: String,
example: "https://example.com",
})
link?: string;
@IsNumber()
@IsOptional()
@IsNumber()
@ApiPropertyOptional({
description: "Credential ID associated with the integration",
})
credentialId?: number;
}
@@ -89,6 +99,7 @@ export class OutputUnknownLocation_2024_06_14 {
type!: "unknown";
@IsString()
@DocsProperty()
location!: string;
}
+10
View File
@@ -1,40 +1,50 @@
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { IsArray, IsNumber, IsOptional, IsBoolean, IsString } from "class-validator";
import { z } from "zod";
export class CreateOAuthClientInput {
@IsOptional()
@IsString()
@ApiPropertyOptional()
logo?: string;
@IsString()
@ApiProperty()
name!: string;
@IsArray()
@IsString({ each: true })
@ApiProperty({ type: [String] })
redirectUris!: string[];
@IsNumber()
@ApiProperty()
permissions!: number;
@IsOptional()
@IsString()
@ApiPropertyOptional()
bookingRedirectUri?: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
bookingCancelRedirectUri?: string;
@IsOptional()
@IsString()
@ApiPropertyOptional()
bookingRescheduleRedirectUri?: string;
@IsOptional()
@IsBoolean()
@ApiPropertyOptional()
areEmailsEnabled?: boolean;
}
export class DeleteOAuthClientInput {
@IsString()
@ApiProperty()
id!: string;
}
@@ -1,107 +1,129 @@
import { ApiProperty as DocsProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Expose } from "class-transformer";
import { IsBoolean, IsInt, IsOptional, IsString, IsUrl, Length } from "class-validator";
export class OrgTeamOutputDto {
@IsInt()
@Expose()
@DocsProperty()
readonly id!: number;
@IsInt()
@IsOptional()
@Expose()
@ApiPropertyOptional()
readonly parentId?: number;
@IsString()
@Length(1)
@Expose()
@DocsProperty()
readonly name!: string;
@IsOptional()
@IsString()
@Expose()
@ApiPropertyOptional()
readonly slug?: string;
@IsOptional()
@IsUrl()
@Expose()
@ApiPropertyOptional()
readonly logoUrl?: string;
@IsOptional()
@IsUrl()
@Expose()
@ApiPropertyOptional()
readonly calVideoLogo?: string;
@IsOptional()
@IsUrl()
@Expose()
@ApiPropertyOptional()
readonly appLogo?: string;
@IsOptional()
@IsUrl()
@Expose()
@ApiPropertyOptional()
readonly appIconLogo?: string;
@IsOptional()
@IsString()
@Expose()
@ApiPropertyOptional()
readonly bio?: string;
@IsOptional()
@IsBoolean()
@Expose()
@ApiPropertyOptional()
readonly hideBranding?: boolean;
@IsBoolean()
@Expose()
readonly isOrganization?: boolean;
@DocsProperty()
readonly isOrganization!: boolean;
@IsOptional()
@IsBoolean()
@Expose()
@ApiPropertyOptional()
readonly isPrivate?: boolean;
@IsOptional()
@IsBoolean()
@Expose()
@ApiPropertyOptional()
readonly hideBookATeamMember?: boolean = false;
@IsOptional()
@IsString()
@Expose()
@ApiPropertyOptional()
readonly metadata?: string;
@IsOptional()
@IsString()
@Expose()
@ApiPropertyOptional()
readonly theme?: string;
@IsOptional()
@IsString()
@Expose()
@ApiPropertyOptional()
readonly brandColor?: string;
@IsOptional()
@IsString()
@Expose()
@ApiPropertyOptional()
readonly darkBrandColor?: string;
@IsOptional()
@IsUrl()
@Expose()
@ApiPropertyOptional()
readonly bannerUrl?: string;
@IsOptional()
@IsString()
@Expose()
@ApiPropertyOptional()
readonly timeFormat?: number;
@IsOptional()
@IsString()
@Expose()
@ApiPropertyOptional({ type: String, default: "Europe/London" })
readonly timeZone?: string = "Europe/London";
@IsOptional()
@IsString()
@Expose()
@ApiPropertyOptional({ type: String, default: "Sunday" })
readonly weekStart?: string = "Sunday";
}
@@ -1,4 +1,4 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Type } from "class-transformer";
import {
IsBoolean,
@@ -19,6 +19,7 @@ export class ScheduleAvailabilityInput_2024_06_11 {
@IsArray()
@IsIn(WEEK_DAYS, { each: true })
@ApiProperty({
type: [String],
example: ["Monday", "Tuesday"],
description: "Array of days when schedule is active.",
enum: WEEK_DAYS,
@@ -27,38 +28,56 @@ export class ScheduleAvailabilityInput_2024_06_11 {
@IsString()
@Matches(TIME_FORMAT_HH_MM, { message: "startTime must be a valid time format HH:MM" })
@ApiProperty({ example: "08:00", description: "startTime must be a valid time in format HH:MM e.g. 08:00" })
@ApiProperty({
example: "08:00",
description: "startTime must be a valid time in format HH:MM e.g. 08:00",
})
startTime!: string;
@IsString()
@Matches(TIME_FORMAT_HH_MM, { message: "endTime must be a valid time format HH:MM" })
@ApiProperty({ example: "15:00", description: "endTime must be a valid time in format HH:MM e.g. 15:00" })
@ApiProperty({
example: "15:00",
description: "endTime must be a valid time in format HH:MM e.g. 15:00",
})
endTime!: string;
}
export class ScheduleOverrideInput_2024_06_11 {
@IsISO8601({ strict: true })
@ApiProperty({ example: "2024-05-20" })
@ApiProperty({
example: "2024-05-20",
})
date!: string;
@IsString()
@Matches(TIME_FORMAT_HH_MM, { message: "startTime must be a valid time format HH:MM" })
@ApiProperty({ example: "12:00", description: "startTime must be a valid time in format HH:MM e.g. 12:00" })
@ApiProperty({
example: "12:00",
description: "startTime must be a valid time in format HH:MM e.g. 12:00",
})
startTime!: string;
@IsString()
@Matches(TIME_FORMAT_HH_MM, { message: "endTime must be a valid time format HH:MM" })
@ApiProperty({ example: "13:00", description: "endTime must be a valid time in format HH:MM e.g. 13:00" })
@ApiProperty({
example: "13:00",
description: "endTime must be a valid time in format HH:MM e.g. 13:00",
})
endTime!: string;
}
export class CreateScheduleInput_2024_06_11 {
@IsString()
@ApiProperty({ example: "Catch up hours" })
@ApiProperty({
type: String,
example: "Catch up hours",
})
name!: string;
@IsTimeZone()
@ApiProperty({
type: String,
example: "Europe/Rome",
description: "Timezone is used to calculate available times when an event using the schedule is booked.",
})
@@ -68,7 +87,7 @@ export class CreateScheduleInput_2024_06_11 {
@IsOptional()
@ValidateNested({ each: true })
@Type(() => ScheduleAvailabilityInput_2024_06_11)
@ApiProperty({
@ApiPropertyOptional({
type: [ScheduleAvailabilityInput_2024_06_11],
description:
"Each object contains days and times when the user is available. If not passed, the default availability is Monday to Friday from 09:00 to 17:00.",
@@ -84,12 +103,12 @@ export class CreateScheduleInput_2024_06_11 {
endTime: "20:00",
},
],
required: false,
})
availability?: ScheduleAvailabilityInput_2024_06_11[];
@IsBoolean()
@ApiProperty({
type: Boolean,
example: true,
description: `Each user should have 1 default schedule. If you specified \`timeZone\` when creating managed user, then the default schedule will be created with that timezone.
Default schedule means that if an event type is not tied to a specific schedule then the default schedule is used.`,
@@ -100,7 +119,7 @@ export class CreateScheduleInput_2024_06_11 {
@IsOptional()
@ValidateNested({ each: true })
@Type(() => ScheduleOverrideInput_2024_06_11)
@ApiProperty({
@ApiPropertyOptional({
type: [ScheduleOverrideInput_2024_06_11],
description: "Need to change availability for a specific date? Add an override.",
example: [
@@ -110,7 +129,6 @@ export class CreateScheduleInput_2024_06_11 {
endTime: "21:00",
},
],
required: false,
})
overrides?: ScheduleOverrideInput_2024_06_11[];
}
@@ -1,4 +1,4 @@
import { ApiProperty } from "@nestjs/swagger";
import { ApiPropertyOptional } from "@nestjs/swagger";
import { Type } from "class-transformer";
import { IsString, IsBoolean, IsOptional, ValidateNested, IsArray, IsTimeZone } from "class-validator";
@@ -10,19 +10,19 @@ import {
export class UpdateScheduleInput_2024_06_11 {
@IsString()
@IsOptional()
@ApiProperty({ example: "One-on-one coaching", required: false })
@ApiPropertyOptional({ type: String, example: "One-on-one coaching" })
name?: string;
@IsTimeZone()
@IsOptional()
@ApiProperty({ example: "Europe/Rome", required: false })
@ApiPropertyOptional({ type: String, example: "Europe/Rome" })
timeZone?: string;
@IsArray()
@IsOptional()
@ValidateNested({ each: true })
@Type(() => ScheduleAvailabilityInput_2024_06_11)
@ApiProperty({
@ApiPropertyOptional({
type: [ScheduleAvailabilityInput_2024_06_11],
example: [
{
@@ -31,20 +31,19 @@ export class UpdateScheduleInput_2024_06_11 {
endTime: "10:00",
},
],
required: false,
})
availability?: ScheduleAvailabilityInput_2024_06_11[];
@IsBoolean()
@IsOptional()
@ApiProperty({ example: true, required: false })
@ApiPropertyOptional({ type: Boolean, example: true })
isDefault?: boolean;
@IsArray()
@IsOptional()
@ValidateNested({ each: true })
@Type(() => ScheduleOverrideInput_2024_06_11)
@ApiProperty({
@ApiPropertyOptional({
type: [ScheduleOverrideInput_2024_06_11],
example: [
{
@@ -53,7 +52,6 @@ export class UpdateScheduleInput_2024_06_11 {
endTime: "14:00",
},
],
required: false,
})
overrides?: ScheduleOverrideInput_2024_06_11[];
}
@@ -1,14 +1,6 @@
import { ApiProperty } from "@nestjs/swagger";
import { Type } from "class-transformer";
import {
IsBoolean,
IsOptional,
IsString,
ValidateNested,
IsArray,
IsTimeZone,
IsNumber,
} from "class-validator";
import { IsBoolean, IsString, ValidateNested, IsArray, IsTimeZone, IsNumber } from "class-validator";
import {
ScheduleAvailabilityInput_2024_06_11,
@@ -57,7 +49,6 @@ export class ScheduleOutput_2024_06_11 {
isDefault!: boolean;
@IsArray()
@IsOptional()
@ValidateNested({ each: true })
@Type(() => ScheduleOverrideInput_2024_06_11)
@ApiProperty({
+9 -4
View File
@@ -32,43 +32,48 @@ export class GetAvailableSlotsInput {
@Transform(({ value }: { value: string }) => value && parseInt(value))
@IsNumber()
@IsOptional()
@ApiProperty({ description: "Event Type ID for which slots are being fetched.", example: 100 })
@ApiPropertyOptional({ description: "Event Type ID for which slots are being fetched.", example: 100 })
eventTypeId?: number;
@IsString()
@IsOptional()
@ApiProperty({ description: "Slug of the event type for which slots are being fetched." })
@ApiPropertyOptional({ description: "Slug of the event type for which slots are being fetched." })
eventTypeSlug?: string;
@IsArray()
@IsString({ each: true })
@IsOptional()
@ApiProperty({
@ApiPropertyOptional({
type: [String],
description: "Only for dynamic events - list of usernames for which slots are being fetched.",
})
usernameList?: string[];
@IsBoolean()
@IsOptional()
@ApiPropertyOptional()
debug?: boolean;
@Transform(({ value }: { value: string }) => value && parseInt(value))
@IsNumber()
@IsOptional()
@Min(1, { message: "Duration must be a positive number" })
@ApiProperty({ description: "Only for dynamic events - length of returned slots." })
@ApiPropertyOptional({ description: "Only for dynamic events - length of returned slots." })
duration?: number;
@IsOptional()
@IsString()
@ApiPropertyOptional({ type: String, nullable: true })
rescheduleUid?: string | null;
@IsString()
@IsOptional()
@ApiPropertyOptional()
timeZone?: string;
@IsString()
@IsOptional()
@ApiPropertyOptional({ description: "Organization slug." })
orgSlug?: string;
@IsString()