|
1 | 1 | import { z } from 'zod' |
2 | 2 | const Draft = z.object({ |
3 | | - title: z.string().max(48), |
4 | | - summary: z.string().max(255), |
5 | | - description: z.string().max(2048), |
6 | | - type: z.enum(['topic', 'project']), |
| 3 | + title: z.string().max(48).optional(), |
| 4 | + summary: z.string().max(255).optional(), |
| 5 | + description: z.string().max(2048).optional(), |
| 6 | + type: z.enum(['topic', 'project']).optional(), |
7 | 7 | id: z.number().int().positive(), |
8 | | - created: z.number().transform(val => new Date(val)), |
9 | | - updated: z.number().transform(val => new Date(val)).nullable(), |
| 8 | + created: z.string(), |
| 9 | + updated: z.string().nullable().optional(), |
10 | 10 | }) |
11 | 11 |
|
12 | 12 | type Draft = z.infer<typeof Draft> |
13 | 13 |
|
14 | 14 | const PendingDraft = z.object({ |
15 | | - title: z.string().max(48), |
16 | | - summary: z.string().max(255), |
17 | | - description: z.string().max(2048), |
18 | | - type: z.enum(['topic', 'project']), |
| 15 | + title: z.string().max(48).optional().nullable(), |
| 16 | + summary: z.string().max(255).optional().nullable(), |
| 17 | + description: z.string().max(2048).optional().nullable(), |
| 18 | + type: z.enum(['topic', 'project']).optional().nullable(), |
19 | 19 | }) |
20 | 20 |
|
21 | 21 | type PendingDraft = z.infer<typeof PendingDraft> |
|
0 commit comments