backend: Validate maxItems to ensure it is a positive number and capped at 100

This commit is contained in:
Carlos Santos 2025-04-11 11:25:04 +02:00
parent 427e84de07
commit cb19aaf77f

View File

@ -99,9 +99,11 @@ const GetParticipantRoleSchema = z.object({
const GetRoomFiltersSchema: z.ZodType<MeetRoomFilters> = z.object({
maxItems: z.coerce
.number()
.positive('maxItems must be a positive number')
.transform((val) => {
// Convert the value to a number
const intVal = Math.floor(val);
// Ensure it's not greater than 100
return intVal > 100 ? 100 : intVal;
})
.default(10),