refactor: convert lucky user to service class (#23329)
* refactor: lucky user to service class with DI * fix: unit test filterHostsByLeadThreshold.test.ts * fixup! fix: unit test filterHostsByLeadThreshold.test.ts * fix: get lucky user test missing mocks * fix: get lucky user hosts not within interval * chore: bump platform library * chore: bump platform library * chore: add DAILY_API_KEY to turborepo.json db seed * chore: add DAILY_API_KEY to cache-db action * fixup! chore: add DAILY_API_KEY to cache-db action * chore: remove log in fixture * chore: bump platform library * chore: refactor test team-emails.e2e * only failing test * run all api v2 tests * chore: bump platform library * revert change to turbo.json and action in cache-db * chore: use inPerson location in team-emails.e2e
This commit is contained in:
1 parent
ae738fae35
commit
ba8cca55e8
26 files changed
+1806
-2002
No files matched your search
@@ -54,6 +54,7 @@ import {
|
||||
} from "@calcom/lib/delegationCredential/server";
|
||||
import { getCheckBookingAndDurationLimitsService } from "@calcom/lib/di/containers/BookingLimits";
|
||||
import { getCacheService } from "@calcom/lib/di/containers/Cache";
|
||||
import { getLuckyUserService } from "@calcom/lib/di/containers/LuckyUser";
|
||||
import { ErrorCode } from "@calcom/lib/errorCodes";
|
||||
import { getErrorFromUnknown } from "@calcom/lib/errors";
|
||||
import { getEventName, updateHostInEventName } from "@calcom/lib/event";
|
||||
@@ -67,7 +68,6 @@ import logger from "@calcom/lib/logger";
|
||||
import { handlePayment } from "@calcom/lib/payment/handlePayment";
|
||||
import { getPiiFreeCalendarEvent, getPiiFreeEventType } from "@calcom/lib/piiFreeData";
|
||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||
import { getLuckyUser } from "@calcom/lib/server/getLuckyUser";
|
||||
import { getTranslation } from "@calcom/lib/server/i18n";
|
||||
import { BookingRepository } from "@calcom/lib/server/repository/booking";
|
||||
import { WorkflowRepository } from "@calcom/lib/server/repository/workflow";
|
||||
@@ -903,7 +903,8 @@ async function handler(
|
||||
memberId: eventTypeWithUsers.users[0].id ?? null,
|
||||
teamId: eventType.teamId,
|
||||
});
|
||||
const newLuckyUser = await getLuckyUser({
|
||||
const luckyUserService = getLuckyUserService();
|
||||
const newLuckyUser = await luckyUserService.getLuckyUser({
|
||||
// find a lucky user that is not already in the luckyUsers array
|
||||
availableUsers: freeUsers,
|
||||
// only hosts from the same group
|
||||
|
||||
@@ -20,12 +20,12 @@ import {
|
||||
enrichHostsWithDelegationCredentials,
|
||||
enrichUserWithDelegationCredentialsIncludeServiceAccountKey,
|
||||
} from "@calcom/lib/delegationCredential/server";
|
||||
import { getLuckyUserService } from "@calcom/lib/di/containers/LuckyUser";
|
||||
import { ErrorCode } from "@calcom/lib/errorCodes";
|
||||
import { getEventName } from "@calcom/lib/event";
|
||||
import { IdempotencyKeyService } from "@calcom/lib/idempotencyKey/idempotencyKeyService";
|
||||
import { isPrismaObjOrUndefined } from "@calcom/lib/isPrismaObj";
|
||||
import logger from "@calcom/lib/logger";
|
||||
import { getLuckyUser } from "@calcom/lib/server/getLuckyUser";
|
||||
import { getTranslation } from "@calcom/lib/server/i18n";
|
||||
import { getTimeFormatStringFromUserTimeFormat } from "@calcom/lib/timeFormat";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
@@ -153,8 +153,8 @@ export const roundRobinReassignment = async ({
|
||||
},
|
||||
roundRobinReassignLogger
|
||||
);
|
||||
|
||||
const reassignedRRHost = await getLuckyUser({
|
||||
const luckyUserService = getLuckyUserService();
|
||||
const reassignedRRHost = await luckyUserService.getLuckyUser({
|
||||
availableUsers,
|
||||
eventType,
|
||||
allRRHosts: eventTypeHosts.filter((host) => !host.isFixed), // todo: only use hosts from virtual queue
|
||||
|
||||
Reference in new issue
Block a user