From 91a480b83abd1e8714880d101a986da6d78f7dab Mon Sep 17 00:00:00 2001 From: kusiewicz <78431445+kusiewicz@users.noreply.github.com> Date: Thu, 16 Oct 2025 10:42:34 +0200 Subject: [PATCH] fix: managed user api playground (time format transform) (#24255) * fix: managed user time format transform * feat: add transform decorator to handle null/undefined timeFormat values in UpdateManagedUserInput --------- Co-authored-by: chauhan_s --- .../users/inputs/create-managed-user.input.ts | 6 ++++-- .../users/inputs/update-managed-user.input.ts | 3 +++ docs/api-reference/v2/openapi.json | 18 ++++++++++++++++-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/apps/api/v2/src/modules/users/inputs/create-managed-user.input.ts b/apps/api/v2/src/modules/users/inputs/create-managed-user.input.ts index 829a10be13..0c726a297a 100644 --- a/apps/api/v2/src/modules/users/inputs/create-managed-user.input.ts +++ b/apps/api/v2/src/modules/users/inputs/create-managed-user.input.ts @@ -1,8 +1,8 @@ import { Locales } from "@/lib/enums/locales"; import { CapitalizeTimeZone } from "@/lib/inputs/capitalize-timezone"; import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger"; -import { Transform } from "class-transformer"; -import { IsOptional, IsTimeZone, IsString, IsEnum, IsIn, IsUrl, IsObject } from "class-validator"; +import { Transform, Type } from "class-transformer"; +import { IsOptional, IsTimeZone, IsString, IsEnum, IsIn, IsUrl, IsObject, IsNumber } from "class-validator"; import { ValidateMetadata } from "@calcom/platform-types"; @@ -17,6 +17,8 @@ export class CreateManagedUserInput { @ApiProperty({ example: "Alice Smith", description: "Managed user's name is used in emails" }) name!: string; + @Type(() => Number) + @IsNumber() @IsOptional() @IsIn([12, 24], { message: "timeFormat must be a number either 12 or 24" }) @ApiPropertyOptional({ example: 12, enum: [12, 24], description: "Must be a number 12 or 24" }) diff --git a/apps/api/v2/src/modules/users/inputs/update-managed-user.input.ts b/apps/api/v2/src/modules/users/inputs/update-managed-user.input.ts index e1cb0fc064..42f9417730 100644 --- a/apps/api/v2/src/modules/users/inputs/update-managed-user.input.ts +++ b/apps/api/v2/src/modules/users/inputs/update-managed-user.input.ts @@ -2,6 +2,7 @@ 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 { ApiPropertyOptional } from "@nestjs/swagger"; +import { Transform, Type } from "class-transformer"; import { IsEnum, IsIn, IsNumber, IsObject, IsOptional, IsString, IsTimeZone, IsUrl } from "class-validator"; import { ValidateMetadata } from "@calcom/platform-types"; @@ -17,6 +18,8 @@ export class UpdateManagedUserInput { @ApiPropertyOptional() name?: string; + @Type(() => Number) + @IsNumber() @IsOptional() @IsIn([12, 24]) @ApiPropertyOptional({ example: 12, enum: [12, 24], description: "Must be 12 or 24" }) diff --git a/docs/api-reference/v2/openapi.json b/docs/api-reference/v2/openapi.json index 2c22349a70..046c06d7cd 100644 --- a/docs/api-reference/v2/openapi.json +++ b/docs/api-reference/v2/openapi.json @@ -17241,6 +17241,20 @@ }, "required": ["type", "slug", "label", "required", "placeholder", "hidden", "isDefault"] }, + "BookerActiveBookingsLimitOutput_2024_06_14": { + "type": "object", + "properties": { + "maximumActiveBookings": { + "type": "number", + "description": "The maximum number of active bookings a booker can have for this event type.", + "example": 3 + }, + "offerReschedule": { + "type": "boolean", + "description": "Whether to offer rescheduling the last active booking to the chosen time slot when limit is reached." + } + } + }, "EventTypeOutput_2024_06_14": { "type": "object", "properties": { @@ -17428,7 +17442,7 @@ "type": "object" }, "bookerActiveBookingsLimit": { - "$ref": "#/components/schemas/BookerActiveBookingsLimit_2024_06_14" + "$ref": "#/components/schemas/BookerActiveBookingsLimitOutput_2024_06_14" }, "onlyShowFirstAvailableSlot": { "type": "boolean" @@ -19729,7 +19743,7 @@ "type": "object" }, "bookerActiveBookingsLimit": { - "$ref": "#/components/schemas/BookerActiveBookingsLimit_2024_06_14" + "$ref": "#/components/schemas/BookerActiveBookingsLimitOutput_2024_06_14" }, "onlyShowFirstAvailableSlot": { "type": "boolean"