feat: v2 api allow switching event type between collective and round robin (#25045)

* refactor: create team event type hosts

* refactor: update team event type hosts

* feat: allow switching between collective and round robin

* fix: make schedulingType optional when updating

* fix: e2e tests

* fix: e2e and add more tests

* test: only hosts update

* fix: remove test that makes no sense
This commit is contained in:
Lauris Skraucis authored and GitHub committed 2025-11-11 09:40:21 +01:00
1 parent 53a931da4e
commit 8b4f675cee
4 files changed
+686 -20

No files matched your search

@@ -11,8 +11,11 @@ import {
ArrayNotEmpty,
ArrayUnique,
IsUrl,
IsIn,
} from "class-validator";
import { SchedulingType } from "@calcom/platform-enums";
import { RequiresAtLeastOnePropertyWhenNotDisabled } from "../../../utils/RequiresOneOfPropertiesWhenNotDisabled";
import { BookerActiveBookingsLimit_2024_06_14 } from "./booker-active-booking-limit.input";
import { BookerLayouts_2024_06_14 } from "./booker-layouts.input";
@@ -476,6 +479,25 @@ export class UpdateEventTypeInput_2024_06_14 extends BaseUpdateEventTypeInput {
}
export class UpdateTeamEventTypeInput_2024_06_14 extends BaseUpdateEventTypeInput {
@Transform(({ value }) => {
if (value === "collective") {
return SchedulingType.COLLECTIVE;
}
if (value === "roundRobin") {
return SchedulingType.ROUND_ROBIN;
}
return value;
})
@IsIn([SchedulingType.COLLECTIVE, SchedulingType.ROUND_ROBIN])
@IsOptional()
@DocsPropertyOptional({
enum: ["collective", "roundRobin"],
example: "collective",
description: `The scheduling type for the team event - collective or roundRobin. ❗If you change scheduling type you must also provide \`hosts\` or \`assignAllTeamMembers\` in the request body, otherwise the event type will have no hosts - this is required because
in case of collective event type all hosts are mandatory but in case of round robin some or non can be mandatory so we can't predict how you want the hosts to be setup which is why you must provide that information. If you want to convert round robin or collective into managed or managed into round robin or collective then you will have to create a new team event type and delete old one.`,
})
schedulingType?: "COLLECTIVE" | "ROUND_ROBIN";
@ValidateNested({ each: true })
@Type(() => Host)
@IsArray()