perf: Slim down logged in round 2 (#20535)
* perf: Slim down loggedInViewer some more * Move locationOptions to apps router * Moved calVideo related handlers to separate router * Moved calendar related handlers to separate router * Rename * Moved deleteCredential to new router * Moved updateProfile to me router * fix unit test * fix e2e test * tweak * missing --------- Co-authored-by: Anik Dhabal Babu <[email protected]> Co-authored-by: unknown <[email protected]>
This commit is contained in:
66 files changed
+240
-205
No files matched your search
@@ -9,6 +9,9 @@ export const ENDPOINTS = [
|
||||
"availability",
|
||||
"appBasecamp3",
|
||||
"bookings",
|
||||
"calendars",
|
||||
"calVideo",
|
||||
"credentials",
|
||||
"deploymentSetup",
|
||||
"dsync",
|
||||
"eventTypes",
|
||||
|
||||
@@ -3,38 +3,22 @@ import { importHandler, router } from "../../trpc";
|
||||
import { ZAddNotificationsSubscriptionInputSchema } from "./addNotificationsSubscription.schema";
|
||||
import { ZAddSecondaryEmailInputSchema } from "./addSecondaryEmail.schema";
|
||||
import { ZConnectAndJoinInputSchema } from "./connectAndJoin.schema";
|
||||
import { ZConnectedCalendarsInputSchema } from "./connectedCalendars.schema";
|
||||
import { ZDeleteCredentialInputSchema } from "./deleteCredential.schema";
|
||||
import { ZEventTypeOrderInputSchema } from "./eventTypeOrder.schema";
|
||||
import { ZGetCalVideoRecordingsInputSchema } from "./getCalVideoRecordings.schema";
|
||||
import { ZGetDownloadLinkOfCalVideoRecordingsInputSchema } from "./getDownloadLinkOfCalVideoRecordings.schema";
|
||||
import { ZLocationOptionsInputSchema } from "./locationOptions.schema";
|
||||
import { ZNoShowInputSchema } from "./markNoShow.schema";
|
||||
import { teamsAndUserProfilesQuery } from "./procedures/teamsAndUserProfilesQuery";
|
||||
import { ZRemoveNotificationsSubscriptionInputSchema } from "./removeNotificationsSubscription.schema";
|
||||
import { ZRoutingFormOrderInputSchema } from "./routingFormOrder.schema";
|
||||
import { ZSetDestinationCalendarInputSchema } from "./setDestinationCalendar.schema";
|
||||
import { ZSubmitFeedbackInputSchema } from "./submitFeedback.schema";
|
||||
import { ZUpdateProfileInputSchema } from "./updateProfile.schema";
|
||||
import { ZWorkflowOrderInputSchema } from "./workflowOrder.schema";
|
||||
|
||||
const NAMESPACE = "loggedInViewer";
|
||||
|
||||
const namespaced = (s: string) => `${NAMESPACE}.${s}`;
|
||||
|
||||
type AppsRouterHandlerCache = {
|
||||
connectedCalendars?: typeof import("./connectedCalendars.handler").connectedCalendarsHandler;
|
||||
setDestinationCalendar?: typeof import("./setDestinationCalendar.handler").setDestinationCalendarHandler;
|
||||
stripeCustomer?: typeof import("./stripeCustomer.handler").stripeCustomerHandler;
|
||||
updateProfile?: typeof import("./updateProfile.handler").updateProfileHandler;
|
||||
eventTypeOrder?: typeof import("./eventTypeOrder.handler").eventTypeOrderHandler;
|
||||
routingFormOrder?: typeof import("./routingFormOrder.handler").routingFormOrderHandler;
|
||||
workflowOrder?: typeof import("./workflowOrder.handler").workflowOrderHandler;
|
||||
submitFeedback?: typeof import("./submitFeedback.handler").submitFeedbackHandler;
|
||||
locationOptions?: typeof import("./locationOptions.handler").locationOptionsHandler;
|
||||
deleteCredential?: typeof import("./deleteCredential.handler").deleteCredentialHandler;
|
||||
getCalVideoRecordings?: typeof import("./getCalVideoRecordings.handler").getCalVideoRecordingsHandler;
|
||||
getDownloadLinkOfCalVideoRecordings?: typeof import("./getDownloadLinkOfCalVideoRecordings.handler").getDownloadLinkOfCalVideoRecordingsHandler;
|
||||
teamsAndUserProfilesQuery?: typeof import("./teamsAndUserProfilesQuery.handler").teamsAndUserProfilesQuery;
|
||||
connectAndJoin?: typeof import("./connectAndJoin.handler").Handler;
|
||||
addSecondaryEmail?: typeof import("./addSecondaryEmail.handler").addSecondaryEmailHandler;
|
||||
@@ -46,38 +30,6 @@ type AppsRouterHandlerCache = {
|
||||
const UNSTABLE_HANDLER_CACHE: AppsRouterHandlerCache = {};
|
||||
|
||||
export const loggedInViewerRouter = router({
|
||||
connectedCalendars: authedProcedure.input(ZConnectedCalendarsInputSchema).query(async ({ ctx, input }) => {
|
||||
if (!UNSTABLE_HANDLER_CACHE.connectedCalendars) {
|
||||
UNSTABLE_HANDLER_CACHE.connectedCalendars = (
|
||||
await import("./connectedCalendars.handler")
|
||||
).connectedCalendarsHandler;
|
||||
}
|
||||
|
||||
// Unreachable code but required for type safety
|
||||
if (!UNSTABLE_HANDLER_CACHE.connectedCalendars) {
|
||||
throw new Error("Failed to load handler");
|
||||
}
|
||||
|
||||
return UNSTABLE_HANDLER_CACHE.connectedCalendars({ ctx, input });
|
||||
}),
|
||||
|
||||
setDestinationCalendar: authedProcedure
|
||||
.input(ZSetDestinationCalendarInputSchema)
|
||||
.mutation(async ({ ctx, input }) => {
|
||||
if (!UNSTABLE_HANDLER_CACHE.setDestinationCalendar) {
|
||||
UNSTABLE_HANDLER_CACHE.setDestinationCalendar = (
|
||||
await import("./setDestinationCalendar.handler")
|
||||
).setDestinationCalendarHandler;
|
||||
}
|
||||
|
||||
// Unreachable code but required for type safety
|
||||
if (!UNSTABLE_HANDLER_CACHE.setDestinationCalendar) {
|
||||
throw new Error("Failed to load handler");
|
||||
}
|
||||
|
||||
return UNSTABLE_HANDLER_CACHE.setDestinationCalendar({ ctx, input });
|
||||
}),
|
||||
|
||||
stripeCustomer: authedProcedure.query(async ({ ctx }) => {
|
||||
if (!UNSTABLE_HANDLER_CACHE.stripeCustomer) {
|
||||
UNSTABLE_HANDLER_CACHE.stripeCustomer = (
|
||||
@@ -93,19 +45,6 @@ export const loggedInViewerRouter = router({
|
||||
return UNSTABLE_HANDLER_CACHE.stripeCustomer({ ctx });
|
||||
}),
|
||||
|
||||
updateProfile: authedProcedure.input(ZUpdateProfileInputSchema).mutation(async ({ ctx, input }) => {
|
||||
if (!UNSTABLE_HANDLER_CACHE.updateProfile) {
|
||||
UNSTABLE_HANDLER_CACHE.updateProfile = (await import("./updateProfile.handler")).updateProfileHandler;
|
||||
}
|
||||
|
||||
// Unreachable code but required for type safety
|
||||
if (!UNSTABLE_HANDLER_CACHE.updateProfile) {
|
||||
throw new Error("Failed to load handler");
|
||||
}
|
||||
|
||||
return UNSTABLE_HANDLER_CACHE.updateProfile({ ctx, input });
|
||||
}),
|
||||
|
||||
unlinkConnectedAccount: authedProcedure.mutation(async (opts) => {
|
||||
const handler = await importHandler(
|
||||
namespaced("unlinkConnectedAccount"),
|
||||
@@ -144,19 +83,6 @@ export const loggedInViewerRouter = router({
|
||||
return UNSTABLE_HANDLER_CACHE.routingFormOrder({ ctx, input });
|
||||
}),
|
||||
|
||||
workflowOrder: authedProcedure.input(ZWorkflowOrderInputSchema).mutation(async ({ ctx, input }) => {
|
||||
if (!UNSTABLE_HANDLER_CACHE.workflowOrder) {
|
||||
UNSTABLE_HANDLER_CACHE.workflowOrder = (await import("./workflowOrder.handler")).workflowOrderHandler;
|
||||
}
|
||||
|
||||
// Unreachable code but required for type safety
|
||||
if (!UNSTABLE_HANDLER_CACHE.workflowOrder) {
|
||||
throw new Error("Failed to load handler");
|
||||
}
|
||||
|
||||
return UNSTABLE_HANDLER_CACHE.workflowOrder({ ctx, input });
|
||||
}),
|
||||
|
||||
//Comment for PR: eventTypePosition is not used anywhere
|
||||
submitFeedback: authedProcedure.input(ZSubmitFeedbackInputSchema).mutation(async ({ ctx, input }) => {
|
||||
if (!UNSTABLE_HANDLER_CACHE.submitFeedback) {
|
||||
@@ -172,70 +98,6 @@ export const loggedInViewerRouter = router({
|
||||
|
||||
return UNSTABLE_HANDLER_CACHE.submitFeedback({ ctx, input });
|
||||
}),
|
||||
|
||||
locationOptions: authedProcedure.input(ZLocationOptionsInputSchema).query(async ({ ctx, input }) => {
|
||||
if (!UNSTABLE_HANDLER_CACHE.locationOptions) {
|
||||
UNSTABLE_HANDLER_CACHE.locationOptions = (
|
||||
await import("./locationOptions.handler")
|
||||
).locationOptionsHandler;
|
||||
}
|
||||
|
||||
// Unreachable code but required for type safety
|
||||
if (!UNSTABLE_HANDLER_CACHE.locationOptions) {
|
||||
throw new Error("Failed to load handler");
|
||||
}
|
||||
|
||||
return UNSTABLE_HANDLER_CACHE.locationOptions({ ctx, input });
|
||||
}),
|
||||
|
||||
deleteCredential: authedProcedure.input(ZDeleteCredentialInputSchema).mutation(async ({ ctx, input }) => {
|
||||
if (!UNSTABLE_HANDLER_CACHE.deleteCredential) {
|
||||
UNSTABLE_HANDLER_CACHE.deleteCredential = (
|
||||
await import("./deleteCredential.handler")
|
||||
).deleteCredentialHandler;
|
||||
}
|
||||
|
||||
// Unreachable code but required for type safety
|
||||
if (!UNSTABLE_HANDLER_CACHE.deleteCredential) {
|
||||
throw new Error("Failed to load handler");
|
||||
}
|
||||
|
||||
return UNSTABLE_HANDLER_CACHE.deleteCredential({ ctx, input });
|
||||
}),
|
||||
|
||||
getCalVideoRecordings: authedProcedure
|
||||
.input(ZGetCalVideoRecordingsInputSchema)
|
||||
.query(async ({ ctx, input }) => {
|
||||
if (!UNSTABLE_HANDLER_CACHE.getCalVideoRecordings) {
|
||||
UNSTABLE_HANDLER_CACHE.getCalVideoRecordings = (
|
||||
await import("./getCalVideoRecordings.handler")
|
||||
).getCalVideoRecordingsHandler;
|
||||
}
|
||||
|
||||
// Unreachable code but required for type safety
|
||||
if (!UNSTABLE_HANDLER_CACHE.getCalVideoRecordings) {
|
||||
throw new Error("Failed to load handler");
|
||||
}
|
||||
|
||||
return UNSTABLE_HANDLER_CACHE.getCalVideoRecordings({ ctx, input });
|
||||
}),
|
||||
|
||||
getDownloadLinkOfCalVideoRecordings: authedProcedure
|
||||
.input(ZGetDownloadLinkOfCalVideoRecordingsInputSchema)
|
||||
.query(async ({ ctx, input }) => {
|
||||
if (!UNSTABLE_HANDLER_CACHE.getDownloadLinkOfCalVideoRecordings) {
|
||||
UNSTABLE_HANDLER_CACHE.getDownloadLinkOfCalVideoRecordings = (
|
||||
await import("./getDownloadLinkOfCalVideoRecordings.handler")
|
||||
).getDownloadLinkOfCalVideoRecordingsHandler;
|
||||
}
|
||||
|
||||
// Unreachable code but required for type safety
|
||||
if (!UNSTABLE_HANDLER_CACHE.getDownloadLinkOfCalVideoRecordings) {
|
||||
throw new Error("Failed to load handler");
|
||||
}
|
||||
|
||||
return UNSTABLE_HANDLER_CACHE.getDownloadLinkOfCalVideoRecordings({ ctx, input });
|
||||
}),
|
||||
teamsAndUserProfilesQuery,
|
||||
connectAndJoin: authedProcedure.input(ZConnectAndJoinInputSchema).mutation(async ({ ctx, input }) => {
|
||||
if (!UNSTABLE_HANDLER_CACHE.connectAndJoin) {
|
||||
|
||||
@@ -15,6 +15,9 @@ import { attributesRouter } from "./attributes/_router";
|
||||
import { authRouter } from "./auth/_router";
|
||||
import { availabilityRouter } from "./availability/_router";
|
||||
import { bookingsRouter } from "./bookings/_router";
|
||||
import { calVideoRouter } from "./calVideo/_router";
|
||||
import { calendarsRouter } from "./calendars/_router";
|
||||
import { credentialsRouter } from "./credentials/_router";
|
||||
import { delegationCredentialRouter } from "./delegationCredential/_router";
|
||||
import { deploymentSetupRouter } from "./deploymentSetup/_router";
|
||||
import { dsyncRouter } from "./dsync/_router";
|
||||
@@ -46,6 +49,9 @@ export const viewerRouter = mergeRouters(
|
||||
auth: authRouter,
|
||||
deploymentSetup: deploymentSetupRouter,
|
||||
bookings: bookingsRouter,
|
||||
calendars: calendarsRouter,
|
||||
calVideo: calVideoRouter,
|
||||
credentials: credentialsRouter,
|
||||
eventTypes: eventTypesRouter,
|
||||
availability: availabilityRouter,
|
||||
teams: viewerTeamsRouter,
|
||||
|
||||
@@ -5,6 +5,7 @@ import { ZAppCredentialsByTypeInputSchema } from "./appCredentialsByType.schema"
|
||||
import { checkGlobalKeysSchema } from "./checkGlobalKeys.schema";
|
||||
import { ZIntegrationsInputSchema } from "./integrations.schema";
|
||||
import { ZListLocalInputSchema } from "./listLocal.schema";
|
||||
import { ZLocationOptionsInputSchema } from "./locationOptions.schema";
|
||||
import { ZQueryForDependenciesInputSchema } from "./queryForDependencies.schema";
|
||||
import { ZSaveKeysInputSchema } from "./saveKeys.schema";
|
||||
import { ZSetDefaultConferencingAppSchema } from "./setDefaultConferencingApp.schema";
|
||||
@@ -18,6 +19,7 @@ type AppsRouterHandlerCache = {
|
||||
getUsersDefaultConferencingApp?: typeof import("./getUsersDefaultConferencingApp.handler").getUsersDefaultConferencingAppHandler;
|
||||
integrations?: typeof import("./integrations.handler").integrationsHandler;
|
||||
listLocal?: typeof import("./listLocal.handler").listLocalHandler;
|
||||
locationOptions?: typeof import("./locationOptions.handler").locationOptionsHandler;
|
||||
toggle?: typeof import("./toggle.handler").toggleHandler;
|
||||
saveKeys?: typeof import("./saveKeys.handler").saveKeysHandler;
|
||||
checkForGCal?: typeof import("./checkForGCal.handler").checkForGCalHandler;
|
||||
@@ -86,6 +88,7 @@ export const appsRouter = router({
|
||||
|
||||
return UNSTABLE_HANDLER_CACHE.integrations({ ctx, input });
|
||||
}),
|
||||
|
||||
listLocal: authedAdminProcedure.input(ZListLocalInputSchema).query(async ({ ctx, input }) => {
|
||||
if (!UNSTABLE_HANDLER_CACHE.listLocal) {
|
||||
UNSTABLE_HANDLER_CACHE.listLocal = await import("./listLocal.handler").then(
|
||||
@@ -104,6 +107,21 @@ export const appsRouter = router({
|
||||
});
|
||||
}),
|
||||
|
||||
locationOptions: authedProcedure.input(ZLocationOptionsInputSchema).query(async ({ ctx, input }) => {
|
||||
if (!UNSTABLE_HANDLER_CACHE.locationOptions) {
|
||||
UNSTABLE_HANDLER_CACHE.locationOptions = (
|
||||
await import("./locationOptions.handler")
|
||||
).locationOptionsHandler;
|
||||
}
|
||||
|
||||
// Unreachable code but required for type safety
|
||||
if (!UNSTABLE_HANDLER_CACHE.locationOptions) {
|
||||
throw new Error("Failed to load handler");
|
||||
}
|
||||
|
||||
return UNSTABLE_HANDLER_CACHE.locationOptions({ ctx, input });
|
||||
}),
|
||||
|
||||
toggle: authedAdminProcedure.input(ZToggleInputSchema).mutation(async ({ ctx, input }) => {
|
||||
if (!UNSTABLE_HANDLER_CACHE.toggle) {
|
||||
UNSTABLE_HANDLER_CACHE.toggle = await import("./toggle.handler").then((mod) => mod.toggleHandler);
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,47 @@
|
||||
import authedProcedure from "../../../procedures/authedProcedure";
|
||||
import { router } from "../../../trpc";
|
||||
import { ZGetCalVideoRecordingsInputSchema } from "./getCalVideoRecordings.schema";
|
||||
import { ZGetDownloadLinkOfCalVideoRecordingsInputSchema } from "./getDownloadLinkOfCalVideoRecordings.schema";
|
||||
|
||||
type CalVideoRouterHandlerCache = {
|
||||
getCalVideoRecordings?: typeof import("./getCalVideoRecordings.handler").getCalVideoRecordingsHandler;
|
||||
getDownloadLinkOfCalVideoRecordings?: typeof import("./getDownloadLinkOfCalVideoRecordings.handler").getDownloadLinkOfCalVideoRecordingsHandler;
|
||||
};
|
||||
|
||||
const UNSTABLE_HANDLER_CACHE: CalVideoRouterHandlerCache = {};
|
||||
|
||||
export const calVideoRouter = router({
|
||||
getCalVideoRecordings: authedProcedure
|
||||
.input(ZGetCalVideoRecordingsInputSchema)
|
||||
.query(async ({ ctx, input }) => {
|
||||
if (!UNSTABLE_HANDLER_CACHE.getCalVideoRecordings) {
|
||||
UNSTABLE_HANDLER_CACHE.getCalVideoRecordings = (
|
||||
await import("./getCalVideoRecordings.handler")
|
||||
).getCalVideoRecordingsHandler;
|
||||
}
|
||||
|
||||
// Unreachable code but required for type safety
|
||||
if (!UNSTABLE_HANDLER_CACHE.getCalVideoRecordings) {
|
||||
throw new Error("Failed to load handler");
|
||||
}
|
||||
|
||||
return UNSTABLE_HANDLER_CACHE.getCalVideoRecordings({ ctx, input });
|
||||
}),
|
||||
|
||||
getDownloadLinkOfCalVideoRecordings: authedProcedure
|
||||
.input(ZGetDownloadLinkOfCalVideoRecordingsInputSchema)
|
||||
.query(async ({ ctx, input }) => {
|
||||
if (!UNSTABLE_HANDLER_CACHE.getDownloadLinkOfCalVideoRecordings) {
|
||||
UNSTABLE_HANDLER_CACHE.getDownloadLinkOfCalVideoRecordings = (
|
||||
await import("./getDownloadLinkOfCalVideoRecordings.handler")
|
||||
).getDownloadLinkOfCalVideoRecordingsHandler;
|
||||
}
|
||||
|
||||
// Unreachable code but required for type safety
|
||||
if (!UNSTABLE_HANDLER_CACHE.getDownloadLinkOfCalVideoRecordings) {
|
||||
throw new Error("Failed to load handler");
|
||||
}
|
||||
|
||||
return UNSTABLE_HANDLER_CACHE.getDownloadLinkOfCalVideoRecordings({ ctx, input });
|
||||
}),
|
||||
});
|
||||
File renamed without changes.
File renamed without changes.
+1
-1
@@ -4,7 +4,7 @@ import { getDownloadLinkOfCalVideoByRecordingId } from "@calcom/lib/videoClient"
|
||||
|
||||
import { TRPCError } from "@trpc/server";
|
||||
|
||||
import type { WithSession } from "../../createContext";
|
||||
import type { WithSession } from "../../../createContext";
|
||||
import type { TGetDownloadLinkOfCalVideoRecordingsInputSchema } from "./getDownloadLinkOfCalVideoRecordings.schema";
|
||||
|
||||
type GetDownloadLinkOfCalVideoRecordingsHandlerOptions = {
|
||||
File renamed without changes.
@@ -0,0 +1,45 @@
|
||||
import authedProcedure from "../../../procedures/authedProcedure";
|
||||
import { router } from "../../../trpc";
|
||||
import { ZConnectedCalendarsInputSchema } from "./connectedCalendars.schema";
|
||||
import { ZSetDestinationCalendarInputSchema } from "./setDestinationCalendar.schema";
|
||||
|
||||
type CalendarsRouterHandlerCache = {
|
||||
connectedCalendars?: typeof import("./connectedCalendars.handler").connectedCalendarsHandler;
|
||||
setDestinationCalendar?: typeof import("./setDestinationCalendar.handler").setDestinationCalendarHandler;
|
||||
};
|
||||
|
||||
const UNSTABLE_HANDLER_CACHE: CalendarsRouterHandlerCache = {};
|
||||
|
||||
export const calendarsRouter = router({
|
||||
connectedCalendars: authedProcedure.input(ZConnectedCalendarsInputSchema).query(async ({ ctx, input }) => {
|
||||
if (!UNSTABLE_HANDLER_CACHE.connectedCalendars) {
|
||||
UNSTABLE_HANDLER_CACHE.connectedCalendars = (
|
||||
await import("./connectedCalendars.handler")
|
||||
).connectedCalendarsHandler;
|
||||
}
|
||||
|
||||
// Unreachable code but required for type safety
|
||||
if (!UNSTABLE_HANDLER_CACHE.connectedCalendars) {
|
||||
throw new Error("Failed to load handler");
|
||||
}
|
||||
|
||||
return UNSTABLE_HANDLER_CACHE.connectedCalendars({ ctx, input });
|
||||
}),
|
||||
|
||||
setDestinationCalendar: authedProcedure
|
||||
.input(ZSetDestinationCalendarInputSchema)
|
||||
.mutation(async ({ ctx, input }) => {
|
||||
if (!UNSTABLE_HANDLER_CACHE.setDestinationCalendar) {
|
||||
UNSTABLE_HANDLER_CACHE.setDestinationCalendar = (
|
||||
await import("./setDestinationCalendar.handler")
|
||||
).setDestinationCalendarHandler;
|
||||
}
|
||||
|
||||
// Unreachable code but required for type safety
|
||||
if (!UNSTABLE_HANDLER_CACHE.setDestinationCalendar) {
|
||||
throw new Error("Failed to load handler");
|
||||
}
|
||||
|
||||
return UNSTABLE_HANDLER_CACHE.setDestinationCalendar({ ctx, input });
|
||||
}),
|
||||
});
|
||||
File renamed without changes.
File renamed without changes.
+2
-2
@@ -1,4 +1,4 @@
|
||||
import prisma from "../../../../../tests/libs/__mocks__/prisma";
|
||||
import prisma from "../../../../../../tests/libs/__mocks__/prisma";
|
||||
|
||||
import {
|
||||
createBookingScenario,
|
||||
@@ -17,7 +17,7 @@ import { SchedulingType, MembershipRole } from "@calcom/prisma/enums";
|
||||
|
||||
import { TRPCError } from "@trpc/server";
|
||||
|
||||
import type { TrpcSessionUser } from "../../types";
|
||||
import type { TrpcSessionUser } from "../../../types";
|
||||
import { setDestinationCalendarHandler } from "./setDestinationCalendar.handler";
|
||||
|
||||
vi.mock("@calcom/lib/CalendarManager", () => ({
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,26 @@
|
||||
import authedProcedure from "../../../procedures/authedProcedure";
|
||||
import { router } from "../../../trpc";
|
||||
import { ZDeleteCredentialInputSchema } from "./deleteCredential.schema";
|
||||
|
||||
type CredentialsRouterHandlerCache = {
|
||||
deleteCredential?: typeof import("./deleteCredential.handler").deleteCredentialHandler;
|
||||
};
|
||||
|
||||
const UNSTABLE_HANDLER_CACHE: CredentialsRouterHandlerCache = {};
|
||||
|
||||
export const credentialsRouter = router({
|
||||
delete: authedProcedure.input(ZDeleteCredentialInputSchema).mutation(async ({ ctx, input }) => {
|
||||
if (!UNSTABLE_HANDLER_CACHE.deleteCredential) {
|
||||
UNSTABLE_HANDLER_CACHE.deleteCredential = (
|
||||
await import("./deleteCredential.handler")
|
||||
).deleteCredentialHandler;
|
||||
}
|
||||
|
||||
// Unreachable code but required for type safety
|
||||
if (!UNSTABLE_HANDLER_CACHE.deleteCredential) {
|
||||
throw new Error("Failed to load handler");
|
||||
}
|
||||
|
||||
return UNSTABLE_HANDLER_CACHE.deleteCredential({ ctx, input });
|
||||
}),
|
||||
});
|
||||
File renamed without changes.
File renamed without changes.
@@ -7,7 +7,7 @@ import { prisma } from "@calcom/prisma";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
|
||||
import type { TrpcSessionUser } from "../../../types";
|
||||
import { setDestinationCalendarHandler } from "../../loggedInViewer/setDestinationCalendar.handler";
|
||||
import { setDestinationCalendarHandler } from "../../viewer/calendars/setDestinationCalendar.handler";
|
||||
import type { TDuplicateInputSchema } from "./duplicate.schema";
|
||||
|
||||
type DuplicateOptions = {
|
||||
|
||||
@@ -20,7 +20,7 @@ import { eventTypeAppMetadataOptionalSchema } from "@calcom/prisma/zod-utils";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
|
||||
import type { TrpcSessionUser } from "../../../types";
|
||||
import { setDestinationCalendarHandler } from "../../loggedInViewer/setDestinationCalendar.handler";
|
||||
import { setDestinationCalendarHandler } from "../../viewer/calendars/setDestinationCalendar.handler";
|
||||
import type { TUpdateInputSchema } from "./update.schema";
|
||||
import {
|
||||
ensureUniqueBookingFields,
|
||||
|
||||
@@ -2,6 +2,7 @@ import authedProcedure from "../../../procedures/authedProcedure";
|
||||
import { router } from "../../../trpc";
|
||||
import { ZDeleteMeInputSchema } from "./deleteMe.schema";
|
||||
import { get } from "./procedures/get";
|
||||
import { ZUpdateProfileInputSchema } from "./updateProfile.schema";
|
||||
|
||||
export const meRouter = router({
|
||||
bookingUnconfirmedCount: authedProcedure.query(async ({ ctx }) => {
|
||||
@@ -33,4 +34,8 @@ export const meRouter = router({
|
||||
const handler = (await import("./shouldVerifyEmail.handler")).shouldVerifyEmailHandler;
|
||||
return handler({ ctx });
|
||||
}),
|
||||
updateProfile: authedProcedure.input(ZUpdateProfileInputSchema).mutation(async ({ ctx, input }) => {
|
||||
const handler = (await import("./updateProfile.handler")).updateProfileHandler;
|
||||
return handler({ ctx, input });
|
||||
}),
|
||||
});
|
||||
+1
-1
@@ -23,7 +23,7 @@ import type { TrpcSessionUser } from "@calcom/trpc/server/types";
|
||||
|
||||
import { TRPCError } from "@trpc/server";
|
||||
|
||||
import { getDefaultScheduleId } from "../viewer/availability/util";
|
||||
import { getDefaultScheduleId } from "../availability/util";
|
||||
import { updateUserMetadataAllowedKeys, type TUpdateProfileInputSchema } from "./updateProfile.schema";
|
||||
|
||||
const log = logger.getSubLogger({ prefix: ["updateProfile"] });
|
||||
File renamed without changes.
@@ -13,6 +13,7 @@ import { ZSendVerificationCodeInputSchema } from "./sendVerificationCode.schema"
|
||||
import { ZUpdateInputSchema } from "./update.schema";
|
||||
import { ZVerifyEmailCodeInputSchema } from "./verifyEmailCode.schema";
|
||||
import { ZVerifyPhoneNumberInputSchema } from "./verifyPhoneNumber.schema";
|
||||
import { ZWorkflowOrderInputSchema } from "./workflowOrder.schema";
|
||||
|
||||
type WorkflowsRouterHandlerCache = {
|
||||
list?: typeof import("./list.handler").listHandler;
|
||||
@@ -29,6 +30,7 @@ type WorkflowsRouterHandlerCache = {
|
||||
getVerifiedEmails?: typeof import("./getVerifiedEmails.handler").getVerifiedEmailsHandler;
|
||||
verifyEmailCode?: typeof import("./verifyEmailCode.handler").verifyEmailCodeHandler;
|
||||
getAllActiveWorkflows?: typeof import("./getAllActiveWorkflows.handler").getAllActiveWorkflowsHandler;
|
||||
workflowOrder?: typeof import("./workflowOrder.handler").workflowOrderHandler;
|
||||
};
|
||||
|
||||
const UNSTABLE_HANDLER_CACHE: WorkflowsRouterHandlerCache = {};
|
||||
@@ -276,4 +278,16 @@ export const workflowsRouter = router({
|
||||
input,
|
||||
});
|
||||
}),
|
||||
workflowOrder: authedProcedure.input(ZWorkflowOrderInputSchema).mutation(async ({ ctx, input }) => {
|
||||
if (!UNSTABLE_HANDLER_CACHE.workflowOrder) {
|
||||
UNSTABLE_HANDLER_CACHE.workflowOrder = (await import("./workflowOrder.handler")).workflowOrderHandler;
|
||||
}
|
||||
|
||||
// Unreachable code but required for type safety
|
||||
if (!UNSTABLE_HANDLER_CACHE.workflowOrder) {
|
||||
throw new Error("Failed to load handler");
|
||||
}
|
||||
|
||||
return UNSTABLE_HANDLER_CACHE.workflowOrder({ ctx, input });
|
||||
}),
|
||||
});
|
||||
File renamed without changes.
Reference in new issue
Block a user