Normalize build filter value

Seems like for some reason I see error logs about lowercase
at_least? Not sure why but it's not hard to deal with it
This commit is contained in:
Kalle 2023-07-29 09:55:30 +03:00
parent d3fcb5d769
commit 3e2f7f48d3

View File

@ -4,7 +4,11 @@ import { ability, safeJSONParse } from "~/utils/zod";
const buildFilterSchema = z.object({
ability,
value: z.union([z.number(), z.boolean()]),
comparison: z.enum(["AT_LEAST", "AT_MOST"]).nullish(),
comparison: z
.string()
.toUpperCase()
.pipe(z.enum(["AT_LEAST", "AT_MOST"]))
.nullish(),
});
export const buildFiltersSearchParams = z.preprocess(