From fbc623f187b17882ec0c4e84fa635f51e71e4a66 Mon Sep 17 00:00:00 2001 From: Somay Chauhan Date: Wed, 9 Oct 2024 14:09:58 +0530 Subject: [PATCH] undo linting changes --- .../routing-forms/components/SingleForm.tsx | 6 +- .../config/BasicConfig.ts | 10 +- .../routing-forms/getEventTypeRedirectUrl.ts | 2 +- .../routing-forms/lib/InitialConfig.tsx | 5 +- .../routing-forms/lib/evaluateRaqbLogic.ts | 10 +- .../routing-forms/lib/getAttributes.ts | 9 +- .../lib/getQueryBuilderConfig.ts | 1 - .../routing-forms/lib/getSerializableForm.ts | 5 +- .../routing-forms/lib/processRoute.tsx | 4 +- .../getUrlSearchParamsToForward.test.ts | 2 +- .../getUrlSearchParamsToForward.ts | 4 +- .../playwright/tests/basic.e2e.ts | 2 +- .../app-store/routing-forms/trpc/_router.ts | 4 +- ...eamMembersMatchingAttributeLogic.schema.ts | 2 +- .../trpc/getAttributesForTeam.handler.ts | 9 +- .../app-store/routing-forms/trpc/raqbUtils.ts | 25 ++-- .../routing-forms/trpc/response.handler.ts | 5 +- .../app-store/routing-forms/trpc/utils.ts | 13 +- .../app-store/routing-forms/types/types.d.ts | 4 +- packages/embeds/embed-core/src/embed.test.ts | 4 +- .../booking-to-mutation-input-mapper.tsx | 2 +- packages/lib/bookings/getRoutedUsers.ts | 4 +- packages/prisma/schema.prisma | 111 +++++++++--------- 23 files changed, 113 insertions(+), 130 deletions(-) diff --git a/packages/app-store/routing-forms/components/SingleForm.tsx b/packages/app-store/routing-forms/components/SingleForm.tsx index f0627897d6634e..0ecf14ec43d053 100644 --- a/packages/app-store/routing-forms/components/SingleForm.tsx +++ b/packages/app-store/routing-forms/components/SingleForm.tsx @@ -259,7 +259,7 @@ function SingleForm({ form, appUrl, Page, enrichedWithUserProfileForm }: SingleF function testRouting() { const route = findMatchingRoute({ form, response }); - + if (route?.action?.type === "eventTypeRedirectUrl") { setEventTypeUrl( enrichedWithUserProfileForm @@ -271,9 +271,9 @@ function SingleForm({ form, appUrl, Page, enrichedWithUserProfileForm }: SingleF : "" ); } - + setChosenRoute(route || null); - + if (!route) return; findTeamMembersMatchingAttributeLogicMutation.mutate({ diff --git a/packages/app-store/routing-forms/components/react-awesome-query-builder/config/BasicConfig.ts b/packages/app-store/routing-forms/components/react-awesome-query-builder/config/BasicConfig.ts index 74651933430d44..9a6c4455e9692e 100644 --- a/packages/app-store/routing-forms/components/react-awesome-query-builder/config/BasicConfig.ts +++ b/packages/app-store/routing-forms/components/react-awesome-query-builder/config/BasicConfig.ts @@ -1,5 +1,6 @@ // This is taken from "react-awesome-query-builder/lib/config/basic"; import type { + Operators as RAQBOperators, Conjunction as RAQBConjunction, Widget as RAQBWidget, Type as RAQBType, @@ -7,14 +8,11 @@ import type { Operator as RAQBOperator, } from "react-awesome-query-builder"; -export type Conjunction = Omit< - RAQBConjunction, - "formatConj" | "sqlFormatConj" | "spelFormatConj" | "mongoConj" ->; +export type Conjunction = Omit; export type Conjunctions = Record; export type Operator = RAQBOperator & { _jsonLogicIsExclamationOp?: boolean; -}; +} export type Operators = Record; export type WidgetWithoutFactory = Omit & { type: string; @@ -452,4 +450,4 @@ export default { widgets, types, settings, -}; +}; \ No newline at end of file diff --git a/packages/app-store/routing-forms/getEventTypeRedirectUrl.ts b/packages/app-store/routing-forms/getEventTypeRedirectUrl.ts index c29636a4fad442..fb82008f3448d0 100644 --- a/packages/app-store/routing-forms/getEventTypeRedirectUrl.ts +++ b/packages/app-store/routing-forms/getEventTypeRedirectUrl.ts @@ -1,5 +1,5 @@ import { CAL_URL } from "@calcom/lib/constants"; -import type { Ensure } from "@calcom/types/utils"; +import { Ensure } from "@calcom/types/utils"; function getUserAndEventTypeSlug(eventTypeRedirectUrl: string) { if (eventTypeRedirectUrl.startsWith("/")) { diff --git a/packages/app-store/routing-forms/lib/InitialConfig.tsx b/packages/app-store/routing-forms/lib/InitialConfig.tsx index 78a6d9fc1ea11b..9481cdeafb0912 100644 --- a/packages/app-store/routing-forms/lib/InitialConfig.tsx +++ b/packages/app-store/routing-forms/lib/InitialConfig.tsx @@ -1,7 +1,4 @@ -import { - FormFieldsBaseConfig, - AttributesBaseConfig, -} from "../components/react-awesome-query-builder/config/config"; +import { FormFieldsBaseConfig, AttributesBaseConfig } from "../components/react-awesome-query-builder/config/config"; export const FormFieldsInitialConfig = FormFieldsBaseConfig; export const AttributesInitialConfig = AttributesBaseConfig; diff --git a/packages/app-store/routing-forms/lib/evaluateRaqbLogic.ts b/packages/app-store/routing-forms/lib/evaluateRaqbLogic.ts index 3e48a3cfccce8f..acaa40f2ee4c09 100644 --- a/packages/app-store/routing-forms/lib/evaluateRaqbLogic.ts +++ b/packages/app-store/routing-forms/lib/evaluateRaqbLogic.ts @@ -1,11 +1,8 @@ "use client"; import { Utils as QbUtils, type JsonTree } from "react-awesome-query-builder"; - -import { safeStringify } from "@calcom/lib/safeStringify"; - import jsonLogic from "./jsonLogic"; - +import { safeStringify } from "@calcom/lib/safeStringify"; export const enum RaqbLogicResult { MATCH = "MATCH", NO_MATCH = "NO_MATCH", @@ -33,10 +30,7 @@ export const evaluateRaqbLogic = ({ if (beStrictWithEmptyLogic && queryValue.children1 && Object.keys(queryValue.children1).length > 0) { throw new Error("Couldn't build the logic from the query value"); } - console.log( - "No logic found", - safeStringify({ queryValue, queryBuilderConfigFields: queryBuilderConfig.fields }) - ); + console.log("No logic found", safeStringify({ queryValue, queryBuilderConfigFields: queryBuilderConfig.fields })); // If no logic is provided, then consider it a match return RaqbLogicResult.LOGIC_NOT_FOUND_SO_MATCHED; } diff --git a/packages/app-store/routing-forms/lib/getAttributes.ts b/packages/app-store/routing-forms/lib/getAttributes.ts index 50db6c5f7925c3..3fd94e660dbb03 100644 --- a/packages/app-store/routing-forms/lib/getAttributes.ts +++ b/packages/app-store/routing-forms/lib/getAttributes.ts @@ -2,11 +2,10 @@ import logger from "@calcom/lib/logger"; import { safeStringify } from "@calcom/lib/safeStringify"; import prisma from "@calcom/prisma"; - import type { Attribute } from "../types/types"; async function getAttributeToUserWithMembershipAndAttributesForTeam({ teamId }: { teamId: number }) { - const log = logger.getSubLogger({ prefix: ["getAttributeToUserWithMembershipAndAttributes"] }); + let log = logger.getSubLogger({ prefix: ["getAttributeToUserWithMembershipAndAttributes"] }); const whereClauseForAttributesAssignedToMembersOfTeam = { member: { @@ -53,9 +52,9 @@ async function getAttributeToUserWithMembershipAndAttributesForTeam({ teamId }: } async function getAttributesAssignedToMembersOfTeam({ teamId }: { teamId: number }) { - const log = logger.getSubLogger({ prefix: ["getAttributeToUserWithMembershipAndAttributes"] }); + let log = logger.getSubLogger({ prefix: ["getAttributeToUserWithMembershipAndAttributes"] }); - const whereClauseForAttributesAssignedToMembersOfTeam = { + const whereClauseForAttributesAssignedToMembersOfTeam = { options: { some: { assignedUsers: { @@ -73,7 +72,7 @@ async function getAttributesAssignedToMembersOfTeam({ teamId }: { teamId: number }, }, }, - }; + } log.debug( safeStringify({ diff --git a/packages/app-store/routing-forms/lib/getQueryBuilderConfig.ts b/packages/app-store/routing-forms/lib/getQueryBuilderConfig.ts index c776d077ec8fa1..8f2ef338861c6e 100644 --- a/packages/app-store/routing-forms/lib/getQueryBuilderConfig.ts +++ b/packages/app-store/routing-forms/lib/getQueryBuilderConfig.ts @@ -1,5 +1,4 @@ import { AttributeType } from "@calcom/prisma/enums"; - import type { RoutingForm, Attribute } from "../types/types"; import { FieldTypes, RoutingFormFieldType } from "./FieldTypes"; import { AttributesInitialConfig, FormFieldsInitialConfig } from "./InitialConfig"; diff --git a/packages/app-store/routing-forms/lib/getSerializableForm.ts b/packages/app-store/routing-forms/lib/getSerializableForm.ts index 5ccacbd909f251..8940ad1fbbb8d8 100644 --- a/packages/app-store/routing-forms/lib/getSerializableForm.ts +++ b/packages/app-store/routing-forms/lib/getSerializableForm.ts @@ -2,8 +2,6 @@ import type { App_RoutingForms_Form } from "@prisma/client"; import type { z } from "zod"; import { entityPrismaWhereClause } from "@calcom/lib/entityPermissionUtils"; -import logger from "@calcom/lib/logger"; -import { safeStringify } from "@calcom/lib/safeStringify"; import { RoutingFormSettings } from "@calcom/prisma/zod-utils"; import type { SerializableForm, SerializableFormTeamMembers } from "../types/types"; @@ -13,7 +11,8 @@ import getConnectedForms from "./getConnectedForms"; import isRouter from "./isRouter"; import isRouterLinkedField from "./isRouterLinkedField"; import { getFieldWithOptions } from "./selectOptions"; - +import logger from "@calcom/lib/logger"; +import { safeStringify } from "@calcom/lib/safeStringify"; const log = logger.getSubLogger({ prefix: ["getSerializableForm"] }); /** * Doesn't have deleted fields by default diff --git a/packages/app-store/routing-forms/lib/processRoute.tsx b/packages/app-store/routing-forms/lib/processRoute.tsx index 3a17eef7311d9a..1d9222e5d9da20 100644 --- a/packages/app-store/routing-forms/lib/processRoute.tsx +++ b/packages/app-store/routing-forms/lib/processRoute.tsx @@ -5,10 +5,10 @@ import type { z } from "zod"; import type { FormResponse, Route, SerializableForm } from "../types/types"; import type { zodNonRouterRoute } from "../zod"; -import { evaluateRaqbLogic, RaqbLogicResult } from "./evaluateRaqbLogic"; import { getQueryBuilderConfigForFormFields } from "./getQueryBuilderConfig"; import { isFallbackRoute } from "./isFallbackRoute"; import isRouter from "./isRouter"; +import { evaluateRaqbLogic, RaqbLogicResult } from "./evaluateRaqbLogic"; export function findMatchingRoute({ form, @@ -54,7 +54,7 @@ export function findMatchingRoute({ queryBuilderConfig, data: responseValues, }); - + if (result === RaqbLogicResult.MATCH || result === RaqbLogicResult.LOGIC_NOT_FOUND_SO_MATCHED) { chosenRoute = route; break; diff --git a/packages/app-store/routing-forms/pages/routing-link/getUrlSearchParamsToForward.test.ts b/packages/app-store/routing-forms/pages/routing-link/getUrlSearchParamsToForward.test.ts index 8e10da41fd5e20..d571ff1bfa6e7d 100644 --- a/packages/app-store/routing-forms/pages/routing-link/getUrlSearchParamsToForward.test.ts +++ b/packages/app-store/routing-forms/pages/routing-link/getUrlSearchParamsToForward.test.ts @@ -224,7 +224,7 @@ describe("getUrlSearchParamsToForward", () => { fields, searchParams, teamMembersMatchingAttributeLogic: null, - formResponseId: 1, + formResponseId: 1 }); expect(fromEntriesWithDuplicateKeys(result.entries())).toEqual(expectedParams); }); diff --git a/packages/app-store/routing-forms/pages/routing-link/getUrlSearchParamsToForward.ts b/packages/app-store/routing-forms/pages/routing-link/getUrlSearchParamsToForward.ts index 6a849cbb89a51f..aa093873a62261 100644 --- a/packages/app-store/routing-forms/pages/routing-link/getUrlSearchParamsToForward.ts +++ b/packages/app-store/routing-forms/pages/routing-link/getUrlSearchParamsToForward.ts @@ -76,9 +76,9 @@ export function getUrlSearchParamsToForward({ // In case of conflict b/w paramsFromResponse and paramsFromCurrentUrl, paramsFromResponse should win as the booker probably improved upon the prefilled value. ...paramsFromResponse, ...(teamMembersMatchingAttributeLogic - ? { ["cal.routedTeamMemberIds"]: teamMembersMatchingAttributeLogic.join(",") } + ? { ['cal.routedTeamMemberIds']: teamMembersMatchingAttributeLogic.join(",") } : null), - ["cal.routingFormResponseId"]: String(formResponseId), + ['cal.routingFormResponseId']: String(formResponseId), }; const allQueryURLSearchParams = new URLSearchParams(); diff --git a/packages/app-store/routing-forms/playwright/tests/basic.e2e.ts b/packages/app-store/routing-forms/playwright/tests/basic.e2e.ts index a92b88d4e87465..fc9516085430ec 100644 --- a/packages/app-store/routing-forms/playwright/tests/basic.e2e.ts +++ b/packages/app-store/routing-forms/playwright/tests/basic.e2e.ts @@ -346,7 +346,7 @@ test.describe("Routing Forms", () => { ); await expect(page.locator("text=Multiselect chosen")).toBeVisible({ timeout: 10000 }); - // Negative test - Ensures that the "No logic" situation where a Route is considered to be always passing isn't hitting + // Negative test - Ensures that the "No logic" situation where a Route is considered to be always passing isn't hitting await page.goto(`/router?form=${routingForm.id}&Test field=kuchbhi`); await page.waitForURL((url) => { return url.searchParams.get("Test field") === "kuchbhi"; diff --git a/packages/app-store/routing-forms/trpc/_router.ts b/packages/app-store/routing-forms/trpc/_router.ts index a7fcdcd5550a24..20b3a111771fd7 100644 --- a/packages/app-store/routing-forms/trpc/_router.ts +++ b/packages/app-store/routing-forms/trpc/_router.ts @@ -3,13 +3,13 @@ import publicProcedure from "@calcom/trpc/server/procedures/publicProcedure"; import { router } from "@calcom/trpc/server/trpc"; import { ZDeleteFormInputSchema } from "./deleteForm.schema"; -import { ZFindTeamMembersMatchingAttributeLogicInputSchema } from "./findTeamMembersMatchingAttributeLogic.schema"; import { ZFormMutationInputSchema } from "./formMutation.schema"; import { ZFormQueryInputSchema } from "./formQuery.schema"; -import { ZGetAttributesForTeamInputSchema } from "./getAttributesForTeam.schema"; import { forms } from "./procedures/forms"; import { ZReportInputSchema } from "./report.schema"; import { ZResponseInputSchema } from "./response.schema"; +import { ZGetAttributesForTeamInputSchema } from "./getAttributesForTeam.schema"; +import { ZFindTeamMembersMatchingAttributeLogicInputSchema } from "./findTeamMembersMatchingAttributeLogic.schema"; // eslint-disable-next-line @typescript-eslint/ban-types const UNSTABLE_HANDLER_CACHE: Record = {}; diff --git a/packages/app-store/routing-forms/trpc/findTeamMembersMatchingAttributeLogic.schema.ts b/packages/app-store/routing-forms/trpc/findTeamMembersMatchingAttributeLogic.schema.ts index c3576490935d41..60ce96c90c53b3 100644 --- a/packages/app-store/routing-forms/trpc/findTeamMembersMatchingAttributeLogic.schema.ts +++ b/packages/app-store/routing-forms/trpc/findTeamMembersMatchingAttributeLogic.schema.ts @@ -3,7 +3,7 @@ import { z } from "zod"; export const ZFindTeamMembersMatchingAttributeLogicInputSchema = z.object({ formId: z.string(), response: z.record(z.string(), z.any()), - routeId: z.string(), + routeId: z.string() }); export type TFindTeamMembersMatchingAttributeLogicInputSchema = z.infer< diff --git a/packages/app-store/routing-forms/trpc/getAttributesForTeam.handler.ts b/packages/app-store/routing-forms/trpc/getAttributesForTeam.handler.ts index 5ebe7aa17e2f32..45b811abe81c7f 100644 --- a/packages/app-store/routing-forms/trpc/getAttributesForTeam.handler.ts +++ b/packages/app-store/routing-forms/trpc/getAttributesForTeam.handler.ts @@ -1,10 +1,9 @@ -import { MembershipRepository } from "@calcom/lib/server/repository/membership"; -import type { TrpcSessionUser } from "@calcom/trpc/server/trpc"; - import { TRPCError } from "@trpc/server"; +import type { TrpcSessionUser } from "@calcom/trpc/server/trpc"; -import { getAttributesForTeam } from "../lib/getAttributes"; import type { TGetAttributesForTeamInputSchema } from "./getAttributesForTeam.schema"; +import { getAttributesForTeam } from "../lib/getAttributes"; +import { MembershipRepository } from "@calcom/lib/server/repository/membership"; type GetAttributesForTeamHandlerOptions = { ctx: { @@ -29,4 +28,4 @@ export default async function getAttributesForTeamHandler({ } return getAttributesForTeam({ teamId }); -} +} \ No newline at end of file diff --git a/packages/app-store/routing-forms/trpc/raqbUtils.ts b/packages/app-store/routing-forms/trpc/raqbUtils.ts index 796b0804843933..51992f02f77093 100644 --- a/packages/app-store/routing-forms/trpc/raqbUtils.ts +++ b/packages/app-store/routing-forms/trpc/raqbUtils.ts @@ -1,12 +1,14 @@ -import type { App_RoutingForms_Form } from "@prisma/client"; -import type { JsonGroup, JsonItem, JsonRule, JsonTree } from "react-awesome-query-builder"; +import type { App_RoutingForms_Form, User } from "@prisma/client"; +import { JsonGroup, JsonItem, JsonRule, JsonTree } from "react-awesome-query-builder"; import logger from "@calcom/lib/logger"; import { safeStringify } from "@calcom/lib/safeStringify"; -import type { AttributesQueryBuilderConfigWithRaqbFields } from "../lib/getQueryBuilderConfig"; -import { getQueryBuilderConfigForAttributes } from "../lib/getQueryBuilderConfig"; -import type { Attribute } from "../types/types"; +import { + AttributesQueryBuilderConfigWithRaqbFields, + getQueryBuilderConfigForAttributes, +} from "../lib/getQueryBuilderConfig"; +import { Attribute } from "../types/types"; import type { LocalRoute } from "../types/types"; import type { FormResponse, SerializableForm } from "../types/types"; import type { SerializableField } from "../types/types"; @@ -173,11 +175,10 @@ const attributeChangeCompatibility = { attributesQueryValue: NonNullable; attributeId: string; }) { - const fieldTypeFromAttributesQueryValue = - raqbQueryValueUtils.getValueTypeFromAttributesQueryValueForRaqbField({ - attributesQueryValue, - raqbFieldId: attributeId, - }); + const fieldTypeFromAttributesQueryValue = raqbQueryValueUtils.getValueTypeFromAttributesQueryValueForRaqbField({ + attributesQueryValue, + raqbFieldId: attributeId, + }); if (fieldTypeFromAttributesQueryValue === "multiselect") { return ensureArray(attributeValue); @@ -194,7 +195,7 @@ function getAttributesData({ attributesQueryValue: NonNullable; }) { return Object.entries(attributesData).reduce((acc, [attributeId, value]) => { - const compatibleValueForAttributeAndFormFieldMatching = compatibleForAttributeAndFormFieldMatch(value); + let compatibleValueForAttributeAndFormFieldMatching = compatibleForAttributeAndFormFieldMatch(value); // We do this to ensure that correct jsonLogic is generated for an existing route even if the attribute's type changes acc[attributeId] = attributeChangeCompatibility.ensureAttributeValueToBeOfRaqbFieldValueType({ @@ -263,7 +264,7 @@ function getAttributesQueryBuilderConfig({ const attributesQueryBuilderConfigFieldsWithCompatibleListValues = Object.fromEntries( Object.entries(attributesQueryBuilderConfig.fields).map(([raqbFieldId, raqbField]) => { - const raqbFieldType = attributeChangeCompatibility.getRaqbFieldTypeCompatibleWithQueryValue({ + let raqbFieldType = attributeChangeCompatibility.getRaqbFieldTypeCompatibleWithQueryValue({ attributesQueryValue, raqbField, raqbFieldId, diff --git a/packages/app-store/routing-forms/trpc/response.handler.ts b/packages/app-store/routing-forms/trpc/response.handler.ts index fbff3625197d1b..8933b8447106d9 100644 --- a/packages/app-store/routing-forms/trpc/response.handler.ts +++ b/packages/app-store/routing-forms/trpc/response.handler.ts @@ -145,10 +145,7 @@ export const responseHandler = async ({ ctx, input }: ResponseHandlerOptions) => dbFormResponse.response as FormResponse ); - return { - formResponse: dbFormResponse, - teamMembersMatchingAttributeLogic: teamMemberIdsMatchingAttributeLogic, - }; + return { formResponse: dbFormResponse, teamMembersMatchingAttributeLogic: teamMemberIdsMatchingAttributeLogic }; } catch (e) { if (e instanceof Prisma.PrismaClientKnownRequestError) { if (e.code === "P2002") { diff --git a/packages/app-store/routing-forms/trpc/utils.ts b/packages/app-store/routing-forms/trpc/utils.ts index 1f768395f35feb..f7574964b1419e 100644 --- a/packages/app-store/routing-forms/trpc/utils.ts +++ b/packages/app-store/routing-forms/trpc/utils.ts @@ -18,11 +18,8 @@ import type { SerializableField, OrderedResponses } from "../types/types"; import type { FormResponse, SerializableForm } from "../types/types"; import { acrossQueryValueCompatiblity } from "./raqbUtils"; -const { - getAttributesData: getAttributes, - getAttributesQueryBuilderConfig, - getAttributesQueryValue, -} = acrossQueryValueCompatiblity; +const { getAttributesData: getAttributes, getAttributesQueryBuilderConfig, getAttributesQueryValue } = + acrossQueryValueCompatiblity; const moduleLogger = logger.getSubLogger({ prefix: ["routing-forms/trpc/utils"] }); @@ -107,7 +104,7 @@ export async function findTeamMembersMatchingAttributeLogicOfRoute({ if (!route) { return null; } - const teamMembersMatchingAttributeLogic: { + let teamMembersMatchingAttributeLogic: { userId: number; result: RaqbLogicResult; }[] = []; @@ -165,7 +162,9 @@ export async function findTeamMembersMatchingAttributeLogicOfRoute({ moduleLogger.debug(`Team member ${member.userId} matches attributes logic`); teamMembersMatchingAttributeLogic.push({ userId: member.userId, result }); } else { - moduleLogger.debug(`Team member ${member.userId} does not match attributes logic`); + moduleLogger.debug( + `Team member ${member.userId} does not match attributes logic` + ); } }); } diff --git a/packages/app-store/routing-forms/types/types.d.ts b/packages/app-store/routing-forms/types/types.d.ts index 061c72d1f0fbe1..2e2077ec52d245 100644 --- a/packages/app-store/routing-forms/types/types.d.ts +++ b/packages/app-store/routing-forms/types/types.d.ts @@ -1,7 +1,7 @@ import type { App_RoutingForms_Form } from "@prisma/client"; import type z from "zod"; +import { AttributeType } from "@calcom/prisma/client"; -import type { AttributeType } from "@calcom/prisma/client"; import type { RoutingFormSettings } from "@calcom/prisma/zod-utils"; import type QueryBuilderInitialConfig from "../components/react-awesome-query-builder/config/config"; @@ -72,4 +72,4 @@ export type Attribute = { export type AttributesQueryValue = NonNullable; export type FormFieldsQueryValue = LocalRoute["queryValue"]; -export type SerializableField = NonNullable["fields"]>[number]; +export type SerializableField = NonNullable["fields"]>[number]; \ No newline at end of file diff --git a/packages/embeds/embed-core/src/embed.test.ts b/packages/embeds/embed-core/src/embed.test.ts index b36927dcd4abd5..6fa860ce3f52b8 100644 --- a/packages/embeds/embed-core/src/embed.test.ts +++ b/packages/embeds/embed-core/src/embed.test.ts @@ -31,6 +31,8 @@ describe("Cal", () => { CalClass = (await import("./embed")).Cal; }); + + describe("createIframe", () => { describe("params handling with forwardQueryParams feature enabled", () => { beforeEach(() => { @@ -124,7 +126,7 @@ describe("Cal", () => { expect(iframe.src).toContain("duration=30"); expect(iframe.src).toContain("email=test%40example.com"); }); - + it("should respect forwardQueryParams setting to disable sending page query params but still send the ones in the config", () => { mockSearchParams("?param1=value"); diff --git a/packages/features/bookings/lib/book-event-form/booking-to-mutation-input-mapper.tsx b/packages/features/bookings/lib/book-event-form/booking-to-mutation-input-mapper.tsx index 4832d922299212..0fbe2c1072f271 100644 --- a/packages/features/bookings/lib/book-event-form/booking-to-mutation-input-mapper.tsx +++ b/packages/features/bookings/lib/book-event-form/booking-to-mutation-input-mapper.tsx @@ -68,7 +68,7 @@ export const mapBookingToMutationInput = ({ teamMemberEmail, orgSlug, routedTeamMemberIds, - routingFormResponseId, + routingFormResponseId }; }; diff --git a/packages/lib/bookings/getRoutedUsers.ts b/packages/lib/bookings/getRoutedUsers.ts index 285af28f23bee7..7873a68565f67f 100644 --- a/packages/lib/bookings/getRoutedUsers.ts +++ b/packages/lib/bookings/getRoutedUsers.ts @@ -1,5 +1,5 @@ -import logger from "@calcom/lib/logger"; import { safeStringify } from "@calcom/lib/safeStringify"; +import logger from "@calcom/lib/logger"; const log = logger.getSubLogger({ prefix: ["[getRoutedUsers]"] }); @@ -27,7 +27,7 @@ export const getRoutedUsers = ({ routedTeamMemberIds: number[] | null; users: T[]; }) => { - // We don't want to enter a scenario where we have no team members to be booked + // We don't want to enter a scenario where we have no team members to be booked // So, let's just fallback to regular flow if no routedTeamMemberIds are provided if (!routedTeamMemberIds || !routedTeamMemberIds.length) { return users; diff --git a/packages/prisma/schema.prisma b/packages/prisma/schema.prisma index 12b6d0d24d5e6a..5ad99c650e5dc3 100644 --- a/packages/prisma/schema.prisma +++ b/packages/prisma/schema.prisma @@ -570,60 +570,60 @@ enum BookingStatus { } model Booking { - id Int @id @default(autoincrement()) - uid String @unique + id Int @id @default(autoincrement()) + uid String @unique // (optional) UID based on slot start/end time & email against duplicates - idempotencyKey String? @unique - user User? @relation(fields: [userId], references: [id], onDelete: Cascade) - userId Int? + idempotencyKey String? @unique + user User? @relation(fields: [userId], references: [id], onDelete: Cascade) + userId Int? // User's email at the time of booking /// @zod.email() - userPrimaryEmail String? - references BookingReference[] - eventType EventType? @relation(fields: [eventTypeId], references: [id]) - eventTypeId Int? - title String - description String? - customInputs Json? + userPrimaryEmail String? + references BookingReference[] + eventType EventType? @relation(fields: [eventTypeId], references: [id]) + eventTypeId Int? + title String + description String? + customInputs Json? /// @zod.custom(imports.bookingResponses) - responses Json? - startTime DateTime - endTime DateTime - attendees Attendee[] - location String? - createdAt DateTime @default(now()) - updatedAt DateTime? - status BookingStatus @default(ACCEPTED) - paid Boolean @default(false) - payment Payment[] - destinationCalendar DestinationCalendar? @relation(fields: [destinationCalendarId], references: [id]) - destinationCalendarId Int? - cancellationReason String? - rejectionReason String? - dynamicEventSlugRef String? - dynamicGroupSlugRef String? - rescheduled Boolean? - fromReschedule String? - recurringEventId String? - smsReminderNumber String? - workflowReminders WorkflowReminder[] - scheduledJobs String[] // scheduledJobs is deprecated, please use scheduledTriggers instead - seatsReferences BookingSeat[] + responses Json? + startTime DateTime + endTime DateTime + attendees Attendee[] + location String? + createdAt DateTime @default(now()) + updatedAt DateTime? + status BookingStatus @default(ACCEPTED) + paid Boolean @default(false) + payment Payment[] + destinationCalendar DestinationCalendar? @relation(fields: [destinationCalendarId], references: [id]) + destinationCalendarId Int? + cancellationReason String? + rejectionReason String? + dynamicEventSlugRef String? + dynamicGroupSlugRef String? + rescheduled Boolean? + fromReschedule String? + recurringEventId String? + smsReminderNumber String? + workflowReminders WorkflowReminder[] + scheduledJobs String[] // scheduledJobs is deprecated, please use scheduledTriggers instead + seatsReferences BookingSeat[] /// @zod.custom(imports.bookingMetadataSchema) - metadata Json? - isRecorded Boolean @default(false) - iCalUID String? @default("") - iCalSequence Int @default(0) - instantMeetingToken InstantMeetingToken? - rating Int? - ratingFeedback String? - noShowHost Boolean? @default(false) - scheduledTriggers WebhookScheduledTriggers[] - oneTimePassword String? @unique @default(uuid()) + metadata Json? + isRecorded Boolean @default(false) + iCalUID String? @default("") + iCalSequence Int @default(0) + instantMeetingToken InstantMeetingToken? + rating Int? + ratingFeedback String? + noShowHost Boolean? @default(false) + scheduledTriggers WebhookScheduledTriggers[] + oneTimePassword String? @unique @default(uuid()) /// @zod.email() - cancelledBy String? + cancelledBy String? /// @zod.email() - rescheduledBy String? + rescheduledBy String? routedFromRoutingFormReponse App_RoutingForms_FormResponse? @@index([eventTypeId]) @@ -935,16 +935,15 @@ model App_RoutingForms_Form { } model App_RoutingForms_FormResponse { - id Int @id @default(autoincrement()) - formFillerId String @default(cuid()) - form App_RoutingForms_Form @relation(fields: [formId], references: [id], onDelete: Cascade) - formId String - response Json - createdAt DateTime @default(now()) - routedToBookingUid String? @unique + id Int @id @default(autoincrement()) + formFillerId String @default(cuid()) + form App_RoutingForms_Form @relation(fields: [formId], references: [id], onDelete: Cascade) + formId String + response Json + createdAt DateTime @default(now()) + routedToBookingUid String? @unique // We should not cascade delete the booking, because we want to keep the form response even if the routedToBooking is deleted - routedToBooking Booking? @relation(fields: [routedToBookingUid], references: [uid]) - + routedToBooking Booking? @relation(fields: [routedToBookingUid], references: [uid]) @@unique([formFillerId, formId]) @@index([formFillerId]) @@index([formId])