chore: Upgrade prisma to 6.7.0 (#21264)
* chore: Upgrade prisma to 6.7.0 * Build fixes * type fixes Signed-off-by: Omar López <[email protected]> * Update schema.prisma * Patching * Revert "Update schema.prisma" This reverts commit 47d8618bf89ef4d007b30084df766f17281e21a1. * Revert "Patching" This reverts commit a1d2e3040e71690a44d4324db95d73b4d68c6adb. * Revert schema changes Signed-off-by: Omar López <[email protected]> * WIP Signed-off-by: Omar López <[email protected]> * Update getPublicEvent.ts * Update imports Signed-off-by: Omar López <[email protected]> * Update gitignore Signed-off-by: Omar López <[email protected]> * update remaining imports Signed-off-by: Omar López <[email protected]> * Delete .cursor/config.json * Discard changes to packages/features/eventtypes/lib/getPublicEvent.ts * Update _get.ts * Update user.ts * Update .gitignore * update * Update WorkflowStepContainer.tsx * Update next-auth-custom-adapter.ts * Update getPublicEvent.ts * Update workflow.ts * Update next-auth-custom-adapter.ts * Update next-auth-options.ts * Update bookingScenario.ts * fix missing imports * upgrades prismock Signed-off-by: Omar López <[email protected]> * patches prismock Signed-off-by: Omar López <[email protected]> * Update reschedule.test.ts * Update prisma.ts * patch prismock Signed-off-by: Omar López <[email protected]> * fix enums imports Signed-off-by: Omar López <[email protected]> * Revert "Update prisma.ts" This reverts commit 64edcf8db54171ff4456c209d563b5d431d99619. * Revert "patch prismock" This reverts commit e95819113dc9d88e7130947aa120cd42710977c8. * fix patch * Fix test that overrun the boundary, it shouldn't test too much * Move prisma import to changeSMSLockState * Bring back broken test without illegal imports * Merge with main and fix filter hosts by same round robin host * Fixed buildDryRunBooking fn tests * Fix and move ooo create or update handler test * Fix packages/features/eventtypes/lib/isCurrentlyAvailable.test.ts * Fix packages/trpc/server/routers/viewer/organizations/listMembers.handler.test.ts * Mock @calcom/prisma * Fix: verify-email.test.ts * fix: Moved WebhookService test and fixed default import mock * Fix: Added missing prisma mock, handleNewBooking uses that of course * We're not testing createContext here * fix: Prisma mock fix for listMembers.test.ts * More fixes to broken testcases * Forgot to remove borked test * Prevent the need to mock a lot of dependencies by moving out buildBaseWhereCondition to its own file * Temporarily skip getCalendarEvents, needs a rewrite * Fix: turns out you can access protected in testcases * fix further mocks * Added packages/features/insights/server/buildBaseWhereCondition.ts, types * Always great to have a mock and then not use it * And one less again. * fix: confirm.handler.test, didn't mock prisma * fix: Address minor nit by @eunjae & fix ImpersonationProvider test * Updated isPrismaAvailableCheck that doesn't crash on import * fix: Get Prisma directly from the client, it usually involves the Validator and does not need 'local' inclusion * Add zod-prisma-types without the generator enabled (commented out) * Uncomment and see what happens * Change method of import as imports did not work in Input Schemas * Remove custom 'zod' booking model, it does not belong with Prisma * Fix all other global Model imports * Rewrite most schema includes AND remove barrel file * Add bookingCreateBodySchema to features/bookings * Flurry of type fixes for compatibility with new zod gen * Refactor out the custom prisma type createEventTypeInput * Work around nullable eventTypeLocations * HandlePayment type fix * More fixes, final fix remaining is CompleteEventType * Should fix a bunch more booking related type errors * Missed one * Some props missing from BookingCreateBodySchema * Fix location type in handleChildrenEventTypes * Little bit hacky imo but it works * Final type error \o/ * Forgot to include Prisma * Do not include zod-utils in booker/types * Oops, was already including Booker/types * Fix membership type, also disallow updating createdAt/updatedAt, make part of patch/post * Fix api v1 type errors * Fix EventTypeDescription typings * Remove getParserWithGeneric, use userBodySchema with UserSchema * use centralized timeZoneSchema * Implement feedback by @zomars * Couple of WIP pushes * Fix tests * Type fixes in `handleChildrenEventTypes` test * Try and parse metadata before use * Change zod-prisma-types configuration for optimal performance * Fix prisma validator error in `prisma/selects/credential` * Disable seperate relations model, hits a bug * Import absolute - this makes rollup work in @platform/libraries * Attempt at removing resolutions override * Refactor using `Prisma.validator` to `satisfies` * Build atoms using @calcom/prisma/client * Build atoms using @calcom/prisma/client * fixes * Update eventTypeSelect.ts * Adjust `eventTypeMetaDataSchemaWithUntypedApps` from `unknown` to `record(any)` * `EventTypeDescription` rely on `descriptionAsSafeHTML` instead of `description` * Add `seatsPerTimeSlot` to event type public select * Fix typing in `users-public-view` getServerSide props * Add missing `schedulingType` to prop * chore: bump platform libraries * Function return type is illegal, not sure how this passed eslint (#21567) * Merged with main * Update updateTokenObject.ts * Update handleResponse.ts * Update index.ts * Update handleChildrenEventTypes.ts * Update booking-idempotency-key.ts * Update WebhookService.test.ts * Update events.test.ts * Update queued-response.test.ts * Update events.test.ts * Update getRoutedUrl.test.ts * fix: type checks Signed-off-by: Omar López <[email protected]> * fixes Signed-off-by: Omar López <[email protected]> * chore: bump platform libraries * Update yarn.lock * more fixes Signed-off-by: Omar López <[email protected]> * fixes Signed-off-by: Omar López <[email protected]> * biuld fixes * chore: bump platform libraries * Update conferencing.repository.ts * Update conferencing.repository.ts * Update getCalendarsEvents.test.ts * Update vite.config.js * chore: bump platform libraries * Update users.ts * Discard changes to docs/api-reference/v2/openapi.json * Update vite.config.ts * updated platform libraries * Update get.handler.test.ts * Update get.handler.test.ts * Update schema.prisma * Discard changes to docs/api-reference/v2/openapi.json * Update next-auth-custom-adapter.ts * Update team.ts * Flurry of type fixes * Fix majority of insight related type errors * Type fixes for unlink of account * Make user nullable again * Fixed a bunch of unit tests and one type error * Attempted mock fix * Attempted fix for Attribute type * Ensure default import becomes prisma, but not direct usage * Import default as prisma in prisma.module * Add attributeOption to attribute type * Fix calcom/prisma mock * Refactor Prisma client imports to @calcom/prisma/client Updated all imports from '@prisma/client' to '@calcom/prisma/client' across tests and repository files for consistency and to use the correct Prisma client package. This change improves maintainability and ensures the correct client is referenced throughout the codebase. * Undo removal of max-warnings=0 to get main to merge * Remove unit tests for e2e fixtures, provide new prisma mock * Mock @calcom/prisma in event manager * Mock @calcom/prisma in event manager * Add correct format even with --no-verify * Mock prisma in CalendarManager * Add mock for permission-check.service * Better injection in PrismaApiKeyRepository imports * More mock fixes :) * Fix listMembers.handler.test * Fix User import * Appropriately adjust all types to be imported as types, there were a lot of types imported as normal deps * Why was this a thing? * Strictly speaking; Not using prismock anymore * Ditched patch file for prismock * Fix output.service.ts platform type imports, need concrete for plainToClass * Better typing and tests for unlinkConnectedAccount.handler * Small type fix * Disable calendar cache tests as they are dependent on prismock * chore: bump platform lib * getRoutedUrl test remove of unused import * Extract select to external const on getEventTypesFromDB * Direct select of userSelect from selects/user * fix type error from merging 23653 * Fixed integration tests by removing hardcoded values that were possible due to mocking, but as its now directly hitting the db no longer * fix: vite config atoms prisma client type location * revert: example app prisma client * revert: example app prisma client * bump platform libs * fix: use class instead of type for DI of PlatformBookingsService * update platform libs * remove unused variable * chore: generate prisma client for api v2 * fix: api v2 e2e * fix: atoms e2e * fix: atoms e2e * fix: atoms e2e * fix: api v2 e2e * fix: tsconfig apiv2 enums * publish libraries * Simplify check for existence teamId --------- Signed-off-by: Omar López <[email protected]> Co-authored-by: Alex van Andel <[email protected]> Co-authored-by: Joe Au-Yeung <[email protected]> Co-authored-by: supalarry <[email protected]> Co-authored-by: cal.com <[email protected]> Co-authored-by: Morgan <[email protected]> Co-authored-by: Benny Joo <[email protected]>
This commit is contained in:
623 files changed
+4363
-12559
No files matched your search
@@ -1,8 +1,7 @@
|
||||
import type { Prisma } from "@prisma/client";
|
||||
|
||||
import { enrichUserWithDelegationCredentialsIncludeServiceAccountKey } from "@calcom/lib/delegationCredential/server";
|
||||
import { availabilityUserSelect } from "@calcom/prisma";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import type { Prisma } from "@calcom/prisma/client";
|
||||
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
|
||||
|
||||
import { withSelectedCalendars } from "./withSelectedCalendars";
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import type { Prisma, User } from "@prisma/client";
|
||||
|
||||
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";
|
||||
@@ -13,8 +11,8 @@ import type { BookingRepository } from "@calcom/lib/server/repository/booking";
|
||||
import type { HostRepository } from "@calcom/lib/server/repository/host";
|
||||
import type { PrismaOOORepository } from "@calcom/lib/server/repository/ooo";
|
||||
import type { UserRepository } from "@calcom/lib/server/repository/user";
|
||||
import type { Booking } from "@calcom/prisma/client";
|
||||
import type { SelectedCalendar } from "@calcom/prisma/client";
|
||||
import type { Prisma } from "@calcom/prisma/client";
|
||||
import type { User, Booking, SelectedCalendar } from "@calcom/prisma/client";
|
||||
import type { AttributeType } from "@calcom/prisma/enums";
|
||||
import { RRTimestampBasis, RRResetInterval } from "@calcom/prisma/enums";
|
||||
import type { EventBusyDate } from "@calcom/types/Calendar";
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Prisma } from "@prisma/client";
|
||||
import type { ZodIssue } from "zod";
|
||||
import { ZodError } from "zod";
|
||||
|
||||
import { ErrorCode } from "@calcom/lib/errorCodes";
|
||||
import { ErrorWithCode } from "@calcom/lib/errors";
|
||||
import { Prisma } from "@calcom/prisma/client";
|
||||
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { getHTTPStatusCodeFromError } from "@trpc/server/http";
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
import type { Prisma } from "@prisma/client";
|
||||
import { z } from "zod";
|
||||
|
||||
import { getAppFromSlug } from "@calcom/app-store/utils";
|
||||
import { DATABASE_CHUNK_SIZE } from "@calcom/lib/constants";
|
||||
import { parseBookingLimit } from "@calcom/lib/intervalLimits/isBookingLimits";
|
||||
import logger from "@calcom/lib/logger";
|
||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||
import prisma, { baseEventTypeSelect } from "@calcom/prisma";
|
||||
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 { _EventTypeModel } from "@calcom/prisma/zod";
|
||||
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";
|
||||
@@ -433,13 +436,19 @@ export function generateNewChildEventTypeDataForDB({
|
||||
includeWorkflow = true,
|
||||
includeUserConnect = true,
|
||||
}: {
|
||||
eventType: Prisma.EventTypeGetPayload<{ select: typeof allManagedEventTypeProps & { id: true } }>;
|
||||
eventType: Omit<
|
||||
Prisma.EventTypeGetPayload<{ select: typeof allManagedEventTypeProps & { id: true } }>,
|
||||
"locations"
|
||||
> & { locations: Prisma.JsonValue | null };
|
||||
userId: number;
|
||||
includeWorkflow?: boolean;
|
||||
includeUserConnect?: boolean;
|
||||
}) {
|
||||
const allManagedEventTypePropsZod = _EventTypeModel.pick(allManagedEventTypeProps).extend({
|
||||
bookingFields: _EventTypeModel.shape.bookingFields.nullish(),
|
||||
const allManagedEventTypePropsZod = EventTypeSchema.pick(allManagedEventTypeProps).extend({
|
||||
bookingFields: EventTypeSchema.shape.bookingFields.nullish(),
|
||||
locations: z
|
||||
.preprocess((val: unknown) => (val === null ? undefined : val), eventTypeLocations)
|
||||
.optional(),
|
||||
});
|
||||
|
||||
const managedEventTypeValues = allManagedEventTypePropsZod
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Prisma } from "@prisma/client";
|
||||
|
||||
import prisma from "@calcom/prisma";
|
||||
import { Prisma } from "@calcom/prisma/client";
|
||||
import { MembershipRole } from "@calcom/prisma/enums";
|
||||
|
||||
interface _AgentRawResult {
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
import { generateUniqueAPIKey as generateHashedApiKey } from "@calcom/ee/api-keys/lib/apiKeys";
|
||||
import prisma from "@calcom/prisma";
|
||||
import type { PrismaClient } from "@calcom/prisma";
|
||||
|
||||
export class PrismaApiKeyRepository {
|
||||
static async findApiKeysFromUserId({ userId }: { userId: number }) {
|
||||
const apiKeys = await prisma.apiKey.findMany({
|
||||
constructor(private prismaClient: PrismaClient) {}
|
||||
|
||||
static async withGlobalPrisma() {
|
||||
return new PrismaApiKeyRepository((await import("@calcom/prisma")).prisma);
|
||||
}
|
||||
|
||||
async findApiKeysFromUserId({ userId }: { userId: number }) {
|
||||
const apiKeys = await this.prismaClient.apiKey.findMany({
|
||||
where: {
|
||||
userId,
|
||||
OR: [
|
||||
@@ -29,7 +35,7 @@ export class PrismaApiKeyRepository {
|
||||
});
|
||||
}
|
||||
|
||||
static async createApiKey({
|
||||
async createApiKey({
|
||||
userId,
|
||||
teamId,
|
||||
note,
|
||||
@@ -41,7 +47,7 @@ export class PrismaApiKeyRepository {
|
||||
expiresAt?: Date | null;
|
||||
}) {
|
||||
const [hashedApiKey, apiKey] = generateHashedApiKey();
|
||||
await prisma.apiKey.create({
|
||||
await this.prismaClient.apiKey.create({
|
||||
data: {
|
||||
id: uuidv4(),
|
||||
userId,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { Prisma } from "@prisma/client";
|
||||
|
||||
import prisma from "@calcom/prisma";
|
||||
import type { Prisma } from "@calcom/prisma/client";
|
||||
|
||||
export class PrismaAttributeOptionRepository {
|
||||
static async findMany({ orgId }: { orgId: number }) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { Prisma } from "@prisma/client";
|
||||
|
||||
import prisma from "@calcom/prisma";
|
||||
import type { Prisma } from "@calcom/prisma/client";
|
||||
|
||||
export class PrismaAttributeToUserRepository {
|
||||
static async createManySkipDuplicates(data: Prisma.AttributeToUserCreateManyInput[]) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Prisma } from "@prisma/client";
|
||||
|
||||
import prisma from "@calcom/prisma";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import { Prisma } from "@calcom/prisma/client";
|
||||
import { PhoneNumberSubscriptionStatus } from "@calcom/prisma/enums";
|
||||
|
||||
interface _PhoneNumberRawResult {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { App_RoutingForms_Form, App_RoutingForms_FormResponse } from "@prisma/client";
|
||||
import type { App_RoutingForms_Form, App_RoutingForms_FormResponse } from "@calcom/prisma/client";
|
||||
|
||||
export interface RoutingFormResponseRepositoryInterface {
|
||||
findByIdIncludeForm(
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import prismaMock from "../../../../tests/libs/__mocks__/prismaMock";
|
||||
|
||||
import type { Team } from "@prisma/client";
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
||||
|
||||
import type { Team } from "@calcom/prisma/client";
|
||||
|
||||
import { TeamRepository } from "./team";
|
||||
|
||||
describe("TeamRepository", () => {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { Prisma } from "@prisma/client";
|
||||
|
||||
import { withReporting } from "@calcom/lib/sentryWrapper";
|
||||
import type { PrismaClient } from "@calcom/prisma";
|
||||
import type { Prisma } from "@calcom/prisma/client";
|
||||
import type { Booking } from "@calcom/prisma/client";
|
||||
import { RRTimestampBasis, BookingStatus } from "@calcom/prisma/enums";
|
||||
import { bookingMinimalSelect } from "@calcom/prisma/selects/booking";
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { Prisma } from "@prisma/client";
|
||||
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import type { Prisma } from "@calcom/prisma/client";
|
||||
import type { PartialReference } from "@calcom/types/EventManager";
|
||||
|
||||
const bookingReferenceSelect = {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { Prisma } from "@prisma/client";
|
||||
|
||||
import logger from "@calcom/lib/logger";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import type { Prisma } from "@calcom/prisma/client";
|
||||
import { safeCredentialSelect } from "@calcom/prisma/selects/credential";
|
||||
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import type { Prisma } from "@prisma/client";
|
||||
|
||||
import logger from "@calcom/lib/logger";
|
||||
import {
|
||||
serviceAccountKeySchema,
|
||||
@@ -9,6 +7,7 @@ import {
|
||||
decryptServiceAccountKey,
|
||||
} from "@calcom/lib/server/serviceAccountKey";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import type { Prisma } from "@calcom/prisma/client";
|
||||
|
||||
import { OrganizationRepository } from "./organization";
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { PrismaClient as PrismaClientWithoutExtensions } from "@prisma/client";
|
||||
|
||||
import type { PrismaClient as PrismaClientWithExtensions } from "@calcom/prisma";
|
||||
import type { PrismaClient as PrismaClientWithoutExtensions } from "@calcom/prisma/client";
|
||||
|
||||
import type { IDeploymentRepository } from "./deployment.interface";
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { Prisma } from "@prisma/client";
|
||||
|
||||
import logger from "@calcom/lib/logger";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import type { Prisma } from "@calcom/prisma/client";
|
||||
|
||||
import { buildCredentialPayloadForPrisma } from "../buildCredentialPayloadForCalendar";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { SelectedSlots } from "@prisma/client";
|
||||
import type { SelectedSlots } from "@calcom/prisma/client";
|
||||
|
||||
export type SelectedSlot = Pick<
|
||||
SelectedSlots,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Prisma } from "@prisma/client";
|
||||
import type { Prisma } from "@calcom/prisma/client";
|
||||
|
||||
type EnforceTrueOrNested<T> = {
|
||||
[K in keyof T]: T[K] extends object ? EnforceTrueOrNested<T[K]> : true; // only allow `true` at leaves
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import type { EventType as PrismaEventType } from "@prisma/client";
|
||||
|
||||
import logger from "@calcom/lib/logger";
|
||||
import type { PrismaClient } from "@calcom/prisma";
|
||||
import { prisma, availabilityUserSelect } from "@calcom/prisma";
|
||||
import type { EventType as PrismaEventType } from "@calcom/prisma/client";
|
||||
import type { Prisma } from "@calcom/prisma/client";
|
||||
import { MembershipRole } from "@calcom/prisma/enums";
|
||||
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
import { availabilityUserSelect, prisma, type PrismaTransaction } from "@calcom/prisma";
|
||||
import { MembershipRole } from "@calcom/prisma/enums";
|
||||
import type { Prisma, Membership, PrismaClient } from "@calcom/prisma/client";
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { User as PrismaUser } from "@prisma/client";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
import { whereClauseForOrgWithSlugOrRequestedSlug } from "@calcom/ee/organizations/lib/orgDomains";
|
||||
@@ -6,6 +5,7 @@ import { getOrgUsernameFromEmail } from "@calcom/features/auth/signup/utils/getO
|
||||
import { DATABASE_CHUNK_SIZE } from "@calcom/lib/constants";
|
||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||
import prisma from "@calcom/prisma";
|
||||
import type { User as PrismaUser } from "@calcom/prisma/client";
|
||||
import type { Prisma } from "@calcom/prisma/client";
|
||||
import type { Team } from "@calcom/prisma/client";
|
||||
import { userMetadata } from "@calcom/prisma/zod-utils";
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { Prisma } from "@prisma/client";
|
||||
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import type { Prisma } from "@calcom/prisma/client";
|
||||
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
|
||||
import type { SelectedCalendarEventTypeIds } from "@calcom/types/Calendar";
|
||||
|
||||
@@ -257,7 +256,12 @@ export class SelectedCalendarRepository {
|
||||
}
|
||||
|
||||
static async findMany({ where, select, orderBy }: FindManyArgs) {
|
||||
return await prisma.selectedCalendar.findMany({ where, select, orderBy });
|
||||
const args = {
|
||||
where,
|
||||
select,
|
||||
orderBy,
|
||||
} satisfies Prisma.SelectedCalendarFindManyArgs;
|
||||
return await prisma.selectedCalendar.findMany(args);
|
||||
}
|
||||
|
||||
static async findUniqueOrThrow({ where }: { where: Prisma.SelectedCalendarWhereInput }) {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { Prisma } from "@prisma/client";
|
||||
import type { z } from "zod";
|
||||
|
||||
import { whereClauseForOrgWithSlugOrRequestedSlug } from "@calcom/ee/organizations/lib/orgDomains";
|
||||
import logger from "@calcom/lib/logger";
|
||||
import type { PrismaClient } from "@calcom/prisma";
|
||||
import prisma from "@calcom/prisma";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import type { Prisma } from "@calcom/prisma/client";
|
||||
import { MembershipRole } from "@calcom/prisma/enums";
|
||||
import { teamMetadataSchema } from "@calcom/prisma/zod-utils";
|
||||
|
||||
|
||||
@@ -4,9 +4,10 @@ import { whereClauseForOrgWithSlugOrRequestedSlug } from "@calcom/ee/organizatio
|
||||
import logger from "@calcom/lib/logger";
|
||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||
import { getTranslation } from "@calcom/lib/server/i18n";
|
||||
import { availabilityUserSelect } from "@calcom/prisma";
|
||||
import type { PrismaClient } from "@calcom/prisma";
|
||||
import type { Prisma, User as UserType } from "@calcom/prisma/client";
|
||||
import { availabilityUserSelect } from "@calcom/prisma";
|
||||
import type { User as UserType } from "@calcom/prisma/client";
|
||||
import type { Prisma } from "@calcom/prisma/client";
|
||||
import type { CreationSource } from "@calcom/prisma/enums";
|
||||
import { MembershipRole, BookingStatus } from "@calcom/prisma/enums";
|
||||
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { Workflow } from "@prisma/client";
|
||||
|
||||
import type { Workflow } from "@calcom/prisma/client";
|
||||
import { isAuthorized } from "@calcom/trpc/server/routers/viewer/workflows/util";
|
||||
|
||||
export interface WorkflowPermissions {
|
||||
|
||||
@@ -8,8 +8,8 @@ import type { WorkflowStep } from "@calcom/ee/workflows/lib/types";
|
||||
import { hasFilter } from "@calcom/features/filters/lib/hasFilter";
|
||||
import { HttpError } from "@calcom/lib/http-error";
|
||||
import prisma from "@calcom/prisma";
|
||||
import { MembershipRole } from "@calcom/prisma/enums";
|
||||
import type { Prisma } from "@calcom/prisma/client";
|
||||
import { MembershipRole } from "@calcom/prisma/enums";
|
||||
import { WorkflowMethods } from "@calcom/prisma/enums";
|
||||
import type { TFilteredListInputSchema } from "@calcom/trpc/server/routers/viewer/workflows/filteredList.schema";
|
||||
import type { TGetVerifiedEmailsInputSchema } from "@calcom/trpc/server/routers/viewer/workflows/getVerifiedEmails.schema";
|
||||
@@ -25,47 +25,45 @@ export type TGetInputSchema = z.infer<typeof ZGetInputSchema>;
|
||||
|
||||
const deleteScheduledWhatsappReminder = deleteScheduledSMSReminder;
|
||||
|
||||
const { include: includedFields } = {
|
||||
include: {
|
||||
activeOn: {
|
||||
select: {
|
||||
eventType: {
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
parentId: true,
|
||||
_count: {
|
||||
select: {
|
||||
children: true,
|
||||
},
|
||||
const includedFields = {
|
||||
activeOn: {
|
||||
select: {
|
||||
eventType: {
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
parentId: true,
|
||||
_count: {
|
||||
select: {
|
||||
children: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
activeOnTeams: {
|
||||
select: {
|
||||
team: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
activeOnTeams: {
|
||||
select: {
|
||||
team: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
steps: true,
|
||||
team: {
|
||||
select: {
|
||||
id: true,
|
||||
slug: true,
|
||||
name: true,
|
||||
members: true,
|
||||
logoUrl: true,
|
||||
isOrganization: true,
|
||||
},
|
||||
},
|
||||
steps: true,
|
||||
team: {
|
||||
select: {
|
||||
id: true,
|
||||
slug: true,
|
||||
name: true,
|
||||
members: true,
|
||||
logoUrl: true,
|
||||
isOrganization: true,
|
||||
},
|
||||
},
|
||||
} satisfies Prisma.WorkflowDefaultArgs;
|
||||
} satisfies Prisma.WorkflowInclude;
|
||||
|
||||
export class WorkflowRepository {
|
||||
private static log = logger.getSubLogger({ prefix: ["workflow"] });
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Prisma } from "@prisma/client";
|
||||
import md5 from "md5";
|
||||
import { z } from "zod";
|
||||
|
||||
@@ -13,6 +12,7 @@ import {
|
||||
isNumberFilterValue,
|
||||
} from "@calcom/features/data-table/lib/utils";
|
||||
import type { DateRange } from "@calcom/features/insights/server/insightsDateUtils";
|
||||
import { Prisma } from "@calcom/prisma/client";
|
||||
import type { PrismaClient } from "@calcom/prisma";
|
||||
import { MembershipRole } from "@calcom/prisma/enums";
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Prisma } from "@prisma/client";
|
||||
import { z } from "zod";
|
||||
|
||||
import dayjs from "@calcom/dayjs";
|
||||
@@ -13,6 +12,7 @@ import {
|
||||
} from "@calcom/features/data-table/lib/utils";
|
||||
import type { DateRange } from "@calcom/features/insights/server/insightsDateUtils";
|
||||
import type { PrismaClient } from "@calcom/prisma";
|
||||
import { Prisma } from "@calcom/prisma/client";
|
||||
import type { BookingStatus } from "@calcom/prisma/enums";
|
||||
import { MembershipRole } from "@calcom/prisma/enums";
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { Team, User, Membership } from "@prisma/client";
|
||||
import { Prisma } from "@prisma/client";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { ColumnFilterType } from "@calcom/features/data-table/lib/types";
|
||||
import prisma from "@calcom/prisma";
|
||||
import type { Team, User, Membership } from "@calcom/prisma/client";
|
||||
import { Prisma } from "@calcom/prisma/client";
|
||||
import { BookingStatus, MembershipRole } from "@calcom/prisma/enums";
|
||||
|
||||
import { InsightsBookingBaseService as InsightsBookingService } from "../InsightsBookingBaseService";
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { Team, User, Membership } from "@prisma/client";
|
||||
import { Prisma } from "@prisma/client";
|
||||
import { randomUUID } from "crypto";
|
||||
import { v4 as uuid } from "uuid";
|
||||
import { describe, expect, it, vi, beforeAll, afterAll } from "vitest";
|
||||
|
||||
import { ColumnFilterType } from "@calcom/features/data-table/lib/types";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import type { Team, User, Membership } from "@calcom/prisma/client";
|
||||
import { Prisma } from "@calcom/prisma/client";
|
||||
import { BookingStatus, MembershipRole } from "@calcom/prisma/enums";
|
||||
|
||||
import { InsightsRoutingBaseService as InsightsRoutingService } from "../../service/InsightsRoutingBaseService";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Team, User } from "@prisma/client";
|
||||
import { describe, expect, it, vi, beforeEach, afterEach } from "vitest";
|
||||
|
||||
import prisma from "@calcom/prisma";
|
||||
import type { Team, User } from "@calcom/prisma/client";
|
||||
import { MembershipRole } from "@calcom/prisma/enums";
|
||||
|
||||
import { TeamService } from "../teamService";
|
||||
@@ -209,15 +209,15 @@ describe("TeamService.removeMembers Integration Tests", () => {
|
||||
// Create organization structure
|
||||
const orgTeam = await createTestTeam({ isOrganization: true });
|
||||
const subTeam = await createTestTeam({ parentId: orgTeam.id });
|
||||
|
||||
|
||||
// Create users
|
||||
const orgUser1 = await createTestUser({ organizationId: orgTeam.id });
|
||||
const orgUser2 = await createTestUser({ organizationId: orgTeam.id });
|
||||
const nonOrgUser = await createTestUser();
|
||||
|
||||
|
||||
// Create regular team
|
||||
const regularTeamEntity = await createTestTeam();
|
||||
|
||||
|
||||
// Set up memberships
|
||||
await createTestMembership(orgUser1.id, orgTeam.id);
|
||||
await createTestMembership(orgUser2.id, orgTeam.id);
|
||||
@@ -227,36 +227,35 @@ describe("TeamService.removeMembers Integration Tests", () => {
|
||||
await createTestMembership(orgUser2.id, subTeam.id);
|
||||
await createTestMembership(nonOrgUser.id, regularTeamEntity.id);
|
||||
await createTestMembership(nonOrgUser.id, subTeam.id);
|
||||
|
||||
|
||||
// Structure the test data
|
||||
orgTestData = {
|
||||
team: orgTeam,
|
||||
teams: [{
|
||||
team: subTeam,
|
||||
members: [orgUser1, orgUser2]
|
||||
}],
|
||||
members: [orgUser1, orgUser2]
|
||||
teams: [
|
||||
{
|
||||
team: subTeam,
|
||||
members: [orgUser1, orgUser2],
|
||||
},
|
||||
],
|
||||
members: [orgUser1, orgUser2],
|
||||
};
|
||||
|
||||
|
||||
regularTeamTestData = {
|
||||
team: regularTeamEntity,
|
||||
members: [orgUser1, orgUser2, nonOrgUser]
|
||||
members: [orgUser1, orgUser2, nonOrgUser],
|
||||
};
|
||||
|
||||
|
||||
userWithoutOrg = nonOrgUser;
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
const teamIds = [
|
||||
orgTestData.team.id,
|
||||
...orgTestData.teams.map(t => t.team.id),
|
||||
regularTeamTestData.team.id
|
||||
...orgTestData.teams.map((t) => t.team.id),
|
||||
regularTeamTestData.team.id,
|
||||
];
|
||||
const userIds = [
|
||||
...orgTestData.members.map(u => u.id),
|
||||
userWithoutOrg.id
|
||||
];
|
||||
|
||||
const userIds = [...orgTestData.members.map((u) => u.id), userWithoutOrg.id];
|
||||
|
||||
await cleanupTestData(teamIds, userIds);
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
@@ -264,10 +263,10 @@ describe("TeamService.removeMembers Integration Tests", () => {
|
||||
describe("Team Removal - Sub-Team/Regular Team", () => {
|
||||
it("should remove members from a single team", async () => {
|
||||
const [orgUser1, orgUser2] = orgTestData.members;
|
||||
|
||||
await TeamService.removeMembers({
|
||||
teamIds: [regularTeamTestData.team.id],
|
||||
userIds: [orgUser1.id, orgUser2.id]
|
||||
|
||||
await TeamService.removeMembers({
|
||||
teamIds: [regularTeamTestData.team.id],
|
||||
userIds: [orgUser1.id, orgUser2.id],
|
||||
});
|
||||
|
||||
await expectMembershipNotExists(orgUser1.id, regularTeamTestData.team.id);
|
||||
@@ -283,10 +282,10 @@ describe("TeamService.removeMembers Integration Tests", () => {
|
||||
it("should remove members from multiple teams", async () => {
|
||||
const [orgUser1] = orgTestData.members;
|
||||
const subTeam = orgTestData.teams[0].team;
|
||||
|
||||
await TeamService.removeMembers({
|
||||
teamIds: [regularTeamTestData.team.id, subTeam.id],
|
||||
userIds: [orgUser1.id]
|
||||
|
||||
await TeamService.removeMembers({
|
||||
teamIds: [regularTeamTestData.team.id, subTeam.id],
|
||||
userIds: [orgUser1.id],
|
||||
});
|
||||
|
||||
await expectMembershipNotExists(orgUser1.id, regularTeamTestData.team.id);
|
||||
@@ -337,7 +336,11 @@ describe("TeamService.removeMembers Integration Tests", () => {
|
||||
expect(hostsBefore).toHaveLength(3);
|
||||
|
||||
// Remove member from team (not org)
|
||||
await TeamService.removeMembers({ teamIds: [regularTeamTestData.team.id], userIds: [teamMember.id], isOrg: false });
|
||||
await TeamService.removeMembers({
|
||||
teamIds: [regularTeamTestData.team.id],
|
||||
userIds: [teamMember.id],
|
||||
isOrg: false,
|
||||
});
|
||||
|
||||
// Verify hosts for team events were removed
|
||||
const hostsAfterForTeamEvents = await prisma.host.findMany({
|
||||
@@ -410,7 +413,11 @@ describe("TeamService.removeMembers Integration Tests", () => {
|
||||
});
|
||||
|
||||
// Remove orgTestData.members[0] from team
|
||||
await TeamService.removeMembers({ teamIds: [regularTeamTestData.team.id], userIds: [orgTestData.members[0].id], isOrg: false });
|
||||
await TeamService.removeMembers({
|
||||
teamIds: [regularTeamTestData.team.id],
|
||||
userIds: [orgTestData.members[0].id],
|
||||
isOrg: false,
|
||||
});
|
||||
|
||||
// Verify orgTestData.members[0]'s managed event types were deleted
|
||||
const deletedEventType1 = await prisma.eventType.findUnique({
|
||||
@@ -447,7 +454,11 @@ describe("TeamService.removeMembers Integration Tests", () => {
|
||||
});
|
||||
|
||||
it("should not modify user organization data when removing from sub-team", async () => {
|
||||
await TeamService.removeMembers({ teamIds: [regularTeamTestData.team.id], userIds: [orgTestData.members[0].id], isOrg: false });
|
||||
await TeamService.removeMembers({
|
||||
teamIds: [regularTeamTestData.team.id],
|
||||
userIds: [orgTestData.members[0].id],
|
||||
isOrg: false,
|
||||
});
|
||||
|
||||
await expectMembershipNotExists(orgTestData.members[0].id, regularTeamTestData.team.id);
|
||||
|
||||
@@ -464,7 +475,11 @@ describe("TeamService.removeMembers Integration Tests", () => {
|
||||
it("should remove members from organization and all sub-teams", async () => {
|
||||
const originalUsername = orgTestData.members[0].username || "";
|
||||
|
||||
await TeamService.removeMembers({ teamIds: [orgTestData.team.id], userIds: [orgTestData.members[0].id], isOrg: true });
|
||||
await TeamService.removeMembers({
|
||||
teamIds: [orgTestData.team.id],
|
||||
userIds: [orgTestData.members[0].id],
|
||||
isOrg: true,
|
||||
});
|
||||
|
||||
await expectMembershipNotExists(orgTestData.members[0].id, orgTestData.team.id);
|
||||
await expectMembershipExists(orgTestData.members[0].id, regularTeamTestData.team.id);
|
||||
@@ -493,7 +508,11 @@ describe("TeamService.removeMembers Integration Tests", () => {
|
||||
const eventType = await createTestEventType(orgTestData.teams[0].team.id);
|
||||
await createTestHost(orgTestData.members[0].id, eventType.id);
|
||||
|
||||
await TeamService.removeMembers({ teamIds: [orgTestData.team.id], userIds: [orgTestData.members[0].id], isOrg: true });
|
||||
await TeamService.removeMembers({
|
||||
teamIds: [orgTestData.team.id],
|
||||
userIds: [orgTestData.members[0].id],
|
||||
isOrg: true,
|
||||
});
|
||||
|
||||
const hosts = await prisma.host.findMany({
|
||||
where: {
|
||||
@@ -522,7 +541,11 @@ describe("TeamService.removeMembers Integration Tests", () => {
|
||||
organizationId: null,
|
||||
});
|
||||
|
||||
await TeamService.removeMembers({ teamIds: [orgTestData.team.id], userIds: [userInOrg.id], isOrg: true });
|
||||
await TeamService.removeMembers({
|
||||
teamIds: [orgTestData.team.id],
|
||||
userIds: [userInOrg.id],
|
||||
isOrg: true,
|
||||
});
|
||||
|
||||
const updatedUser = await prisma.user.findUnique({
|
||||
where: { id: userInOrg.id },
|
||||
@@ -573,7 +596,11 @@ describe("TeamService.removeMembers Integration Tests", () => {
|
||||
},
|
||||
});
|
||||
|
||||
await TeamService.removeMembers({ teamIds: [orgTestData.team.id], userIds: [profileUser.id], isOrg: true });
|
||||
await TeamService.removeMembers({
|
||||
teamIds: [orgTestData.team.id],
|
||||
userIds: [profileUser.id],
|
||||
isOrg: true,
|
||||
});
|
||||
|
||||
const deletedProfile = await prisma.profile.findUnique({
|
||||
where: { id: profile.id },
|
||||
@@ -588,7 +615,11 @@ describe("TeamService.removeMembers Integration Tests", () => {
|
||||
await createTestMembership(userWithoutProfile.id, orgTestData.team.id);
|
||||
|
||||
await expect(
|
||||
TeamService.removeMembers({ teamIds: [orgTestData.team.id], userIds: [userWithoutProfile.id], isOrg: true })
|
||||
TeamService.removeMembers({
|
||||
teamIds: [orgTestData.team.id],
|
||||
userIds: [userWithoutProfile.id],
|
||||
isOrg: true,
|
||||
})
|
||||
).resolves.not.toThrow();
|
||||
|
||||
await expectMembershipNotExists(userWithoutProfile.id, orgTestData.team.id);
|
||||
@@ -623,7 +654,11 @@ describe("TeamService.removeMembers Integration Tests", () => {
|
||||
},
|
||||
});
|
||||
|
||||
await TeamService.removeMembers({ teamIds: [orgTestData.team.id], userIds: [userWithProfile.id], isOrg: true });
|
||||
await TeamService.removeMembers({
|
||||
teamIds: [orgTestData.team.id],
|
||||
userIds: [userWithProfile.id],
|
||||
isOrg: true,
|
||||
});
|
||||
|
||||
const redirects = await prisma.tempOrgRedirect.findMany({
|
||||
where: { from: userWithProfile.username || "" },
|
||||
@@ -653,7 +688,11 @@ describe("TeamService.removeMembers Integration Tests", () => {
|
||||
},
|
||||
});
|
||||
|
||||
await TeamService.removeMembers({ teamIds: [orgTestData.team.id], userIds: [userWithUsername.id], isOrg: true });
|
||||
await TeamService.removeMembers({
|
||||
teamIds: [orgTestData.team.id],
|
||||
userIds: [userWithUsername.id],
|
||||
isOrg: true,
|
||||
});
|
||||
|
||||
const updatedUser = await prisma.user.findUnique({
|
||||
where: { id: userWithUsername.id },
|
||||
@@ -863,7 +902,11 @@ describe("TeamService.removeMembers Integration Tests", () => {
|
||||
expect(eventsBeforeRemoval).toHaveLength(3);
|
||||
|
||||
// Remove orgTestData.members[0] from organization
|
||||
await TeamService.removeMembers({ teamIds: [orgTestData.team.id], userIds: [orgTestData.members[0].id], isOrg: true });
|
||||
await TeamService.removeMembers({
|
||||
teamIds: [orgTestData.team.id],
|
||||
userIds: [orgTestData.members[0].id],
|
||||
isOrg: true,
|
||||
});
|
||||
|
||||
// Verify orgTestData.members[0]'s managed events in all sub-teams were deleted
|
||||
const deletedEvent1 = await prisma.eventType.findUnique({
|
||||
@@ -912,7 +955,10 @@ describe("TeamService.removeMembers Integration Tests", () => {
|
||||
it("should call TeamBilling.updateQuantity for each team", async () => {
|
||||
const { TeamBilling } = await import("@calcom/features/ee/billing/teams");
|
||||
|
||||
await TeamService.removeMembers({ teamIds: [regularTeamTestData.team.id], userIds: [orgTestData.members[0].id, orgTestData.members[1].id] });
|
||||
await TeamService.removeMembers({
|
||||
teamIds: [regularTeamTestData.team.id],
|
||||
userIds: [orgTestData.members[0].id, orgTestData.members[1].id],
|
||||
});
|
||||
|
||||
expect(TeamBilling.findAndInitMany).toHaveBeenCalledWith([regularTeamTestData.team.id]);
|
||||
const mockInstances = await TeamBilling.findAndInitMany([regularTeamTestData.team.id]);
|
||||
@@ -928,16 +974,26 @@ describe("TeamService.removeMembers Integration Tests", () => {
|
||||
});
|
||||
|
||||
it("should gracefully skip when given empty arrays", async () => {
|
||||
await expect(TeamService.removeMembers({ teamIds: [], userIds: [orgTestData.members[0].id] })).resolves.not.toThrow();
|
||||
await expect(TeamService.removeMembers({ teamIds: [regularTeamTestData.team.id], userIds: [] })).resolves.not.toThrow();
|
||||
await expect(
|
||||
TeamService.removeMembers({ teamIds: [], userIds: [orgTestData.members[0].id] })
|
||||
).resolves.not.toThrow();
|
||||
await expect(
|
||||
TeamService.removeMembers({ teamIds: [regularTeamTestData.team.id], userIds: [] })
|
||||
).resolves.not.toThrow();
|
||||
await expect(TeamService.removeMembers({ teamIds: [], userIds: [] })).resolves.not.toThrow();
|
||||
});
|
||||
|
||||
it("should throw error on second removal attempt of same member", async () => {
|
||||
await TeamService.removeMembers({ teamIds: [regularTeamTestData.team.id], userIds: [orgTestData.members[0].id] });
|
||||
await TeamService.removeMembers({
|
||||
teamIds: [regularTeamTestData.team.id],
|
||||
userIds: [orgTestData.members[0].id],
|
||||
});
|
||||
|
||||
await expect(
|
||||
TeamService.removeMembers({ teamIds: [regularTeamTestData.team.id], userIds: [orgTestData.members[0].id] })
|
||||
TeamService.removeMembers({
|
||||
teamIds: [regularTeamTestData.team.id],
|
||||
userIds: [orgTestData.members[0].id],
|
||||
})
|
||||
).rejects.toThrow("Membership not found");
|
||||
});
|
||||
|
||||
@@ -978,7 +1034,11 @@ describe("TeamService.removeMembers Integration Tests", () => {
|
||||
|
||||
// This should fail because of username unique constraint violation
|
||||
await expect(
|
||||
TeamService.removeMembers({ teamIds: [orgTestData.team.id], userIds: [rollbackTestUser.id], isOrg: true })
|
||||
TeamService.removeMembers({
|
||||
teamIds: [orgTestData.team.id],
|
||||
userIds: [rollbackTestUser.id],
|
||||
isOrg: true,
|
||||
})
|
||||
).rejects.toThrow();
|
||||
|
||||
// Verify nothing was changed - all data should still exist due to transaction rollback
|
||||
@@ -1014,4 +1074,4 @@ describe("TeamService.removeMembers Integration Tests", () => {
|
||||
await cleanupTestData([subTeamForRollback.id], [rollbackTestUser.id, conflictingUser.id]);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { Prisma } from "@prisma/client";
|
||||
|
||||
import type { appDataSchemas } from "@calcom/app-store/apps.schemas.generated";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import type { Prisma } from "@calcom/prisma/client";
|
||||
import { EventTypeMetaDataSchema, EventTypeAppMetadataSchema } from "@calcom/prisma/zod-utils";
|
||||
|
||||
export class EventTypeService {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { prisma } from "@calcom/prisma/__mocks__/prisma";
|
||||
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
||||
|
||||
import { TeamBilling } from "@calcom/features/ee/billing/teams";
|
||||
@@ -7,6 +9,10 @@ import { WorkflowService } from "@calcom/lib/server/service/workflows";
|
||||
|
||||
import { TeamService } from "./teamService";
|
||||
|
||||
vi.mock("@calcom/prisma", () => ({
|
||||
prisma,
|
||||
}));
|
||||
|
||||
vi.mock("@calcom/features/ee/billing/teams");
|
||||
vi.mock("@calcom/lib/server/repository/team");
|
||||
vi.mock("@calcom/lib/server/service/workflows");
|
||||
@@ -45,6 +51,7 @@ const mockTeamRepo = {
|
||||
throw new Error(`Team with id ${id} not found`);
|
||||
}),
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
vi.mocked(TeamRepository).mockImplementation(() => mockTeamRepo as any);
|
||||
|
||||
vi.mocked(deleteDomain).mockImplementation(async (slug) => {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { Prisma } from "@prisma/client";
|
||||
|
||||
import { TeamBilling } from "@calcom/features/ee/billing/teams";
|
||||
import { deleteWorkfowRemindersOfRemovedMember } from "@calcom/features/ee/teams/lib/deleteWorkflowRemindersOfRemovedMember";
|
||||
import { deleteDomain } from "@calcom/lib/domainManager/organization";
|
||||
@@ -7,7 +5,8 @@ import logger from "@calcom/lib/logger";
|
||||
import { ProfileRepository } from "@calcom/lib/server/repository/profile";
|
||||
import { TeamRepository } from "@calcom/lib/server/repository/team";
|
||||
import { WorkflowService } from "@calcom/lib/server/service/workflows";
|
||||
import prisma from "@calcom/prisma";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import { Prisma } from "@calcom/prisma/client";
|
||||
import type { Membership } from "@calcom/prisma/client";
|
||||
import { MembershipRole } from "@calcom/prisma/enums";
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { Prisma } from "@prisma/client";
|
||||
import { z } from "zod";
|
||||
|
||||
import { SERVICE_ACCOUNT_ENCRYPTION_KEY } from "@calcom/lib/constants";
|
||||
import { symmetricEncrypt, symmetricDecrypt } from "@calcom/lib/crypto";
|
||||
import type { Prisma } from "@calcom/prisma/client";
|
||||
import { serviceAccountKeySchema } from "@calcom/prisma/zod-utils";
|
||||
|
||||
export type ServiceAccountKey = z.infer<typeof serviceAccountKeySchema>;
|
||||
|
||||
Reference in new issue
Block a user