Open History to see the last commit
1import { z } from 'zod'
2β
3export const itemSchema = z.object({
4 id: z.string(),
5 title: z.string(),
6 content: z.string().optional(),
7 order: z.coerce.number<number>(),
8 columnId: z.string().uuid(),
9 boardId: z.coerce.string<string>(),
10})
11β
12export const columnSchema = z.object({
13 id: z.string().uuid(),
14 boardId: z.coerce.string<string>(),
15 name: z.string(),
16 order: z.number(),
17})
18β
19export const boardSchema = z.object({
20 id: z.coerce.string<string>(),
21 name: z.string(),
22 color: z.string(),
23 columns: z.array(columnSchema),
24 items: z.array(itemSchema),
25})
26β
27export const updateBoardSchema = boardSchema.partial().required({ id: true })
28β
29export const updateColumnSchema = columnSchema.partial().required({
30 id: true,
31 boardId: true,
32})
33β
34export const deleteItemSchema = itemSchema.pick({ id: true, boardId: true })
35export const newColumnSchema = columnSchema.omit({ order: true, id: true })
36export const deleteColumnSchema = columnSchema.pick({ boardId: true, id: true })
37β
38export type Board = z.infer<typeof boardSchema>
39export type Column = z.infer<typeof columnSchema>
40export type Item = z.infer<typeof itemSchema>