Initial commit
This commit is contained in:
23
packages/content/src/index.ts
Normal file
23
packages/content/src/index.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
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>
|
||||
Reference in New Issue
Block a user