▍ humdrum codex / soft
695 B raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { z } from "zod";

export const Todo = z.object({
  id: z.string(),
  title: z.string().min(1).max(280),
  done: z.boolean().default(false),
  due: z.string().datetime().nullable().default(null),
  createdAt: z.string().datetime(),
});
export type Todo = z.infer<typeof Todo>;

export const CreateTodo = z.object({
  title: z.string().min(1).max(280),
  due: z.string().datetime().nullable().optional(),
});
export type CreateTodo = z.infer<typeof CreateTodo>;

export const UpdateTodo = z.object({
  title: z.string().min(1).max(280).optional(),
  done: z.boolean().optional(),
  due: z.string().datetime().nullable().optional(),
});
export type UpdateTodo = z.infer<typeof UpdateTodo>;