Skip to content

Scheduling infrastructure for absolutely everyone.

perf: remove unused submitFeedback tRPC route to reduce type generation load (#21418)

devin-ai-integration[bot]1740e34c7980
diff --git a/packages/trpc/server/routers/loggedInViewer/_router.tsx b/packages/trpc/server/routers/loggedInViewer/_router.tsx
index 74000682089..208bb58eabe 100644
--- a/packages/trpc/server/routers/loggedInViewer/_router.tsx
+++ b/packages/trpc/server/routers/loggedInViewer/_router.tsx
@@ -8,13 +8,11 @@ import { ZNoShowInputSchema } from "./markNoShow.schema";
import { teamsAndUserProfilesQuery } from "./procedures/teamsAndUserProfilesQuery";
import { ZRemoveNotificationsSubscriptionInputSchema } from "./removeNotificationsSubscription.schema";
import { ZRoutingFormOrderInputSchema } from "./routingFormOrder.schema";
-import { ZSubmitFeedbackInputSchema } from "./submitFeedback.schema";
type AppsRouterHandlerCache = {
stripeCustomer?: typeof import("./stripeCustomer.handler").stripeCustomerHandler;
eventTypeOrder?: typeof import("./eventTypeOrder.handler").eventTypeOrderHandler;
routingFormOrder?: typeof import("./routingFormOrder.handler").routingFormOrderHandler;
- submitFeedback?: typeof import("./submitFeedback.handler").submitFeedbackHandler;
teamsAndUserProfilesQuery?: typeof import("./teamsAndUserProfilesQuery.handler").teamsAndUserProfilesQuery;
connectAndJoin?: typeof import("./connectAndJoin.handler").Handler;
addSecondaryEmail?: typeof import("./addSecondaryEmail.handler").addSecondaryEmailHandler;
@@ -46,11 +44,6 @@ export const loggedInViewerRouter = router({
return routingFormOrderHandler({ ctx, input });
}),
- //Comment for PR: eventTypePosition is not used anywhere
- submitFeedback: authedProcedure.input(ZSubmitFeedbackInputSchema).mutation(async ({ ctx, input }) => {
- const { submitFeedbackHandler } = await import("./submitFeedback.handler");
- return submitFeedbackHandler({ ctx, input });
- }),
teamsAndUserProfilesQuery,
connectAndJoin: authedProcedure.input(ZConnectAndJoinInputSchema).mutation(async ({ ctx, input }) => {
const { Handler } = await import("./connectAndJoin.handler");
diff --git a/packages/trpc/server/routers/loggedInViewer/submitFeedback.handler.ts b/packages/trpc/server/routers/loggedInViewer/submitFeedback.handler.ts
deleted file mode 100644
index 0037445ea6d..00000000000
--- a/packages/trpc/server/routers/loggedInViewer/submitFeedback.handler.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-import dayjs from "@calcom/dayjs";
-import { sendFeedbackEmail } from "@calcom/emails";
-import { sendFeedbackFormbricks } from "@calcom/lib/formbricks";
-import { prisma } from "@calcom/prisma";
-import type { TrpcSessionUser } from "@calcom/trpc/server/types";
-
-import type { TSubmitFeedbackInputSchema } from "./submitFeedback.schema";
-
-type SubmitFeedbackOptions = {
- ctx: {
- user: NonNullable<TrpcSessionUser>;
- };
- input: TSubmitFeedbackInputSchema;
-};
-
-export const submitFeedbackHandler = async ({ ctx, input }: SubmitFeedbackOptions) => {
- const { rating, comment } = input;
-
- const feedback = {
- username: ctx.user.username || "Nameless",
- email: ctx.user.email || "No email address",
- rating: rating,
- comment: comment,
- };
-
- await prisma.feedback.create({
- data: {
- date: dayjs().toISOString(),
- userId: ctx.user.id,
- rating: rating,
- comment: comment,
- },
- });
- if (process.env.NEXT_PUBLIC_FORMBRICKS_HOST_URL && process.env.NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID)
- sendFeedbackFormbricks(ctx.user.id, feedback);
-
- if (process.env.SEND_FEEDBACK_EMAIL && comment) sendFeedbackEmail(feedback);
-};
diff --git a/packages/trpc/server/routers/loggedInViewer/submitFeedback.schema.ts b/packages/trpc/server/routers/loggedInViewer/submitFeedback.schema.ts
deleted file mode 100644
index f56091c1abc..00000000000
--- a/packages/trpc/server/routers/loggedInViewer/submitFeedback.schema.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { z } from "zod";
-
-export const ZSubmitFeedbackInputSchema = z.object({
- rating: z.string(),
- comment: z.string(),
-});
-
-export type TSubmitFeedbackInputSchema = z.infer<typeof ZSubmitFeedbackInputSchema>;