feat: Add routing-forms record response endpoint with available slots (#22239)
* feat: Add routing-forms record response endpoint with available slots * fix: resolve TypeScript error in handleResponse.test.ts - Fix type mismatch where mockResponse was passed as identifierKeyedResponse - identifierKeyedResponse expects Record<string, string | string[]> structure - Updated test to pass correct data structure for type compatibility Co-Authored-By: [email protected] <[email protected]> * fix: correct POST endpoint parameter handling and request body parsing in routing forms responses controller - Change @Query() to @Body() decorator for POST request data in controller - Update service method to accept parsed body data directly - Remove incorrect URLSearchParams parsing of request.body object - Fix getRoutingUrl method to use form response data parameter This resolves API v2 test failures by following proper NestJS patterns for POST request handling. Co-Authored-By: [email protected] <[email protected]> * Pass teamMemberEmail as well * Devin fixes reverted * Keep all routing related props together in both endpoints * Remove newly added slots props from Slots documentation as they are used through internal fn call only * fix test * Pass skipContactOwner * Pass crmAppSlug and crmOwnerRecordGType and add more tests * handle external redirect case and form not found case * hide props * chore: bump platform libs --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: [email protected] <[email protected]> Co-authored-by: cal.com <[email protected]> Co-authored-by: Morgan <[email protected]>
This commit is contained in:
23 files changed
+1559
-34
No files matched your search
@@ -145,6 +145,61 @@ class Attendee {
|
||||
language?: BookingLanguageType;
|
||||
}
|
||||
|
||||
class Routing {
|
||||
@ApiProperty({
|
||||
type: Number,
|
||||
description: "The ID of the routing form response that determined this booking assignment.",
|
||||
example: 123,
|
||||
})
|
||||
@IsInt()
|
||||
responseId!: number;
|
||||
|
||||
@ApiProperty({
|
||||
type: [Number],
|
||||
description: "Array of team member IDs that were routed to handle this booking.",
|
||||
example: [101, 102],
|
||||
})
|
||||
@IsArray()
|
||||
@IsInt({ each: true })
|
||||
teamMemberIds!: number[];
|
||||
|
||||
@ApiPropertyOptional({
|
||||
type: String,
|
||||
description: "The email of the team member assigned to handle this booking.",
|
||||
example: "[email protected]",
|
||||
})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
teamMemberEmail?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
type: Boolean,
|
||||
description: "Whether to skip contact owner assignment from CRM integration.",
|
||||
example: true,
|
||||
})
|
||||
@IsBoolean()
|
||||
@IsOptional()
|
||||
skipContactOwner?: boolean;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
type: String,
|
||||
description: "The CRM application slug for integration.",
|
||||
example: "salesforce",
|
||||
})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
crmAppSlug?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
type: String,
|
||||
description: "The CRM owner record type for contact assignment.",
|
||||
example: "Account",
|
||||
})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
crmOwnerRecordType?: string;
|
||||
}
|
||||
|
||||
@ApiExtraModels(
|
||||
BookingInputAddressLocation_2024_08_13,
|
||||
BookingInputAttendeeAddressLocation_2024_08_13,
|
||||
@@ -302,6 +357,20 @@ export class CreateBookingInput_2024_08_13 {
|
||||
If not provided then event type default length will be used for the booking.`,
|
||||
})
|
||||
lengthInMinutes?: number;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
type: Routing,
|
||||
description:
|
||||
"Routing information from routing forms that determined the booking assignment. Both responseId and teamMemberIds are required if provided.",
|
||||
example: {
|
||||
responseId: 123,
|
||||
teamMemberIds: [101, 102],
|
||||
},
|
||||
})
|
||||
@IsOptional()
|
||||
@ValidateNested()
|
||||
@Type(() => Routing)
|
||||
routing?: Routing;
|
||||
}
|
||||
|
||||
export class CreateInstantBookingInput_2024_08_13 extends CreateBookingInput_2024_08_13 {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import { ApiProperty, ApiPropertyOptional, ApiHideProperty } from "@nestjs/swagger";
|
||||
import { Transform } from "class-transformer";
|
||||
import {
|
||||
IsDateString,
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
IsArray,
|
||||
ArrayMinSize,
|
||||
IsEnum,
|
||||
IsBoolean,
|
||||
} from "class-validator";
|
||||
|
||||
import { SlotFormat } from "@calcom/platform-enums";
|
||||
@@ -88,6 +89,26 @@ export class GetAvailableSlotsInput_2024_09_04 {
|
||||
example: "abc123def456",
|
||||
})
|
||||
bookingUidToReschedule?: string;
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@ApiHideProperty()
|
||||
teamMemberEmail?: string;
|
||||
|
||||
@IsNumber()
|
||||
@IsOptional()
|
||||
@ApiHideProperty()
|
||||
routingFormResponseId?: number;
|
||||
|
||||
@IsArray()
|
||||
@IsOptional()
|
||||
@ApiHideProperty()
|
||||
routedTeamMemberIds?: number[];
|
||||
|
||||
@IsBoolean()
|
||||
@IsOptional()
|
||||
@ApiHideProperty()
|
||||
skipContactOwner?: boolean;
|
||||
}
|
||||
|
||||
export const ById_2024_09_04_type = "byEventTypeId";
|
||||
|
||||
Reference in new issue
Block a user