Barazo AppView backend
barazo.forum
1import { z } from 'zod/v4'
2
3// ---------------------------------------------------------------------------
4// Query schemas
5// ---------------------------------------------------------------------------
6
7/** Schema for listing notifications with pagination. */
8export const notificationQuerySchema = z.object({
9 limit: z
10 .string()
11 .transform((val) => Number(val))
12 .pipe(z.number().int().min(1).max(100))
13 .optional()
14 .default(25),
15 cursor: z.string().optional(),
16 unreadOnly: z
17 .string()
18 .transform((val) => val === 'true')
19 .optional(),
20})
21
22export type NotificationQueryInput = z.infer<typeof notificationQuerySchema>
23
24// ---------------------------------------------------------------------------
25// Body schemas
26// ---------------------------------------------------------------------------
27
28/** Schema for marking notifications as read. */
29export const markReadSchema = z.object({
30 notificationId: z.number().int().positive().optional(),
31 all: z.boolean().optional(),
32})
33
34export type MarkReadInput = z.infer<typeof markReadSchema>