Skip to content

Scheduling infrastructure for absolutely everyone.

fix: managed user api playground (time format transform) (#24255)

kusiewicz91a480b83abd
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 829a10be139..0c726a297aa 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 e1cb0fc064a..42f9417730b 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 2c22349a706..046c06d7cd6 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"