refactor: circular deps between app store and lib [4] (#23829)

* mv team queries to features from lib

* update imports

* same

* wip

* move event manager test

* calendar manager to features from lib

* update imports

* update imports

* fix

* mv getEventTypeById

* fix

* fix

* remove

* fix type check error

* fix tests

* fix tests

* fix
This commit is contained in:
Benny Joo
2025-09-18 01:42:40 +01:00
committed by GitHub
parent 3b471f0e25
commit b3a28dca25
90 changed files with 134 additions and 112 deletions
@@ -30,7 +30,7 @@ describe("rateLimitApiKey middleware", () => {
query: {},
userId: testUserId,
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
await rateLimitApiKey(req, res, vi.fn() as any);
expect(res._getStatusCode()).toBe(401);
@@ -43,7 +43,7 @@ describe("rateLimitApiKey middleware", () => {
query: { apiKey: "test-key" },
userId: testUserId,
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(checkRateLimitAndThrowError as any).mockResolvedValueOnce({
limit: 100,
remaining: 99,
@@ -51,6 +51,7 @@ describe("rateLimitApiKey middleware", () => {
});
// @ts-expect-error weird typing between middleware and createMocks
// eslint-disable-next-line @typescript-eslint/no-explicit-any
await rateLimitApiKey(req, res, vi.fn() as any);
expect(checkRateLimitAndThrowError).toHaveBeenCalledWith({
@@ -74,15 +75,14 @@ describe("rateLimitApiKey middleware", () => {
success: true,
};
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(checkRateLimitAndThrowError as any).mockImplementationOnce(
({ onRateLimiterResponse }: { onRateLimiterResponse: (response: RatelimitResponse) => void }) => {
onRateLimiterResponse(rateLimiterResponse);
}
);
// @ts-expect-error weird typing between middleware and createMocks
// eslint-disable-next-line @typescript-eslint/no-explicit-any
await rateLimitApiKey(req, res, vi.fn() as any);
expect(res.getHeader("X-RateLimit-Limit")).toBe(rateLimiterResponse.limit);
@@ -96,10 +96,11 @@ describe("rateLimitApiKey middleware", () => {
query: { apiKey: "test-key" },
userId: testUserId,
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(checkRateLimitAndThrowError as any).mockRejectedValue(new Error("Rate limit exceeded"));
// @ts-expect-error weird typing between middleware and createMocks
// eslint-disable-next-line @typescript-eslint/no-explicit-any
await rateLimitApiKey(req, res, vi.fn() as any);
expect(res._getStatusCode()).toBe(429);
@@ -121,6 +122,7 @@ describe("rateLimitApiKey middleware", () => {
};
// Mock rate limiter to trigger the onRateLimiterResponse callback
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(checkRateLimitAndThrowError as any).mockImplementationOnce(
({ onRateLimiterResponse }: { onRateLimiterResponse: (response: RatelimitResponse) => void }) => {
onRateLimiterResponse(rateLimiterResponse);
@@ -131,6 +133,7 @@ describe("rateLimitApiKey middleware", () => {
vi.mocked(handleAutoLock).mockResolvedValueOnce(true);
// @ts-expect-error weird typing between middleware and createMocks
// eslint-disable-next-line @typescript-eslint/no-explicit-any
await rateLimitApiKey(req, res, vi.fn() as any);
expect(handleAutoLock).toHaveBeenCalledWith({
@@ -158,6 +161,7 @@ describe("rateLimitApiKey middleware", () => {
};
// Mock rate limiter to trigger the onRateLimiterResponse callback
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(checkRateLimitAndThrowError as any).mockImplementationOnce(
({ onRateLimiterResponse }: { onRateLimiterResponse: (response: RatelimitResponse) => void }) => {
onRateLimiterResponse(rateLimiterResponse);
@@ -168,6 +172,7 @@ describe("rateLimitApiKey middleware", () => {
vi.mocked(handleAutoLock).mockRejectedValueOnce(new Error("No user found for this API key."));
// @ts-expect-error weird typing between middleware and createMocks
// eslint-disable-next-line @typescript-eslint/no-explicit-any
await rateLimitApiKey(req, res, vi.fn() as any);
expect(handleAutoLock).toHaveBeenCalledWith({
@@ -195,6 +200,7 @@ describe("rateLimitApiKey middleware", () => {
};
// Mock rate limiter to trigger the onRateLimiterResponse callback
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(checkRateLimitAndThrowError as any).mockImplementationOnce(
({ onRateLimiterResponse }: { onRateLimiterResponse: (response: RatelimitResponse) => void }) => {
onRateLimiterResponse(rateLimiterResponse);
@@ -235,6 +241,7 @@ describe("rateLimitApiKey middleware", () => {
);
// @ts-expect-error weird typing between middleware and createMocks
// eslint-disable-next-line @typescript-eslint/no-explicit-any
await rateLimitApiKey(req, res, vi.fn() as any);
expect(res._getStatusCode()).toBe(429);
@@ -102,8 +102,11 @@ export async function getHandler(req: NextApiRequest) {
const booking = await prisma.booking.findUnique({
where: { id },
include: {
// eslint-disable-next-line @calcom/eslint/no-prisma-include-true
attendees: true,
// eslint-disable-next-line @calcom/eslint/no-prisma-include-true
user: true,
// eslint-disable-next-line @calcom/eslint/no-prisma-include-true
payment: true,
eventType: expand.includes("team") ? { include: { team: true } } : false,
},
@@ -63,6 +63,7 @@ export async function getHandler(req: NextApiRequest) {
const booking = await prisma.booking.findUnique({
where: { id },
// eslint-disable-next-line @calcom/eslint/no-prisma-include-true
include: { references: true },
});
@@ -61,6 +61,7 @@ export async function getHandler(req: NextApiRequest) {
const checkIfRecordingBelongsToBooking = async (bookingId: number, recordingId: string) => {
const booking = await prisma.booking.findUnique({
where: { id: bookingId },
// eslint-disable-next-line @calcom/eslint/no-prisma-include-true
include: { references: true },
});
@@ -44,6 +44,7 @@ export async function getHandler(req: NextApiRequest) {
const booking = await prisma.booking.findUnique({
where: { id },
// eslint-disable-next-line @calcom/eslint/no-prisma-include-true
include: { references: true },
});
@@ -1,7 +1,10 @@
import type { NextApiRequest } from "next";
import type { z } from "zod";
import { getCalendarCredentialsWithoutDelegation, getConnectedCalendars } from "@calcom/lib/CalendarManager";
import {
getCalendarCredentialsWithoutDelegation,
getConnectedCalendars,
} from "@calcom/features/calendars/lib/CalendarManager";
import { HttpError } from "@calcom/lib/http-error";
import { defaultResponder } from "@calcom/lib/server/defaultResponder";
import prisma from "@calcom/prisma";
@@ -1,6 +1,9 @@
import type { NextApiRequest } from "next";
import { getCalendarCredentialsWithoutDelegation, getConnectedCalendars } from "@calcom/lib/CalendarManager";
import {
getCalendarCredentialsWithoutDelegation,
getConnectedCalendars,
} from "@calcom/features/calendars/lib/CalendarManager";
import { HttpError } from "@calcom/lib/http-error";
import { defaultResponder } from "@calcom/lib/server/defaultResponder";
import prisma from "@calcom/prisma";
@@ -55,6 +55,7 @@ async function getHandler(req: NextApiRequest) {
slug: slug, // slug will be undefined if not provided in query
},
include: {
// eslint-disable-next-line @calcom/eslint/no-prisma-include-true
customInputs: true,
hashedLink: { select: { link: true } },
team: { select: { slug: true } },
+1
View File
@@ -46,6 +46,7 @@ export async function paymentById(
if (safeQuery.success && method === "GET") {
const userWithBookings = await prisma.user.findUnique({
where: { id: userId },
// eslint-disable-next-line @calcom/eslint/no-prisma-include-true
include: { bookings: true },
});
await prisma.payment
+5 -1
View File
@@ -75,7 +75,11 @@ import { schemaQueryIdParseInt } from "~/lib/validations/shared/queryIdTransform
export async function getHandler(req: NextApiRequest) {
const { query } = req;
const { id } = schemaQueryIdParseInt.parse(query);
const data = await prisma.schedule.findUniqueOrThrow({ where: { id }, include: { availability: true } });
const data = await prisma.schedule.findUniqueOrThrow({
where: { id },
// eslint-disable-next-line @calcom/eslint/no-prisma-include-true
include: { availability: true },
});
return { schedule: schemaSchedulePublic.parse(data) };
}
@@ -62,6 +62,7 @@ export async function patchHandler(req: NextApiRequest) {
/** Only OWNERS and ADMINS can edit teams */
const _team = await prisma.team.findFirst({
// eslint-disable-next-line @calcom/eslint/no-prisma-include-true
include: { members: true },
where: { id: teamId, members: { some: { userId, role: { in: ["OWNER", "ADMIN"] } } } },
});
+1 -1
View File
@@ -86,7 +86,7 @@ vi.mock("@calcom/lib/di/containers/QualifiedHosts", () => ({
}),
}));
vi.mock("@calcom/lib/EventManager", () => ({
vi.mock("@calcom/features/bookings/lib/EventManager", () => ({
default: vi.fn().mockImplementation(() => ({
reschedule: vi.fn().mockResolvedValue({
results: [],
@@ -134,7 +134,7 @@ export async function getCRMData(
if (!teamMemberEmail || !crmOwnerRecordType || !crmAppSlug) {
const { getTeamMemberEmailForResponseOrContactUsingUrlQuery } = await import(
"@calcom/lib/server/getTeamMemberEmailFromCrm"
"@calcom/features/ee/teams/lib/getTeamMemberEmailFromCrm"
);
const {
email,
@@ -11,7 +11,7 @@ import { Resource, CrudAction, Scope } from "@calcom/features/pbac/domain/types/
import { PermissionCheckService } from "@calcom/features/pbac/services/permission-check.service";
import { RoleService } from "@calcom/features/pbac/services/role.service";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
import { getTeamWithMembers } from "@calcom/lib/server/queries/teams";
import { getTeamWithMembers } from "@calcom/features/ee/teams/lib/queries";
import { prisma } from "@calcom/prisma";
import { buildLegacyRequest } from "@lib/buildLegacyCtx";
@@ -6,7 +6,7 @@ import { z } from "zod";
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
import { CalendarCache } from "@calcom/features/calendar-cache/calendar-cache";
import { getCalendarCredentials, getConnectedCalendars } from "@calcom/lib/CalendarManager";
import { getCalendarCredentials, getConnectedCalendars } from "@calcom/features/calendars/lib/CalendarManager";
import { HttpError } from "@calcom/lib/http-error";
import notEmpty from "@calcom/lib/notEmpty";
import { SelectedCalendarRepository } from "@calcom/lib/server/repository/selectedCalendar";
@@ -10,7 +10,7 @@ import { z } from "zod";
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 { LocationObject } from "@calcom/lib/location";
import type { LocationObject } from "@calcom/app-store/locations";
import type { AppCategories } from "@calcom/prisma/enums";
import type { EventTypeMetaDataSchema, eventTypeBookingFields } from "@calcom/prisma/zod-utils";
import { Avatar } from "@calcom/ui/components/avatar";
+1 -1
View File
@@ -3,7 +3,7 @@ import Link from "next/link";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { useRouterQuery } from "@calcom/lib/hooks/useRouterQuery";
import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML";
import type { TeamWithMembers } from "@calcom/lib/server/queries/teams";
import type { TeamWithMembers } from "@calcom/features/ee/teams/lib/queries";
import type { UserProfile } from "@calcom/types/UserProfile";
import { UserAvatar } from "@calcom/ui/components/avatar";
@@ -10,7 +10,7 @@ import {
ROUTING_FORM_QUEUED_RESPONSE_ID_QUERY_STRING,
} from "@calcom/app-store/routing-forms/lib/constants";
import { RouteActionType } from "@calcom/app-store/routing-forms/zod";
import { getTeamMemberEmailForResponseOrContactUsingUrlQuery } from "@calcom/lib/server/getTeamMemberEmailFromCrm";
import { getTeamMemberEmailForResponseOrContactUsingUrlQuery } from "@calcom/features/ee/teams/lib/getTeamMemberEmailFromCrm";
import { SchedulingType } from "@calcom/prisma/enums";
vi.mock("@calcom/app-store/routing-forms/appBookingFormHandler", () => ({
@@ -8,7 +8,7 @@ import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
import { AppOnboardingSteps } from "@calcom/lib/apps/appOnboardingSteps";
import { CAL_URL } from "@calcom/lib/constants";
import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage";
import type { LocationObject } from "@calcom/lib/location";
import type { LocationObject } from "@calcom/app-store/locations";
import { UserRepository } from "@calcom/lib/server/repository/user";
import prisma from "@calcom/prisma";
import type { Prisma } from "@calcom/prisma/client";
@@ -108,7 +108,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
if (!teamMemberEmail || !crmOwnerRecordType || !crmAppSlug) {
const { getTeamMemberEmailForResponseOrContactUsingUrlQuery } = await import(
"@calcom/lib/server/getTeamMemberEmailFromCrm"
"@calcom/features/ee/teams/lib/getTeamMemberEmailFromCrm"
);
const {
email,
@@ -11,7 +11,7 @@ import { getUserAvatarUrl } from "@calcom/lib/getAvatarUrl";
import { getBookerBaseUrlSync } from "@calcom/lib/getBookerUrl/client";
import logger from "@calcom/lib/logger";
import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML";
import { getTeamWithMembers } from "@calcom/lib/server/queries/teams";
import { getTeamWithMembers } from "@calcom/features/ee/teams/lib/queries";
import slugify from "@calcom/lib/slugify";
import { stripMarkdown } from "@calcom/lib/stripMarkdown";
import prisma from "@calcom/prisma";
@@ -15,7 +15,7 @@ import { AppOnboardingSteps } from "@calcom/lib/apps/appOnboardingSteps";
import { getAppOnboardingUrl } from "@calcom/lib/apps/getAppOnboardingUrl";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import type { LocationObject } from "@calcom/lib/location";
import type { LocationObject } from "@calcom/app-store/locations";
import type { Team } from "@calcom/prisma/client";
import type { eventTypeBookingFields } from "@calcom/prisma/zod-utils";
import type { EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils";
@@ -7,7 +7,7 @@ import { handleConfirmation } from "@calcom/features/bookings/lib/handleConfirma
import { getBooking } from "@calcom/features/bookings/lib/payment/getBooking";
import { getPlatformParams } from "@calcom/features/platform-oauth-client/get-platform-params";
import { PlatformOAuthClientRepository } from "@calcom/features/platform-oauth-client/platform-oauth-client.repository";
import EventManager, { placeholderCreatedEvent } from "@calcom/lib/EventManager";
import EventManager, { placeholderCreatedEvent } from "@calcom/features/bookings/lib/EventManager";
import { HttpError as HttpCode } from "@calcom/lib/http-error";
import logger from "@calcom/lib/logger";
import prisma from "@calcom/prisma";
@@ -1,4 +1,4 @@
import { updateNewTeamMemberEventTypes } from "@calcom/lib/server/queries/teams";
import { updateNewTeamMemberEventTypes } from "@calcom/features/ee/teams/lib/queries";
import { ProfileRepository } from "@calcom/lib/server/repository/profile";
import { prisma } from "@calcom/prisma";
import type { Team, User, OrganizationSettings } from "@calcom/prisma/client";
@@ -1,4 +1,4 @@
import { updateNewTeamMemberEventTypes } from "@calcom/lib/server/queries/teams";
import { updateNewTeamMemberEventTypes } from "@calcom/features/ee/teams/lib/queries";
import { ProfileRepository } from "@calcom/lib/server/repository/profile";
import { prisma } from "@calcom/prisma";
import type { Team, OrganizationSettings } from "@calcom/prisma/client";
@@ -34,10 +34,10 @@ import type {
PartialReference,
} from "@calcom/types/EventManager";
import { createEvent, updateEvent, deleteEvent } from "./CalendarManager";
import CrmManager from "./crmManager/crmManager";
import { isDelegationCredential } from "./delegationCredential/clientAndServer";
import { createMeeting, updateMeeting, deleteMeeting } from "./videoClient";
import { createEvent, updateEvent, deleteEvent } from "@calcom/features/calendars/lib/CalendarManager";
import CrmManager from "@calcom/lib/crmManager/crmManager";
import { isDelegationCredential } from "@calcom/lib/delegationCredential/clientAndServer";
import { createMeeting, updateMeeting, deleteMeeting } from "@calcom/lib/videoClient";
const log = logger.getSubLogger({ prefix: ["EventManager"] });
const CALENDSO_ENCRYPTION_KEY = process.env.CALENDSO_ENCRYPTION_KEY || "";
@@ -17,7 +17,7 @@ import {
} from "@calcom/features/webhooks/lib/scheduleTrigger";
import sendPayload from "@calcom/features/webhooks/lib/sendOrSchedulePayload";
import type { EventTypeInfo } from "@calcom/features/webhooks/lib/sendPayload";
import EventManager from "@calcom/lib/EventManager";
import EventManager from "@calcom/features/bookings/lib/EventManager";
import { getBookerBaseUrl } from "@calcom/lib/getBookerUrl/server";
import getOrgIdFromMemberOrTeamId from "@calcom/lib/getOrgIdFromMemberOrTeamId";
import { getTeamIdFromEventType } from "@calcom/lib/getTeamIdFromEventType";
@@ -11,8 +11,8 @@ import { scheduleTrigger } from "@calcom/features/webhooks/lib/scheduleTrigger";
import sendPayload from "@calcom/features/webhooks/lib/sendOrSchedulePayload";
import type { EventPayloadType, EventTypeInfo } from "@calcom/features/webhooks/lib/sendPayload";
import { getVideoCallUrlFromCalEvent } from "@calcom/lib/CalEventParser";
import type { EventManagerUser } from "@calcom/lib/EventManager";
import EventManager, { placeholderCreatedEvent } from "@calcom/lib/EventManager";
import type { EventManagerUser } from "@calcom/features/bookings/lib/EventManager";
import EventManager, { placeholderCreatedEvent } from "@calcom/features/bookings/lib/EventManager";
import { getBookerBaseUrl } from "@calcom/lib/getBookerUrl/server";
import getOrgIdFromMemberOrTeamId from "@calcom/lib/getOrgIdFromMemberOrTeamId";
import { getTeamIdFromEventType } from "@calcom/lib/getTeamIdFromEventType";
@@ -36,7 +36,7 @@ import {
scheduleTrigger,
} from "@calcom/features/webhooks/lib/scheduleTrigger";
import { getVideoCallUrlFromCalEvent } from "@calcom/lib/CalEventParser";
import EventManager, { placeholderCreatedEvent } from "@calcom/lib/EventManager";
import EventManager, { placeholderCreatedEvent } from "@calcom/features/bookings/lib/EventManager";
import { handleAnalyticsEvents } from "@calcom/lib/analyticsManager/handleAnalyticsEvents";
import { groupHostsByGroupId } from "@calcom/lib/bookings/hostGroupUtils";
import { shouldIgnoreContactOwner } from "@calcom/lib/bookings/routing/utils";
@@ -783,7 +783,7 @@ describe("Round Robin handleNewBooking", () => {
describe("Seated Round Robin Event", () => {
test("For second seat booking, organizer remains the same with no team members included", async () => {
const handleNewBooking = getNewBookingHandler();
const EventManager = (await import("@calcom/lib/EventManager")).default;
const EventManager = (await import("@calcom/features/bookings/lib/EventManager")).default;
const eventManagerSpy = vi.spyOn(EventManager.prototype, "updateCalendarAttendees");
@@ -10,7 +10,7 @@ import {
allowDisablingAttendeeConfirmationEmails,
allowDisablingHostConfirmationEmails,
} from "@calcom/features/ee/workflows/lib/allowDisablingStandardEmails";
import EventManager from "@calcom/lib/EventManager";
import EventManager from "@calcom/features/bookings/lib/EventManager";
import { ErrorCode } from "@calcom/lib/errorCodes";
import { HttpError } from "@calcom/lib/http-error";
import prisma from "@calcom/prisma";
@@ -2,7 +2,7 @@
import { cloneDeep } from "lodash";
import { sendRescheduledSeatEmailAndSMS } from "@calcom/emails";
import type EventManager from "@calcom/lib/EventManager";
import type EventManager from "@calcom/features/bookings/lib/EventManager";
import { getTranslation } from "@calcom/lib/server/i18n";
import prisma from "@calcom/prisma";
import type { Person, CalendarEvent } from "@calcom/types/Calendar";
@@ -3,7 +3,7 @@ import { cloneDeep } from "lodash";
import { uuid } from "short-uuid";
import { sendRescheduledEmailsAndSMS } from "@calcom/emails";
import type EventManager from "@calcom/lib/EventManager";
import type EventManager from "@calcom/features/bookings/lib/EventManager";
import { ErrorCode } from "@calcom/lib/errorCodes";
import { HttpError } from "@calcom/lib/http-error";
import prisma from "@calcom/prisma";
@@ -2,7 +2,7 @@
import { cloneDeep } from "lodash";
import { sendRescheduledEmailsAndSMS } from "@calcom/emails";
import type EventManager from "@calcom/lib/EventManager";
import type EventManager from "@calcom/features/bookings/lib/EventManager";
import prisma from "@calcom/prisma";
import type { AdditionalInformation, AppsStatus } from "@calcom/types/Calendar";
@@ -1,5 +1,5 @@
// eslint-disable-next-line no-restricted-imports
import type EventManager from "@calcom/lib/EventManager";
import type EventManager from "@calcom/features/bookings/lib/EventManager";
import type { createLoggerWithEventDetails } from "../../../handleNewBooking/logger";
import type {
@@ -1,7 +1,7 @@
// eslint-disable-next-line no-restricted-imports
import dayjs from "@calcom/dayjs";
import { refreshCredentials } from "@calcom/features/bookings/lib/getAllCredentialsForUsersOnEvent/refreshCredentials";
import EventManager from "@calcom/lib/EventManager";
import EventManager from "@calcom/features/bookings/lib/EventManager";
import { HttpError } from "@calcom/lib/http-error";
import prisma from "@calcom/prisma";
import { BookingStatus } from "@calcom/prisma/enums";
@@ -11,6 +11,8 @@ import { CalendarAppDelegationCredentialError } from "@calcom/lib/CalendarAppErr
import { ORGANIZER_EMAIL_EXEMPT_DOMAINS } from "@calcom/lib/constants";
import { buildNonDelegationCredentials } from "@calcom/lib/delegationCredential/clientAndServer";
import { formatCalEvent } from "@calcom/lib/formatCalendarEvent";
import getCalendarsEvents from "@calcom/lib/getCalendarsEvents";
import { getCalendarsEventsWithTimezones } from "@calcom/lib/getCalendarsEvents";
import logger from "@calcom/lib/logger";
import { getPiiFreeCalendarEvent, getPiiFreeCredential } from "@calcom/lib/piiFreeData";
import { safeStringify } from "@calcom/lib/safeStringify";
@@ -25,9 +27,6 @@ import type {
import type { CredentialForCalendarService, CredentialPayload } from "@calcom/types/Credential";
import type { EventResult } from "@calcom/types/EventManager";
import getCalendarsEvents from "./getCalendarsEvents";
import { getCalendarsEventsWithTimezones } from "./getCalendarsEvents";
const log = logger.getSubLogger({ prefix: ["CalendarManager"] });
export const getCalendarCredentials = (credentials: Array<CredentialForCalendarService>) => {
@@ -14,7 +14,7 @@ import { deleteWebhookScheduledTriggers } from "@calcom/features/webhooks/lib/sc
import { buildNonDelegationCredential } from "@calcom/lib/delegationCredential/server";
import { isPrismaObjOrUndefined } from "@calcom/lib/isPrismaObj";
import { parseRecurringEvent } from "@calcom/lib/isRecurringEvent";
import { DailyLocationType } from "@calcom/lib/location";
import { DailyLocationType } from "@calcom/app-store/locations";
import { getTranslation } from "@calcom/lib/server/i18n";
import { bookingMinimalSelect, prisma } from "@calcom/prisma";
import type { Prisma } from "@calcom/prisma/client";
@@ -3,7 +3,7 @@ import type { DirectorySyncEvent, Group } from "@boxyhq/saml-jackson";
import logger from "@calcom/lib/logger";
import { safeStringify } from "@calcom/lib/safeStringify";
import { getTranslation } from "@calcom/lib/server/i18n";
import { addNewMembersToEventTypes } from "@calcom/lib/server/queries/teams";
import { addNewMembersToEventTypes } from "@calcom/features/ee/teams/lib/queries";
import { ProfileRepository } from "@calcom/lib/server/repository/profile";
import prisma from "@calcom/prisma";
import { IdentityProvider, MembershipRole } from "@calcom/prisma/enums";
+1 -1
View File
@@ -12,7 +12,7 @@ import { getBooking } from "@calcom/features/bookings/lib/payment/getBooking";
import stripe from "@calcom/features/ee/payments/server/stripe";
import { getPlatformParams } from "@calcom/features/platform-oauth-client/get-platform-params";
import { PlatformOAuthClientRepository } from "@calcom/features/platform-oauth-client/platform-oauth-client.repository";
import EventManager, { placeholderCreatedEvent } from "@calcom/lib/EventManager";
import EventManager, { placeholderCreatedEvent } from "@calcom/features/bookings/lib/EventManager";
import { IS_PRODUCTION } from "@calcom/lib/constants";
import { getErrorFromUnknown } from "@calcom/lib/errors";
import { HttpError as HttpCode } from "@calcom/lib/http-error";
@@ -4,8 +4,8 @@ import { getAllCredentialsIncludeServiceAccountKey } from "@calcom/features/book
import type { EventType } from "@calcom/features/bookings/lib/getAllCredentialsForUsersOnEvent/getAllCredentials";
import { getVideoCallDetails } from "@calcom/features/bookings/lib/handleNewBooking/getVideoCallDetails";
import { getVideoCallUrlFromCalEvent } from "@calcom/lib/CalEventParser";
import EventManager from "@calcom/lib/EventManager";
import type { EventManagerInitParams } from "@calcom/lib/EventManager";
import EventManager from "@calcom/features/bookings/lib/EventManager";
import type { EventManagerInitParams } from "@calcom/features/bookings/lib/EventManager";
import logger from "@calcom/lib/logger";
import { getTranslation } from "@calcom/lib/server/i18n";
import { BookingReferenceRepository } from "@calcom/lib/server/repository/bookingReference";
@@ -22,7 +22,7 @@ import { BookingRepository } from "@calcom/lib/server/repository/booking";
import { SchedulingType, BookingStatus, WorkflowMethods } from "@calcom/prisma/enums";
import { test } from "@calcom/web/test/fixtures/fixtures";
vi.mock("@calcom/lib/EventManager");
vi.mock("@calcom/features/bookings/lib/EventManager");
vi.mock("@calcom/app-store/utils", () => ({
getAppFromSlug: vi.fn(),
}));
@@ -177,7 +177,7 @@ type ConferenceResult = {
};
const mockEventManagerReschedule = async (config?: MockEventManagerConfig) => {
const EventManager = (await import("@calcom/lib/EventManager")).default;
const EventManager = (await import("@calcom/features/bookings/lib/EventManager")).default;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const spy = vi.spyOn(EventManager.prototype as any, "reschedule");
@@ -23,7 +23,7 @@ import {
import { scheduleWorkflowReminders } from "@calcom/features/ee/workflows/lib/reminders/reminderScheduler";
import { getEventName } from "@calcom/features/eventtypes/lib/eventNaming";
import { getVideoCallUrlFromCalEvent } from "@calcom/lib/CalEventParser";
import EventManager from "@calcom/lib/EventManager";
import EventManager from "@calcom/features/bookings/lib/EventManager";
import { SENDER_NAME } from "@calcom/lib/constants";
import { enrichUserWithDelegationCredentialsIncludeServiceAccountKey } from "@calcom/lib/delegationCredential/server";
import { getBookerBaseUrl } from "@calcom/lib/getBookerUrl/server";
@@ -21,7 +21,7 @@ import { BookingRepository } from "@calcom/lib/server/repository/booking";
import { SchedulingType, BookingStatus, WorkflowMethods } from "@calcom/prisma/enums";
import { test } from "@calcom/web/test/fixtures/fixtures";
vi.mock("@calcom/lib/EventManager");
vi.mock("@calcom/features/bookings/lib/EventManager");
const testDestinationCalendar = {
integration: "test-calendar",
@@ -61,7 +61,7 @@ describe("roundRobinReassignment test", () => {
test("reassign new round robin organizer", async ({ emails }) => {
const roundRobinReassignment = (await import("./roundRobinReassignment")).default;
const EventManager = (await import("@calcom/lib/EventManager")).default;
const EventManager = (await import("@calcom/features/bookings/lib/EventManager")).default;
const eventManagerSpy = vi.spyOn(EventManager.prototype as any, "reschedule");
eventManagerSpy.mockResolvedValue({ referencesToCreate: [] });
@@ -194,7 +194,7 @@ describe("roundRobinReassignment test", () => {
// TODO: add fixed hosts test
test("Reassign round robin host with fixed host as organizer", async () => {
const roundRobinReassignment = (await import("./roundRobinReassignment")).default;
const EventManager = (await import("@calcom/lib/EventManager")).default;
const EventManager = (await import("@calcom/features/bookings/lib/EventManager")).default;
const eventManagerSpy = vi.spyOn(EventManager.prototype as any, "reschedule");
@@ -19,7 +19,7 @@ import AssignmentReasonRecorder, {
RRReassignmentType,
} from "@calcom/features/ee/round-robin/assignmentReason/AssignmentReasonRecorder";
import { getEventName } from "@calcom/features/eventtypes/lib/eventNaming";
import EventManager from "@calcom/lib/EventManager";
import EventManager from "@calcom/features/bookings/lib/EventManager";
import {
enrichHostsWithDelegationCredentials,
enrichUserWithDelegationCredentialsIncludeServiceAccountKey,
+1 -1
View File
@@ -1,7 +1,7 @@
import type { SAMLSSORecord, OIDCSSORecord } from "@boxyhq/saml-jackson";
import { HOSTED_CAL_FEATURES } from "@calcom/lib/constants";
import { isTeamAdmin } from "@calcom/lib/server/queries/teams";
import { isTeamAdmin } from "@calcom/features/ee/teams/lib/queries";
export const samlDatabaseUrl = process.env.SAML_DATABASE_URL || "";
export const isSAMLLoginEnabled = samlDatabaseUrl.length > 0;
@@ -2,25 +2,24 @@ import { z } from "zod";
import { getAppFromSlug } from "@calcom/app-store/utils";
import { DATABASE_CHUNK_SIZE } from "@calcom/lib/constants";
import { getBookerBaseUrlSync } from "@calcom/lib/getBookerUrl/client";
import { parseBookingLimit } from "@calcom/lib/intervalLimits/isBookingLimits";
import logger from "@calcom/lib/logger";
import { safeStringify } from "@calcom/lib/safeStringify";
import { getTeam, getOrg } from "@calcom/lib/server/repository/team";
import { UserRepository } from "@calcom/lib/server/repository/user";
import prisma from "@calcom/prisma";
import type { Prisma } from "@calcom/prisma/client";
import type { Team } from "@calcom/prisma/client";
import { SchedulingType } from "@calcom/prisma/enums";
import { baseEventTypeSelect } from "@calcom/prisma/selects";
import { EventTypeSchema } from "@calcom/prisma/zod/modelSchema/EventTypeSchema";
import {
EventTypeMetaDataSchema,
allManagedEventTypeProps,
unlockedManagedEventTypeProps,
eventTypeLocations,
} from "@calcom/prisma/zod-utils";
import { getBookerBaseUrlSync } from "../../../getBookerUrl/client";
import { getTeam, getOrg } from "../../repository/team";
import { UserRepository } from "../../repository/user";
import { EventTypeSchema } from "@calcom/prisma/zod/modelSchema/EventTypeSchema";
export type TeamWithMembers = Awaited<ReturnType<typeof getTeamWithMembers>>;
@@ -1,4 +1,4 @@
import prismock from "../../../tests/libs/__mocks__/prisma";
import prismock from "../../../../tests/libs/__mocks__/prisma";
import { mockNoTranslations } from "@calcom/web/test/utils/bookingScenario/bookingScenario";
@@ -3,12 +3,14 @@ import { getLocationGroupedOptions } from "@calcom/app-store/server";
import { getEventTypeAppData } from "@calcom/app-store/utils";
import { eventTypeMetaDataSchemaWithTypedApps } from "@calcom/app-store/zod-utils";
import { getBookingFieldsWithSystemFields } from "@calcom/features/bookings/lib/getBookingFields";
import { WEBSITE_URL } from "@calcom/lib/constants";
import { getUserAvatarUrl } from "@calcom/lib/getAvatarUrl";
import { getBookerBaseUrl } from "@calcom/lib/getBookerUrl/server";
import { parseBookingLimit } from "@calcom/lib/intervalLimits/isBookingLimits";
import { parseDurationLimit } from "@calcom/lib/intervalLimits/isDurationLimits";
import { parseEventTypeColor } from "@calcom/lib/isEventTypeColor";
import { parseRecurringEvent } from "@calcom/lib/isRecurringEvent";
import type { LocationObject } from "@calcom/lib/location";
import type { LocationObject } from "@calcom/app-store/locations";
import { getTranslation } from "@calcom/lib/server/i18n";
import { EventTypeRepository } from "@calcom/lib/server/repository/eventTypeRepository";
import { UserRepository } from "@calcom/lib/server/repository/user";
@@ -19,9 +21,6 @@ import { customInputSchema } from "@calcom/prisma/zod-utils";
import { TRPCError } from "@trpc/server";
import { WEBSITE_URL } from "../constants";
import { getBookerBaseUrl } from "../getBookerUrl/server";
interface getEventTypeByIdProps {
eventTypeId: number;
userId: number;
+1 -1
View File
@@ -3,7 +3,7 @@ import { z } from "zod";
import type { eventTypeMetaDataSchemaWithTypedApps } from "@calcom/app-store/zod-utils";
import type { ChildrenEventType } from "@calcom/features/eventtypes/components/ChildrenEventTypeSelect";
import type { IntervalLimit } from "@calcom/lib/intervalLimits/intervalLimitSchema";
import type { EventLocationType } from "@calcom/lib/location";
import type { EventLocationType } from "@calcom/app-store/locations";
import type { AttributesQueryValue } from "@calcom/lib/raqb/types";
import type { EventTypeTranslation } from "@calcom/prisma/client";
import { type PeriodType, SchedulingType } from "@calcom/prisma/enums";
@@ -1,6 +1,6 @@
import { FeaturesRepository } from "@calcom/features/flags/features.repository";
import { isOrganisationAdmin } from "@calcom/lib/server/queries/organisations";
import { isTeamAdmin } from "@calcom/lib/server/queries/teams";
import { isTeamAdmin } from "@calcom/features/ee/teams/lib/queries";
import { prisma } from "@calcom/prisma";
import { MembershipRole } from "@calcom/prisma/enums";
@@ -4,7 +4,7 @@ import { selectOOOEntries } from "@calcom/app-store/zapier/api/subscriptions/lis
import dayjs from "@calcom/dayjs";
import { getCalEventResponses } from "@calcom/features/bookings/lib/getCalEventResponses";
import tasker from "@calcom/features/tasker";
import { DailyLocationType, getHumanReadableLocationValue } from "@calcom/lib/location";
import { DailyLocationType, getHumanReadableLocationValue } from "@calcom/app-store/locations";
import logger from "@calcom/lib/logger";
import { safeStringify } from "@calcom/lib/safeStringify";
import { withReporting } from "@calcom/lib/sentryWrapper";
+1 -1
View File
@@ -1,5 +1,5 @@
import dayjs from "@calcom/dayjs";
import { getBusyCalendarTimes } from "@calcom/lib/CalendarManager";
import { getBusyCalendarTimes } from "@calcom/features/calendars/lib/CalendarManager";
import { subtract } from "@calcom/lib/date-ranges";
import { stringToDayjs } from "@calcom/lib/dayjs";
import { intervalLimitKeyToUnit } from "@calcom/lib/intervalLimits/intervalLimit";
@@ -1,4 +1,4 @@
import { getCalendarCredentials, getConnectedCalendars } from "@calcom/lib/CalendarManager";
import { getCalendarCredentials, getConnectedCalendars } from "@calcom/features/calendars/lib/CalendarManager";
import { isDelegationCredential } from "@calcom/lib/delegationCredential/clientAndServer";
import { enrichUserWithDelegationCredentialsIncludeServiceAccountKey } from "@calcom/lib/delegationCredential/server";
import logger from "@calcom/lib/logger";
-1
View File
@@ -1 +0,0 @@
export * from "@calcom/app-store/locations";
+1 -1
View File
@@ -1,7 +1,7 @@
import type { FormResponse, Fields } from "@calcom/app-store/routing-forms/types/types";
import { zodRoutes } from "@calcom/app-store/routing-forms/zod";
import dayjs from "@calcom/dayjs";
import { getBusyCalendarTimes } from "@calcom/lib/CalendarManager";
import { getBusyCalendarTimes } from "@calcom/features/calendars/lib/CalendarManager";
import logger from "@calcom/lib/logger";
import { acrossQueryValueCompatiblity } from "@calcom/lib/raqb/raqbUtils";
import { raqbQueryValueSchema } from "@calcom/lib/raqb/zod";
+4 -4
View File
@@ -1,4 +1,4 @@
import EventManager from "@calcom/lib/EventManager";
import EventManager from "@calcom/features/bookings/lib/EventManager";
export { getPublicEvent, type PublicEventType } from "@calcom/features/eventtypes/lib/getPublicEvent";
@@ -20,12 +20,12 @@ export {
export { validateCustomEventName } from "@calcom/features/eventtypes/lib/eventNaming";
export { EventManager };
export { getEventTypeById } from "@calcom/lib/event-types/getEventTypeById";
export { getEventTypeById } from "@calcom/features/eventtypes/lib/getEventTypeById";
export { getEventTypesByViewer } from "@calcom/lib/event-types/getEventTypesByViewer";
export type { EventType } from "@calcom/lib/event-types/getEventTypeById";
export type { EventType } from "@calcom/features/eventtypes/lib/getEventTypeById";
export type { EventTypesByViewer } from "@calcom/lib/event-types/getEventTypesByViewer";
export type { UpdateEventTypeReturn } from "@calcom/trpc/server/routers/viewer/eventTypes/heavy/update.handler";
export { updateNewTeamMemberEventTypes } from "@calcom/lib/server/queries/teams";
export { updateNewTeamMemberEventTypes } from "@calcom/features/ee/teams/lib/queries";
export { bulkUpdateEventsToDefaultLocation } from "@calcom/app-store/_utils/bulkUpdateEventsToDefaultLocation";
export { bulkUpdateTeamEventsToDefaultLocation } from "@calcom/app-store/_utils/bulkUpdateTeamEventsToDefaultLocation";
+2 -2
View File
@@ -4,6 +4,7 @@ import getBookingInfo from "@calcom/features/bookings/lib/getBookingInfo";
import handleCancelBooking from "@calcom/features/bookings/lib/handleCancelBooking";
import * as newBookingMethods from "@calcom/features/bookings/lib/handleNewBooking";
import { getClientSecretFromPayment } from "@calcom/features/ee/payments/pages/getClientSecretFromPayment";
import { getTeamMemberEmailForResponseOrContactUsingUrlQuery } from "@calcom/features/ee/teams/lib/getTeamMemberEmailFromCrm";
import {
verifyPhoneNumber,
sendVerificationCode,
@@ -14,7 +15,6 @@ import * as instantMeetingMethods from "@calcom/features/instant-meeting/handleI
import { getRoutedUrl } from "@calcom/features/routing-forms/lib/getRoutedUrl";
import getAllUserBookings from "@calcom/lib/bookings/getAllUserBookings";
import { symmetricEncrypt, symmetricDecrypt } from "@calcom/lib/crypto";
import { getTeamMemberEmailForResponseOrContactUsingUrlQuery } from "@calcom/lib/server/getTeamMemberEmailFromCrm";
import { getTranslation } from "@calcom/lib/server/i18n";
import type { Prisma } from "@calcom/prisma/client";
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
@@ -53,7 +53,7 @@ export { handleNewRecurringBooking } from "@calcom/features/bookings/lib/handleN
export { getConnectedDestinationCalendarsAndEnsureDefaultsInDb } from "@calcom/lib/getConnectedDestinationCalendars";
export { getBusyCalendarTimes } from "@calcom/lib/CalendarManager";
export { getBusyCalendarTimes } from "@calcom/features/calendars/lib/CalendarManager";
export type { BookingCreateBody, BookingResponse } from "@calcom/features/bookings/types";
export { HttpError } from "@calcom/lib/http-error";
@@ -1,5 +1,5 @@
import dayjs from "@calcom/dayjs";
import { getBusyCalendarTimes } from "@calcom/lib/CalendarManager";
import { getBusyCalendarTimes } from "@calcom/features/calendars/lib/CalendarManager";
import { enrichUserWithDelegationCredentialsIncludeServiceAccountKey } from "@calcom/lib/delegationCredential/server";
import { prisma } from "@calcom/prisma";
import type { EventBusyDate } from "@calcom/types/Calendar";
@@ -1,10 +1,10 @@
import dayjs from "@calcom/dayjs";
import { sendAddGuestsEmails } from "@calcom/emails";
import EventManager from "@calcom/lib/EventManager";
import EventManager from "@calcom/features/bookings/lib/EventManager";
import { parseRecurringEvent } from "@calcom/lib/isRecurringEvent";
import { getUsersCredentialsIncludeServiceAccountKey } from "@calcom/lib/server/getUsersCredentials";
import { getTranslation } from "@calcom/lib/server/i18n";
import { isTeamAdmin, isTeamOwner } from "@calcom/lib/server/queries/teams";
import { isTeamAdmin, isTeamOwner } from "@calcom/features/ee/teams/lib/queries";
import { prisma } from "@calcom/prisma";
import type { BookingResponses } from "@calcom/prisma/zod-utils";
import type { CalendarEvent } from "@calcom/types/Calendar";
@@ -4,7 +4,7 @@ import { getEventLocationType, OrganizerDefaultConferencingAppType } from "@calc
import { getAppFromSlug } from "@calcom/app-store/utils";
import { sendLocationChangeEmailsAndSMS } from "@calcom/emails";
import { getVideoCallUrlFromCalEvent } from "@calcom/lib/CalEventParser";
import EventManager from "@calcom/lib/EventManager";
import EventManager from "@calcom/features/bookings/lib/EventManager";
import { buildCalEventFromBooking } from "@calcom/lib/buildCalEventFromBooking";
import logger from "@calcom/lib/logger";
import { safeStringify } from "@calcom/lib/safeStringify";
@@ -12,7 +12,7 @@ import { setupAndTeardown } from "@calcom/web/test/utils/bookingScenario/setupAn
import { describe, it, vi, expect } from "vitest";
import { getConnectedCalendars } from "@calcom/lib/CalendarManager";
import { getConnectedCalendars } from "@calcom/features/calendars/lib/CalendarManager";
import { SchedulingType, MembershipRole } from "@calcom/prisma/enums";
import { TRPCError } from "@trpc/server";
@@ -20,7 +20,7 @@ import { TRPCError } from "@trpc/server";
import type { TrpcSessionUser } from "../../../types";
import { setDestinationCalendarHandler } from "./setDestinationCalendar.handler";
vi.mock("@calcom/lib/CalendarManager", () => ({
vi.mock("@calcom/features/calendars/lib/CalendarManager", () => ({
getConnectedCalendars: vi.fn(),
getCalendarCredentials: vi.fn().mockImplementation((creds) => creds),
}));
@@ -1,4 +1,4 @@
import { getCalendarCredentials, getConnectedCalendars } from "@calcom/lib/CalendarManager";
import { getCalendarCredentials, getConnectedCalendars } from "@calcom/features/calendars/lib/CalendarManager";
import { getUsersCredentialsIncludeServiceAccountKey } from "@calcom/lib/server/getUsersCredentials";
import { DestinationCalendarRepository } from "@calcom/lib/server/repository/destinationCalendar";
import { prisma } from "@calcom/prisma";
@@ -1,4 +1,4 @@
import getEventTypeById from "@calcom/lib/event-types/getEventTypeById";
import getEventTypeById from "@calcom/features/eventtypes/lib/getEventTypeById";
import type { PrismaClient } from "@calcom/prisma";
import type { TrpcSessionUser } from "../../../types";
@@ -1,4 +1,4 @@
import { getCalendarCredentials, getConnectedCalendars } from "@calcom/lib/CalendarManager";
import { getCalendarCredentials, getConnectedCalendars } from "@calcom/features/calendars/lib/CalendarManager";
import { buildNonDelegationCredentials } from "@calcom/lib/delegationCredential/server";
import { prisma } from "@calcom/prisma";
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
@@ -12,7 +12,7 @@ import logger from "@calcom/lib/logger";
import { uploadAvatar } from "@calcom/lib/server/avatar";
import { checkUsername } from "@calcom/lib/server/checkUsername";
import { getTranslation } from "@calcom/lib/server/i18n";
import { updateNewTeamMemberEventTypes } from "@calcom/lib/server/queries/teams";
import { updateNewTeamMemberEventTypes } from "@calcom/features/ee/teams/lib/queries";
import { resizeBase64Image } from "@calcom/lib/server/resizeBase64Image";
import slugify from "@calcom/lib/slugify";
import { validateBookerLayouts } from "@calcom/lib/validateBookerLayouts";
@@ -1,5 +1,5 @@
import { isOrganisationAdmin } from "@calcom/lib/server/queries/organisations";
import { updateNewTeamMemberEventTypes } from "@calcom/lib/server/queries/teams";
import { updateNewTeamMemberEventTypes } from "@calcom/features/ee/teams/lib/queries";
import { prisma } from "@calcom/prisma";
import type { Prisma } from "@calcom/prisma/client";
import { MembershipRole } from "@calcom/prisma/enums";
@@ -70,7 +70,7 @@ export const findTeamMembersMatchingAttributeLogicOfRouteHandler = async ({
}: FindTeamMembersMatchingAttributeLogicOfRouteHandlerOptions) => {
const { prisma, user } = ctx;
const { getTeamMemberEmailForResponseOrContactUsingUrlQuery } = await import(
"@calcom/lib/server/getTeamMemberEmailFromCrm"
"@calcom/features/ee/teams/lib/getTeamMemberEmailFromCrm"
);
const { formId, response, route, isPreview, _enablePerf, _concurrency } = input;
@@ -1,5 +1,5 @@
import { createAProfileForAnExistingUser } from "@calcom/lib/createAProfileForAnExistingUser";
import { updateNewTeamMemberEventTypes } from "@calcom/lib/server/queries/teams";
import { updateNewTeamMemberEventTypes } from "@calcom/features/ee/teams/lib/queries";
import { prisma } from "@calcom/prisma";
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
@@ -1,4 +1,4 @@
import { isTeamAdmin, isTeamOwner } from "@calcom/lib/server/queries/teams";
import { isTeamAdmin, isTeamOwner } from "@calcom/features/ee/teams/lib/queries";
import prisma from "@calcom/prisma";
import type { Prisma } from "@calcom/prisma/client";
@@ -1,5 +1,5 @@
import { RoleManagementFactory } from "@calcom/features/pbac/services/role-management.factory";
import { isTeamOwner } from "@calcom/lib/server/queries/teams";
import { isTeamOwner } from "@calcom/features/ee/teams/lib/queries";
import { TeamRepository } from "@calcom/lib/server/repository/team";
import { prisma } from "@calcom/prisma";
import { MembershipRole } from "@calcom/prisma/enums";
@@ -1,7 +1,7 @@
import { randomBytes } from "crypto";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { isTeamAdmin } from "@calcom/lib/server/queries/teams";
import { isTeamAdmin } from "@calcom/features/ee/teams/lib/queries";
import { prisma } from "@calcom/prisma";
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
@@ -1,4 +1,4 @@
import { isTeamOwner } from "@calcom/lib/server/queries/teams";
import { isTeamOwner } from "@calcom/features/ee/teams/lib/queries";
import { TeamService } from "@calcom/lib/server/service/teamService";
import { TRPCError } from "@trpc/server";
@@ -1,4 +1,4 @@
import { isTeamAdmin } from "@calcom/lib/server/queries/teams";
import { isTeamAdmin } from "@calcom/features/ee/teams/lib/queries";
import { prisma } from "@calcom/prisma";
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
@@ -1,6 +1,6 @@
import { describe, it, beforeEach, vi, expect } from "vitest";
import { getTeamWithoutMembers } from "@calcom/lib/server/queries/teams";
import { getTeamWithoutMembers } from "@calcom/features/ee/teams/lib/queries";
import { MembershipRepository } from "@calcom/lib/server/repository/membership";
import type { TrpcSessionUser } from "../../../types";
@@ -12,7 +12,7 @@ vi.mock("@calcom/lib/server/repository/membership", () => ({
},
}));
vi.mock("@calcom/lib/server/queries/teams", () => ({
vi.mock("@calcom/features/ee/teams/lib/queries", () => ({
getTeamWithoutMembers: vi.fn(),
}));
@@ -1,4 +1,4 @@
import { getTeamWithoutMembers } from "@calcom/lib/server/queries/teams";
import { getTeamWithoutMembers } from "@calcom/features/ee/teams/lib/queries";
import { MembershipRepository } from "@calcom/lib/server/repository/membership";
import { TRPCError } from "@trpc/server";
@@ -1,4 +1,4 @@
import { isTeamMember } from "@calcom/lib/server/queries/teams";
import { isTeamMember } from "@calcom/features/ee/teams/lib/queries";
import { prisma } from "@calcom/prisma";
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
@@ -1,6 +1,6 @@
import { enrichUserWithDelegationCredentialsIncludeServiceAccountKey } from "@calcom/lib/delegationCredential/server";
import { getUserAvailabilityService } from "@calcom/lib/di/containers/GetUserAvailability";
import { isTeamMember } from "@calcom/lib/server/queries/teams";
import { isTeamMember } from "@calcom/features/ee/teams/lib/queries";
import { MembershipRepository } from "@calcom/lib/server/repository/membership";
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
@@ -1,7 +1,7 @@
import { describe, it, vi, expect } from "vitest";
import { isTeamAdmin } from "@calcom/features/ee/teams/lib/queries";
import { isOrganisationAdmin } from "@calcom/lib/server/queries/organisations";
import { isTeamAdmin } from "@calcom/lib/server/queries/teams";
import { MembershipRole } from "@calcom/prisma/enums";
import { TRPCError } from "@trpc/server";
@@ -25,7 +25,7 @@ vi.mock("@calcom/prisma", () => {
};
});
vi.mock("@calcom/lib/server/queries/teams", () => {
vi.mock("@calcom/features/ee/teams/lib/queries", () => {
return {
isTeamAdmin: vi.fn(),
};
@@ -11,8 +11,8 @@ import logger from "@calcom/lib/logger";
import { safeStringify } from "@calcom/lib/safeStringify";
import { getTranslation } from "@calcom/lib/server/i18n";
import { isOrganisationAdmin } from "@calcom/lib/server/queries/organisations";
import { updateNewTeamMemberEventTypes } from "@calcom/lib/server/queries/teams";
import { isTeamAdmin } from "@calcom/lib/server/queries/teams";
import { updateNewTeamMemberEventTypes } from "@calcom/features/ee/teams/lib/queries";
import { isTeamAdmin } from "@calcom/features/ee/teams/lib/queries";
import { ProfileRepository } from "@calcom/lib/server/repository/profile";
import { getParsedTeam } from "@calcom/lib/server/repository/teamUtils";
import { UserRepository } from "@calcom/lib/server/repository/user";
@@ -2,7 +2,7 @@ import { purchaseTeamOrOrgSubscription } from "@calcom/features/ee/teams/lib/pay
import { IS_TEAM_BILLING_ENABLED, WEBAPP_URL } from "@calcom/lib/constants";
import { Redirect } from "@calcom/lib/redirect";
import { isOrganisationAdmin } from "@calcom/lib/server/queries/organisations";
import { isTeamAdmin } from "@calcom/lib/server/queries/teams";
import { isTeamAdmin } from "@calcom/features/ee/teams/lib/queries";
import { TeamService } from "@calcom/lib/server/service/teamService";
import { teamMetadataSchema } from "@calcom/prisma/zod-utils";
@@ -1,4 +1,4 @@
import { isTeamAdmin, isTeamOwner } from "@calcom/lib/server/queries/teams";
import { isTeamAdmin, isTeamOwner } from "@calcom/features/ee/teams/lib/queries";
import prisma from "@calcom/prisma";
import { TRPCError } from "@trpc/server";
@@ -2,7 +2,7 @@ import { FeaturesRepository } from "@calcom/features/flags/features.repository";
import { Resource, CustomAction } from "@calcom/features/pbac/domain/types/permission-registry";
import { getSpecificPermissions } from "@calcom/features/pbac/lib/resource-permissions";
import { checkRateLimitAndThrowError } from "@calcom/lib/checkRateLimitAndThrowError";
import { isTeamOwner } from "@calcom/lib/server/queries/teams";
import { isTeamOwner } from "@calcom/features/ee/teams/lib/queries";
import { TeamService } from "@calcom/lib/server/service/teamService";
import { prisma } from "@calcom/prisma";
import { MembershipRole } from "@calcom/prisma/enums";
@@ -1,4 +1,4 @@
import { isTeamAdmin } from "@calcom/lib/server/queries/teams";
import { isTeamAdmin } from "@calcom/features/ee/teams/lib/queries";
import { prisma } from "@calcom/prisma";
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
@@ -3,7 +3,7 @@ import { IS_TEAM_BILLING_ENABLED } from "@calcom/lib/constants";
import type { IntervalLimit } from "@calcom/lib/intervalLimits/intervalLimitSchema";
import { validateIntervalLimitOrder } from "@calcom/lib/intervalLimits/validateIntervalLimitOrder";
import { uploadLogo } from "@calcom/lib/server/avatar";
import { isTeamAdmin } from "@calcom/lib/server/queries/teams";
import { isTeamAdmin } from "@calcom/features/ee/teams/lib/queries";
import { prisma } from "@calcom/prisma";
import type { Prisma } from "@calcom/prisma/client";
import { RedirectType, RRTimestampBasis } from "@calcom/prisma/enums";
@@ -1,4 +1,4 @@
import { isTeamAdmin } from "@calcom/lib/server/queries/teams";
import { isTeamAdmin } from "@calcom/features/ee/teams/lib/queries";
import { prisma } from "@calcom/prisma";
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
+2 -2
View File
@@ -1,9 +1,9 @@
import { beforeEach, vi } from "vitest";
import { mockReset, mockDeep } from "vitest-mock-extended";
import type * as CalendarManager from "@calcom/lib/CalendarManager";
import type * as CalendarManager from "@calcom/features/calendars/lib/CalendarManager";
vi.mock("@calcom/lib/CalendarManager", () => CalendarManagerMock);
vi.mock("@calcom/features/calendars/lib/CalendarManager", () => CalendarManagerMock);
beforeEach(() => {
mockReset(CalendarManagerMock);