We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5eabe56 commit dd4f981Copy full SHA for dd4f981
packages-v1/api-v1/trpc/utils/pagination.ts
@@ -2,16 +2,16 @@ import {z} from 'zod'
2
import {Column, desc, schema} from '@openint/db'
3
4
export const zListParams = z.object({
5
- limit: z.number().optional(),
6
- offset: z.number().optional(),
+ limit: z.number().int().positive().max(100).optional(),
+ offset: z.number().int().nonnegative().optional(),
7
})
8
9
export function zListResponse<T extends z.ZodTypeAny>(itemSchema: T) {
10
return z.object({
11
items: z.array(itemSchema),
12
total: z.number(),
13
- limit: z.number(),
14
- offset: z.number(),
+ limit: z.number().int().positive().max(100),
+ offset: z.number().int().nonnegative(),
15
16
}
17
export function applyPaginationAndOrder<
0 commit comments