25 lines
648 B
TypeScript
25 lines
648 B
TypeScript
import { z } from 'zod';
|
|
|
|
export const DocumentTypeSchema = z.enum(['legal', 'treaty', 'finance', 'history']);
|
|
|
|
export const DocumentSchema = z.object({
|
|
id: z.string().uuid(),
|
|
title: z.string().min(1),
|
|
type: DocumentTypeSchema,
|
|
content: z.string().optional(),
|
|
fileUrl: z.string().url().optional(),
|
|
createdAt: z.date().or(z.string().datetime()),
|
|
updatedAt: z.date().or(z.string().datetime()),
|
|
});
|
|
|
|
export type Document = z.infer<typeof DocumentSchema>;
|
|
|
|
export const CreateDocumentSchema = DocumentSchema.omit({
|
|
id: true,
|
|
createdAt: true,
|
|
updatedAt: true,
|
|
});
|
|
|
|
export type CreateDocument = z.infer<typeof CreateDocumentSchema>;
|
|
|