feat: added Ability to set organizer's default app as a valid input location in api/v2 (#19549)
* feat: added Ability to set organizer's default app as a valid input location in api/v2 * only allow organizers default for team events * fixed for atoms and added unit and e2e tests * Update organizations-event-types.e2e-spec.ts * Update transformApiEventTypeForAtom.ts * published [email protected] --------- Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
1 parent
615ef93572
commit
6244b5a2c0
17 files changed
+593
-353
No files matched your search
@@ -30,7 +30,7 @@
|
||||
"@axiomhq/winston": "^1.2.0",
|
||||
"@calcom/platform-constants": "*",
|
||||
"@calcom/platform-enums": "*",
|
||||
"@calcom/platform-libraries": "npm:@calcom/[email protected]3",
|
||||
"@calcom/platform-libraries": "npm:@calcom/[email protected]4",
|
||||
"@calcom/platform-libraries-0.0.2": "npm:@calcom/[email protected]",
|
||||
"@calcom/platform-types": "*",
|
||||
"@calcom/platform-utils": "*",
|
||||
|
||||
+3
@@ -187,6 +187,9 @@ describe("Organizations Event Types Endpoints", () => {
|
||||
type: "integration",
|
||||
integration: "cal-video",
|
||||
},
|
||||
{
|
||||
type: "organizersDefaultApp",
|
||||
},
|
||||
],
|
||||
schedulingType: "COLLECTIVE",
|
||||
hosts: [
|
||||
|
||||
@@ -4,6 +4,7 @@ import { TeamsRepository } from "@/modules/teams/teams/teams.repository";
|
||||
import { UsersRepository } from "@/modules/users/users.repository";
|
||||
import { BadRequestException, Injectable, NotFoundException } from "@nestjs/common";
|
||||
|
||||
import { transformTeamLocationsApiToInternal } from "@calcom/platform-libraries";
|
||||
import {
|
||||
CreateTeamEventTypeInput_2024_06_14,
|
||||
UpdateTeamEventTypeInput_2024_06_14,
|
||||
@@ -81,9 +82,17 @@ export class InputOrganizationsEventTypesService {
|
||||
teamId: number,
|
||||
inputEventType: CreateTeamEventTypeInput_2024_06_14
|
||||
) {
|
||||
const { hosts, assignAllTeamMembers, ...rest } = inputEventType;
|
||||
const { hosts, assignAllTeamMembers, locations, ...rest } = inputEventType;
|
||||
|
||||
const eventType = this.inputEventTypesService.transformInputCreateEventType(rest);
|
||||
|
||||
const defaultLocations: CreateTeamEventTypeInput_2024_06_14["locations"] = [
|
||||
{
|
||||
type: "integration",
|
||||
integration: "cal-video",
|
||||
},
|
||||
];
|
||||
|
||||
const children = await this.getChildEventTypesForManagedEventType(null, inputEventType, teamId);
|
||||
|
||||
const metadata =
|
||||
@@ -100,6 +109,7 @@ export class InputOrganizationsEventTypesService {
|
||||
: this.transformInputHosts(hosts, inputEventType.schedulingType)
|
||||
: undefined,
|
||||
assignAllTeamMembers,
|
||||
locations: this.transformInputTeamLocations(locations || defaultLocations),
|
||||
metadata,
|
||||
children,
|
||||
};
|
||||
@@ -112,7 +122,7 @@ export class InputOrganizationsEventTypesService {
|
||||
teamId: number,
|
||||
inputEventType: UpdateTeamEventTypeInput_2024_06_14
|
||||
) {
|
||||
const { hosts, assignAllTeamMembers, ...rest } = inputEventType;
|
||||
const { hosts, assignAllTeamMembers, locations, ...rest } = inputEventType;
|
||||
|
||||
const eventType = await this.inputEventTypesService.transformInputUpdateEventType(rest, eventTypeId);
|
||||
const dbEventType = await this.teamsEventTypesRepository.getTeamEventType(teamId, eventTypeId);
|
||||
@@ -132,6 +142,7 @@ export class InputOrganizationsEventTypesService {
|
||||
: undefined,
|
||||
assignAllTeamMembers,
|
||||
children,
|
||||
locations: locations ? this.transformInputTeamLocations(locations) : undefined,
|
||||
};
|
||||
|
||||
return teamEventType;
|
||||
@@ -179,6 +190,10 @@ export class InputOrganizationsEventTypesService {
|
||||
return eventType?.children.map((child) => child.userId).filter((id) => !!id) as number[];
|
||||
}
|
||||
|
||||
transformInputTeamLocations(inputLocations: CreateTeamEventTypeInput_2024_06_14["locations"]) {
|
||||
return transformTeamLocationsApiToInternal(inputLocations);
|
||||
}
|
||||
|
||||
async getOwnersForManagedEventType(userIds: number[]) {
|
||||
const users = await this.usersRepository.findByIdsWithEventTypes(userIds);
|
||||
|
||||
|
||||
@@ -9095,6 +9095,19 @@
|
||||
"slug"
|
||||
]
|
||||
},
|
||||
"InputOrganizersDefaultApp_2024_06_14": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"example": "organizersDefaultApp",
|
||||
"description": "only allowed value for type is `organizersDefaultApp`"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type"
|
||||
]
|
||||
},
|
||||
"BookerLayouts_2024_06_14": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -9190,35 +9203,6 @@
|
||||
"type": "string",
|
||||
"example": "Discover the culinary wonders of the Argentina by making the best flan ever!"
|
||||
},
|
||||
"locations": {
|
||||
"type": "array",
|
||||
"description": "Locations where the event will take place. If not provided, cal video link will be used as the location.",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAddressLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputLinkLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputIntegrationLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputPhoneLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeeAddressLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeePhoneLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeeDefinedLocation_2024_06_14"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"bookingFields": {
|
||||
"type": "array",
|
||||
"description": "Custom fields that can be added to the booking form when the event is booked by someone. By default booking form has name and email field.",
|
||||
@@ -9423,6 +9407,35 @@
|
||||
"type": "string",
|
||||
"description": "A valid URL where the booker will redirect to, once the booking is completed successfully",
|
||||
"example": "https://masterchief.com/argentina/flan/video/9129412"
|
||||
},
|
||||
"locations": {
|
||||
"type": "array",
|
||||
"description": "Locations where the event will take place. If not provided, cal video link will be used as the location.",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAddressLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputLinkLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputIntegrationLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputPhoneLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeeAddressLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeePhoneLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeeDefinedLocation_2024_06_14"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -9443,7 +9456,8 @@
|
||||
"phone",
|
||||
"attendeeAddress",
|
||||
"attendeePhone",
|
||||
"attendeeDefined"
|
||||
"attendeeDefined",
|
||||
"organizersDefaultApp"
|
||||
],
|
||||
"example": "address",
|
||||
"description": "only allowed value for type is `address`"
|
||||
@@ -9474,7 +9488,8 @@
|
||||
"phone",
|
||||
"attendeeAddress",
|
||||
"attendeePhone",
|
||||
"attendeeDefined"
|
||||
"attendeeDefined",
|
||||
"organizersDefaultApp"
|
||||
],
|
||||
"example": "link",
|
||||
"description": "only allowed value for type is `link`"
|
||||
@@ -9506,6 +9521,7 @@
|
||||
"attendeeAddress",
|
||||
"attendeePhone",
|
||||
"attendeeDefined",
|
||||
"organizersDefaultApp",
|
||||
"conferencing",
|
||||
"unknown"
|
||||
],
|
||||
@@ -9575,7 +9591,8 @@
|
||||
"phone",
|
||||
"attendeeAddress",
|
||||
"attendeePhone",
|
||||
"attendeeDefined"
|
||||
"attendeeDefined",
|
||||
"organizersDefaultApp"
|
||||
],
|
||||
"example": "phone",
|
||||
"description": "only allowed value for type is `phone`"
|
||||
@@ -9594,7 +9611,7 @@
|
||||
"public"
|
||||
]
|
||||
},
|
||||
"OutputConferencingLocation_2024_06_14": {
|
||||
"OutputOrganizersDefaultAppLocation_2024_06_14": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
@@ -9607,11 +9624,12 @@
|
||||
"attendeeAddress",
|
||||
"attendeePhone",
|
||||
"attendeeDefined",
|
||||
"organizersDefaultApp",
|
||||
"conferencing",
|
||||
"unknown"
|
||||
],
|
||||
"example": "conferencing",
|
||||
"description": "only allowed value for type is `conferencing`"
|
||||
"example": "organizersDefaultApp",
|
||||
"description": "only allowed value for type is `organizersDefaultApp`"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -9631,6 +9649,7 @@
|
||||
"attendeeAddress",
|
||||
"attendeePhone",
|
||||
"attendeeDefined",
|
||||
"organizersDefaultApp",
|
||||
"conferencing",
|
||||
"unknown"
|
||||
],
|
||||
@@ -10838,7 +10857,7 @@
|
||||
"$ref": "#/components/schemas/OutputPhoneLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/OutputConferencingLocation_2024_06_14"
|
||||
"$ref": "#/components/schemas/OutputOrganizersDefaultAppLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/OutputUnknownLocation_2024_06_14"
|
||||
@@ -11164,35 +11183,6 @@
|
||||
"type": "string",
|
||||
"example": "Discover the culinary wonders of the Argentina by making the best flan ever!"
|
||||
},
|
||||
"locations": {
|
||||
"type": "array",
|
||||
"description": "Locations where the event will take place. If not provided, cal video link will be used as the location.",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAddressLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputLinkLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputIntegrationLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputPhoneLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeeAddressLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeePhoneLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeeDefinedLocation_2024_06_14"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"bookingFields": {
|
||||
"type": "array",
|
||||
"description": "Custom fields that can be added to the booking form when the event is booked by someone. By default booking form has name and email field.",
|
||||
@@ -11394,6 +11384,35 @@
|
||||
"type": "string",
|
||||
"description": "A valid URL where the booker will redirect to, once the booking is completed successfully",
|
||||
"example": "https://masterchief.com/argentina/flan/video/9129412"
|
||||
},
|
||||
"locations": {
|
||||
"type": "array",
|
||||
"description": "Locations where the event will take place. If not provided, cal video link will be used as the location.",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAddressLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputLinkLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputIntegrationLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputPhoneLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeeAddressLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeePhoneLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeeDefinedLocation_2024_06_14"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -12753,35 +12772,6 @@
|
||||
"type": "string",
|
||||
"example": "Discover the culinary wonders of the Argentina by making the best flan ever!"
|
||||
},
|
||||
"locations": {
|
||||
"type": "array",
|
||||
"description": "Locations where the event will take place. If not provided, cal video link will be used as the location.",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAddressLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputLinkLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputIntegrationLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputPhoneLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeeAddressLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeePhoneLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeeDefinedLocation_2024_06_14"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"bookingFields": {
|
||||
"type": "array",
|
||||
"description": "Custom fields that can be added to the booking form when the event is booked by someone. By default booking form has name and email field.",
|
||||
@@ -12999,6 +12989,38 @@
|
||||
"assignAllTeamMembers": {
|
||||
"type": "boolean",
|
||||
"description": "If true, all current and future team members will be assigned to this event type"
|
||||
},
|
||||
"locations": {
|
||||
"type": "array",
|
||||
"description": "Locations where the event will take place. If not provided, cal video link will be used as the location.",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAddressLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputLinkLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputIntegrationLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputPhoneLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeeAddressLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeePhoneLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeeDefinedLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputOrganizersDefaultApp_2024_06_14"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -13166,7 +13188,7 @@
|
||||
"$ref": "#/components/schemas/OutputPhoneLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/OutputConferencingLocation_2024_06_14"
|
||||
"$ref": "#/components/schemas/OutputOrganizersDefaultAppLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/OutputUnknownLocation_2024_06_14"
|
||||
@@ -13594,35 +13616,6 @@
|
||||
"type": "string",
|
||||
"example": "Discover the culinary wonders of the Argentina by making the best flan ever!"
|
||||
},
|
||||
"locations": {
|
||||
"type": "array",
|
||||
"description": "Locations where the event will take place. If not provided, cal video link will be used as the location.",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAddressLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputLinkLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputIntegrationLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputPhoneLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeeAddressLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeePhoneLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeeDefinedLocation_2024_06_14"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"bookingFields": {
|
||||
"type": "array",
|
||||
"description": "Custom fields that can be added to the booking form when the event is booked by someone. By default booking form has name and email field.",
|
||||
@@ -13834,6 +13827,38 @@
|
||||
"assignAllTeamMembers": {
|
||||
"type": "boolean",
|
||||
"description": "If true, all current and future team members will be assigned to this event type"
|
||||
},
|
||||
"locations": {
|
||||
"type": "array",
|
||||
"description": "Locations where the event will take place. If not provided, cal video link will be used as the location.",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAddressLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputLinkLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputIntegrationLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputPhoneLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeeAddressLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeePhoneLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputAttendeeDefinedLocation_2024_06_14"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/InputOrganizersDefaultApp_2024_06_14"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user