refactor: remove highperf endpoints (#23171)
* refactor: remove highperf endpoints * fix trpc function name * chore: remove isTeamEvent logic * chore: remove isTeamEvent at all * revert wrong change * Revert "chore: remove isTeamEvent at all" This reverts commit 6dbc8c31f16c40a7654a05240661d7892aa48bb8. * revert wrong change
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
import { wrapApiHandlerWithSentry } from "@sentry/nextjs";
|
||||
|
||||
import { createNextApiHandler } from "@calcom/trpc/server/createNextApiHandler";
|
||||
import { highPerfRouter } from "@calcom/trpc/server/routers/viewer/highPerf/_router";
|
||||
|
||||
export default wrapApiHandlerWithSentry(createNextApiHandler(highPerfRouter), "/api/trpc/highPerf/[trpc]");
|
||||
@@ -136,13 +136,11 @@ export const useSchedule = ({
|
||||
eventTypeId: eventId ?? undefined,
|
||||
});
|
||||
|
||||
const schedule = isTeamEvent
|
||||
? trpc.viewer.highPerf.getTeamSchedule.useQuery(input, {
|
||||
...options,
|
||||
// Only enable if we're not using API V2
|
||||
enabled: options.enabled && !isCallingApiV2Slots,
|
||||
})
|
||||
: trpc.viewer.slots.getSchedule.useQuery(input, options);
|
||||
const schedule = trpc.viewer.slots.getSchedule.useQuery(input, {
|
||||
...options,
|
||||
// Only enable if we're not using API V2
|
||||
enabled: options.enabled && !isCallingApiV2Slots,
|
||||
});
|
||||
|
||||
if (isCallingApiV2Slots && !teamScheduleV2.failureReason) {
|
||||
updateEmbedBookerState({
|
||||
|
||||
@@ -17,7 +17,6 @@ export const ENDPOINTS = [
|
||||
"dsync",
|
||||
"eventTypes",
|
||||
"features",
|
||||
"highPerf",
|
||||
"i18n",
|
||||
"insights",
|
||||
"me",
|
||||
|
||||
@@ -25,7 +25,6 @@ import { dsyncRouter } from "./dsync/_router";
|
||||
import { eventTypesRouter } from "./eventTypes/_router";
|
||||
import { filterSegmentsRouter } from "./filterSegments/_router";
|
||||
import { googleWorkspaceRouter } from "./googleWorkspace/_router";
|
||||
import { highPerfRouter } from "./highPerf/_router";
|
||||
import { i18nRouter } from "./i18n/_router";
|
||||
import { meRouter } from "./me/_router";
|
||||
import { oAuthRouter } from "./oAuth/_router";
|
||||
@@ -79,7 +78,6 @@ export const viewerRouter = router({
|
||||
googleWorkspace: googleWorkspaceRouter,
|
||||
admin: adminRouter,
|
||||
attributes: attributesRouter,
|
||||
highPerf: highPerfRouter,
|
||||
routingForms: routingFormsRouter,
|
||||
credits: creditsRouter,
|
||||
ooo: oooRouter,
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
import publicProcedure from "../../../procedures/publicProcedure";
|
||||
import { router } from "../../../trpc";
|
||||
import { ZGetTeamScheduleInputSchema } from "./getTeamSchedule.schema";
|
||||
|
||||
type SlotsRouterHandlerCache = {
|
||||
getTeamSchedule?: typeof import("./getTeamSchedule.handler").getTeamScheduleHandler;
|
||||
};
|
||||
|
||||
/** This should be called getAvailableSlots */
|
||||
export const highPerfRouter = router({
|
||||
getTeamSchedule: publicProcedure.input(ZGetTeamScheduleInputSchema).query(async ({ input, ctx }) => {
|
||||
const { getTeamScheduleHandler } = await import("./getTeamSchedule.handler");
|
||||
|
||||
return getTeamScheduleHandler({
|
||||
ctx,
|
||||
input,
|
||||
});
|
||||
}),
|
||||
});
|
||||
@@ -1,19 +0,0 @@
|
||||
import type { IncomingMessage } from "http";
|
||||
|
||||
import { getAvailableSlotsService } from "@calcom/lib/di/containers/AvailableSlots";
|
||||
|
||||
import type { TGetTeamScheduleInputSchema } from "./getTeamSchedule.schema";
|
||||
|
||||
export type GetTeamScheduleOptions = {
|
||||
ctx?: ContextForGetSchedule;
|
||||
input: TGetTeamScheduleInputSchema;
|
||||
};
|
||||
|
||||
interface ContextForGetSchedule extends Record<string, unknown> {
|
||||
req?: (IncomingMessage & { cookies: Partial<{ [key: string]: string }> }) | undefined;
|
||||
}
|
||||
|
||||
export const getTeamScheduleHandler = async ({ ctx, input }: GetTeamScheduleOptions) => {
|
||||
const availableSlotsService = getAvailableSlotsService();
|
||||
return await availableSlotsService.getAvailableSlots({ ctx, input });
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
import type { z } from "zod";
|
||||
|
||||
import { getScheduleSchema } from "../slots/types";
|
||||
|
||||
export const ZGetTeamScheduleInputSchema = getScheduleSchema;
|
||||
|
||||
export type TGetTeamScheduleInputSchema = z.infer<typeof ZGetTeamScheduleInputSchema>;
|
||||
Reference in New Issue
Block a user