refactor: circular deps between app store and lib [5] (#23936)
* getBulkEventTypes * 2 eventtypes related utils to features * locationsResolver * checkForEmptyAssignment * mv defaultEvents to features * update imports * PrismaAppRepository * mv currencyConversions from appstore to lib * useAppsData * videoClient * analytics files * fix * mv * prettier * use named import
This commit is contained in:
1 parent
dfdda8a5b8
commit
76332a759b
75 files changed
+182
-192
No files matched your search
@@ -41,8 +41,8 @@ import type {
|
||||
import type { zodRoutes } from "@calcom/app-store/routing-forms/zod";
|
||||
import { RouteActionType } from "@calcom/app-store/routing-forms/zod";
|
||||
import { useOrgBranding } from "@calcom/features/ee/organizations/context/provider";
|
||||
import type { EventTypesByViewer } from "@calcom/features/eventtypes/lib/getEventTypesByViewer";
|
||||
import { areTheySiblingEntities } from "@calcom/lib/entityPermissionUtils.shared";
|
||||
import type { EventTypesByViewer } from "@calcom/lib/event-types/getEventTypesByViewer";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { buildEmptyQueryValue, raqbQueryValueUtils } from "@calcom/lib/raqb/raqbUtils";
|
||||
import type { Prisma } from "@calcom/prisma/client";
|
||||
|
||||
@@ -17,7 +17,7 @@ import { safeStringify } from "@calcom/lib/safeStringify";
|
||||
import {
|
||||
getAllTranscriptsAccessLinkFromMeetingId,
|
||||
submitBatchProcessorTranscriptionJob,
|
||||
} from "@calcom/lib/videoClient";
|
||||
} from "@calcom/app-store/videoClient";
|
||||
import { generateVideoToken } from "@calcom/lib/videoTokens";
|
||||
import prisma from "@calcom/prisma";
|
||||
import { getBooking } from "@calcom/web/lib/daily-webhook/getBooking";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { describe, expect, test, vi, afterEach } from "vitest";
|
||||
|
||||
import { getDownloadLinkOfCalVideoByRecordingId } from "@calcom/lib/videoClient";
|
||||
import { getDownloadLinkOfCalVideoByRecordingId } from "@calcom/app-store/videoClient";
|
||||
import { verifyVideoToken } from "@calcom/lib/videoTokens";
|
||||
|
||||
import { GET } from "../route";
|
||||
|
||||
vi.mock("@calcom/lib/videoClient", () => ({
|
||||
vi.mock("@calcom/app-store/videoClient", () => ({
|
||||
getDownloadLinkOfCalVideoByRecordingId: vi.fn(),
|
||||
}));
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
import { getDownloadLinkOfCalVideoByRecordingId } from "@calcom/lib/videoClient";
|
||||
import { getDownloadLinkOfCalVideoByRecordingId } from "@calcom/app-store/videoClient";
|
||||
import { verifyVideoToken } from "@calcom/lib/videoTokens";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
|
||||
@@ -8,8 +8,8 @@ import { useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
|
||||
import type { LocationObject } from "@calcom/app-store/locations";
|
||||
import { locationsResolver } from "@calcom/app-store/locations";
|
||||
import NoSSR from "@calcom/lib/components/NoSSR";
|
||||
import { locationsResolver } from "@calcom/lib/event-types/utils/locationsResolver";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import type { AppCategories } from "@calcom/prisma/enums";
|
||||
import type { EventTypeMetaDataSchema, eventTypeBookingFields } from "@calcom/prisma/zod-utils";
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useEffect, type FC } from "react";
|
||||
|
||||
import { EventTypeAppSettings } from "@calcom/app-store/_components/EventTypeAppSettingsInterface";
|
||||
import type { EventTypeAppsList } from "@calcom/app-store/utils";
|
||||
import useAppsData from "@calcom/lib/hooks/useAppsData";
|
||||
import useAppsData from "@calcom/features/apps/hooks/useAppsData";
|
||||
|
||||
import type { ConfigureStepCardProps } from "@components/apps/installation/ConfigureStepCard";
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { z } from "zod";
|
||||
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
|
||||
import { determineReschedulePreventionRedirect } from "@calcom/features/bookings/lib/reschedule/determineReschedulePreventionRedirect";
|
||||
import { buildEventUrlFromBooking } from "@calcom/lib/bookings/buildEventUrlFromBooking";
|
||||
import { getDefaultEvent } from "@calcom/lib/defaultEvents";
|
||||
import { getDefaultEvent } from "@calcom/features/eventtypes/lib/defaultEvents";
|
||||
import { maybeGetBookingUidFromSeat } from "@calcom/lib/server/maybeGetBookingUidFromSeat";
|
||||
import { UserRepository } from "@calcom/lib/server/repository/user";
|
||||
import prisma, { bookingMinimalSelect } from "@calcom/prisma";
|
||||
|
||||
@@ -6,7 +6,7 @@ import { eventTypeMetaDataSchemaWithTypedApps } from "@calcom/app-store/zod-util
|
||||
import { orgDomainConfig } from "@calcom/ee/organizations/lib/orgDomains";
|
||||
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
|
||||
import getBookingInfo from "@calcom/features/bookings/lib/getBookingInfo";
|
||||
import { getDefaultEvent } from "@calcom/lib/defaultEvents";
|
||||
import { getDefaultEvent } from "@calcom/features/eventtypes/lib/defaultEvents";
|
||||
import { shouldHideBrandingForEvent } from "@calcom/lib/hideBranding";
|
||||
import { parseRecurringEvent } from "@calcom/lib/isRecurringEvent";
|
||||
import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML";
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { GetBookingType } from "@calcom/features/bookings/lib/get-booking";
|
||||
import { getBookingForReschedule, getBookingForSeatedEvent } from "@calcom/features/bookings/lib/get-booking";
|
||||
import { orgDomainConfig } from "@calcom/features/ee/organizations/lib/orgDomains";
|
||||
import type { getPublicEvent } from "@calcom/features/eventtypes/lib/getPublicEvent";
|
||||
import { getUsernameList } from "@calcom/lib/defaultEvents";
|
||||
import { getUsernameList } from "@calcom/features/eventtypes/lib/defaultEvents";
|
||||
import { shouldHideBrandingForUserEvent } from "@calcom/lib/hideBranding";
|
||||
import { EventRepository } from "@calcom/lib/server/repository/event";
|
||||
import { UserRepository } from "@calcom/lib/server/repository/user";
|
||||
|
||||
@@ -4,9 +4,9 @@ import { encode } from "querystring";
|
||||
import type { z } from "zod";
|
||||
|
||||
import { orgDomainConfig } from "@calcom/features/ee/organizations/lib/orgDomains";
|
||||
import { getEventTypesPublic } from "@calcom/features/eventtypes/lib/getEventTypesPublic";
|
||||
import { DEFAULT_DARK_BRAND_COLOR, DEFAULT_LIGHT_BRAND_COLOR } from "@calcom/lib/constants";
|
||||
import { getUsernameList } from "@calcom/lib/defaultEvents";
|
||||
import { getEventTypesPublic } from "@calcom/lib/event-types/getEventTypesPublic";
|
||||
import { getUsernameList } from "@calcom/features/eventtypes/lib/defaultEvents";
|
||||
import { getUserAvatarUrl } from "@calcom/lib/getAvatarUrl";
|
||||
import logger from "@calcom/lib/logger";
|
||||
import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML";
|
||||
|
||||
@@ -1,129 +0,0 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { checkForEmptyAssignment } from "@calcom/lib/event-types/utils/checkForEmptyAssignment";
|
||||
|
||||
describe("Tests to Check if Event Types have empty Assignment", () => {
|
||||
it("should return true if managed event type has no assigned users", () => {
|
||||
expect(
|
||||
checkForEmptyAssignment({
|
||||
assignedUsers: [],
|
||||
assignAllTeamMembers: false,
|
||||
hosts: [
|
||||
{
|
||||
userId: 101,
|
||||
isFixed: false,
|
||||
priority: 2,
|
||||
weight: 100,
|
||||
scheduleId: null,
|
||||
user: { timeZone: "America/New_York" },
|
||||
},
|
||||
],
|
||||
isManagedEventType: true,
|
||||
})
|
||||
).toBe(true);
|
||||
});
|
||||
it("should return true if non-managed event type has no hosts assigned", () => {
|
||||
expect(
|
||||
checkForEmptyAssignment({
|
||||
assignedUsers: [
|
||||
{
|
||||
created: true,
|
||||
owner: {
|
||||
id: 101,
|
||||
avatar: "avatar.svg",
|
||||
email: "[email protected]",
|
||||
membership: "OWNER",
|
||||
name: "First user",
|
||||
username: "firstuser",
|
||||
profile: {
|
||||
username: "firstuser",
|
||||
upId: "usr-101",
|
||||
id: null,
|
||||
organization: null,
|
||||
organizationId: null,
|
||||
},
|
||||
avatarUrl: null,
|
||||
nonProfileUsername: null,
|
||||
},
|
||||
slug: "managedevent",
|
||||
hidden: false,
|
||||
},
|
||||
],
|
||||
assignAllTeamMembers: false,
|
||||
hosts: [],
|
||||
isManagedEventType: false,
|
||||
})
|
||||
).toBe(true);
|
||||
});
|
||||
it("should return false if assignAllTeamMembers is selected", () => {
|
||||
expect(
|
||||
checkForEmptyAssignment({
|
||||
assignedUsers: [],
|
||||
assignAllTeamMembers: true,
|
||||
hosts: [],
|
||||
isManagedEventType: false,
|
||||
})
|
||||
).toBe(false);
|
||||
});
|
||||
it("should return false if non-managed event type has hosts assigned", () => {
|
||||
expect(
|
||||
checkForEmptyAssignment({
|
||||
assignedUsers: [],
|
||||
assignAllTeamMembers: false,
|
||||
hosts: [
|
||||
{
|
||||
userId: 101,
|
||||
isFixed: false,
|
||||
priority: 2,
|
||||
weight: 100,
|
||||
scheduleId: null,
|
||||
user: { timeZone: "America/New_York" },
|
||||
},
|
||||
],
|
||||
isManagedEventType: false,
|
||||
})
|
||||
).toBe(false);
|
||||
});
|
||||
it("should return false if managed event type has assigned users", () => {
|
||||
expect(
|
||||
checkForEmptyAssignment({
|
||||
assignedUsers: [
|
||||
{
|
||||
created: true,
|
||||
owner: {
|
||||
id: 101,
|
||||
avatar: "avatar.svg",
|
||||
email: "[email protected]",
|
||||
membership: "OWNER",
|
||||
name: "First user",
|
||||
username: "firstuser",
|
||||
profile: {
|
||||
username: "firstuser",
|
||||
upId: "usr-101",
|
||||
id: null,
|
||||
organization: null,
|
||||
organizationId: null,
|
||||
},
|
||||
avatarUrl: null,
|
||||
nonProfileUsername: null,
|
||||
},
|
||||
slug: "managedevent",
|
||||
hidden: false,
|
||||
},
|
||||
],
|
||||
assignAllTeamMembers: false,
|
||||
hosts: [
|
||||
{
|
||||
userId: 101,
|
||||
isFixed: false,
|
||||
priority: 2,
|
||||
weight: 100,
|
||||
scheduleId: null,
|
||||
user: { timeZone: "America/New_York" },
|
||||
},
|
||||
],
|
||||
isManagedEventType: true,
|
||||
})
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user