Files
cms.fellies.org/packages/content/src/index.ts
2026-02-10 01:25:57 +01:00

24 lines
585 B
TypeScript

import { z } from "zod"
export const postStatusSchema = z.enum(["draft", "published"])
export const postSchema = z.object({
id: z.string().uuid(),
title: z.string().min(3).max(180),
slug: z.string().min(3).max(180),
excerpt: z.string().max(320).optional(),
body: z.string().min(1),
status: postStatusSchema,
createdAt: z.date(),
updatedAt: z.date(),
})
export const upsertPostSchema = postSchema.omit({
id: true,
createdAt: true,
updatedAt: true,
})
export type Post = z.infer<typeof postSchema>
export type UpsertPostInput = z.infer<typeof upsertPostSchema>