18 lines
490 B
TypeScript
18 lines
490 B
TypeScript
import { z } from "zod";
|
|
|
|
export const articleStatusSchema = z.enum(["draft", "published"]);
|
|
|
|
export const articleSchema = z.object({
|
|
id: z.string(),
|
|
title: z.string().min(1).max(255),
|
|
slug: z.string().min(1).max(255),
|
|
content: z.unknown(),
|
|
status: articleStatusSchema.default("draft"),
|
|
authorId: z.string(),
|
|
createdAt: z.date(),
|
|
updatedAt: z.date(),
|
|
});
|
|
|
|
export type Article = z.infer<typeof articleSchema>;
|
|
export type ArticleStatus = z.infer<typeof articleStatusSchema>;
|