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 <somaychauhan98@gmail.com>
This commit is contained in:
kusiewicz
2025-10-16 08:42:34 +00:00
committed by GitHub
co-authored by chauhan_s
parent db19bb3d51
commit 91a480b83a
3 changed files with 23 additions and 4 deletions
@@ -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" })
@@ -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" })
+16 -2
View File
@@ -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"