From 75ac01bb8880d0688cd6eda9d31dec72afb032e6 Mon Sep 17 00:00:00 2001 From: unrenamed Date: Tue, 8 Oct 2024 19:40:33 +0300 Subject: [PATCH] fix(dashboard): update feedback message for minimum length requirement Update Zod schema to specify that feedback must contain at least 20 characters. --- apps/dashboard/components/dashboard/feedback-component.tsx | 2 +- apps/dashboard/lib/trpc/routers/plain.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/dashboard/components/dashboard/feedback-component.tsx b/apps/dashboard/components/dashboard/feedback-component.tsx index 0cc2984377..dddf351c78 100644 --- a/apps/dashboard/components/dashboard/feedback-component.tsx +++ b/apps/dashboard/components/dashboard/feedback-component.tsx @@ -48,7 +48,7 @@ export const Feedback: React.FC = ({ variant, FeedbackOpen }) => const schema = z.object({ severity: z.enum(["p0", "p1", "p2", "p3"]), issueType: z.enum(["bug", "feature", "security", "payment", "question"]), - message: z.string(), + message: z.string().min(20, 'Feedback must contain at least 20 characters'), }); const form = useForm>({ diff --git a/apps/dashboard/lib/trpc/routers/plain.ts b/apps/dashboard/lib/trpc/routers/plain.ts index 2e67379998..b52f4f13d0 100644 --- a/apps/dashboard/lib/trpc/routers/plain.ts +++ b/apps/dashboard/lib/trpc/routers/plain.ts @@ -12,7 +12,9 @@ export const createPlainIssue = rateLimitedProcedure(ratelimit.create) z.object({ issueType, severity, - message: z.string(), + message: z + .string() + .min(20, 'Feedback must contain at least 20 characters'), }), ) .mutation(async ({ input, ctx }) => {