From bce39c6df5c84c874e528cb73813de8c88e118b8 Mon Sep 17 00:00:00 2001 From: SeanCassiere <33615041+SeanCassiere@users.noreply.github.com> Date: Mon, 24 Jun 2024 09:18:53 +1200 Subject: [PATCH] feat: coerce numbers for search params --- src/routers/v2/logging/schemas.ts | 4 ++-- src/routers/v2/services/schemas.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/routers/v2/logging/schemas.ts b/src/routers/v2/logging/schemas.ts index 1eeb39e..9c3e757 100644 --- a/src/routers/v2/logging/schemas.ts +++ b/src/routers/v2/logging/schemas.ts @@ -42,8 +42,8 @@ export const getLogsFiltersSchema = z.object({ lookup: f.lookupFilterValue.optional(), environment: f.environment.optional(), sort: z.enum(["ASC", "DESC"]).default("DESC"), - page: z.number().min(1).default(1), - page_size: z.number().min(1).default(50), + page: z.coerce.number().min(1).default(1), + page_size: z.coerce.number().min(1).default(50), level: f.levelWithAll, }); diff --git a/src/routers/v2/services/schemas.ts b/src/routers/v2/services/schemas.ts index 17b9e4c..93483dd 100644 --- a/src/routers/v2/services/schemas.ts +++ b/src/routers/v2/services/schemas.ts @@ -15,8 +15,8 @@ const f = { export const createServiceSchema = z.object({}); export const getServiceFiltersSchema = z.object({ - page: z.number().min(1).default(1), - page_size: z.number().min(1).default(50), + page: z.coerce.number().min(1).default(1), + page_size: z.coerce.number().min(1).default(50), }); const serviceOutput = z.object({