| 1 | import { z } from '@chatapp/common'; |
| 2 | |
| 3 | export const createMessageBodySchema = z.object({ |
| 4 | body: z.string().min(1).max(2000), |
| 5 | }); |
| 6 | |
| 7 | export const listMessagesQuerySchema = z.object({ |
| 8 | limit: z |
| 9 | .preprocess( |
| 10 | (value) => (value === undefined ? undefined : Number(value)), |
| 11 | z.number().int().min(1).max(200), |
| 12 | ) |
| 13 | .optional(), |
| 14 | after: z.string().datetime().optional(), |
| 15 | }); |