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

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: alex@cal.com <me@alexvanandel.com>
This commit is contained in:
devin-ai-integration[bot]andalex@cal.com authored and GitHub committed 2025-05-20 15:14:51 +01:00
1 parent 9e09066e99
commit 1740e34c79
3 files changed
-53

No files matched your search

@@ -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");
@@ -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);
};
@@ -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>;