Initial commit
This commit is contained in:
29
packages/marketing-pages/src/entities/models/page.ts
Normal file
29
packages/marketing-pages/src/entities/models/page.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const pageStatusSchema = z.enum(["draft", "published"]);
|
||||
|
||||
export const heroSchema = z.object({
|
||||
heading: z.string().min(1).max(255),
|
||||
subheading: z.string().optional(),
|
||||
imageId: z.string().optional(),
|
||||
});
|
||||
|
||||
export const pageSchema = z.object({
|
||||
id: z.string(),
|
||||
title: z.string().min(1).max(255),
|
||||
slug: z.string().min(1).max(255),
|
||||
hero: heroSchema,
|
||||
layout: z.array(z.unknown()),
|
||||
status: pageStatusSchema.default("draft"),
|
||||
publishedAt: z.date().nullable().default(null),
|
||||
seo: z.object({
|
||||
title: z.string().min(1),
|
||||
description: z.string().optional(),
|
||||
}),
|
||||
createdAt: z.date(),
|
||||
updatedAt: z.date(),
|
||||
});
|
||||
|
||||
export type Page = z.infer<typeof pageSchema>;
|
||||
export type PageStatus = z.infer<typeof pageStatusSchema>;
|
||||
export type Hero = z.infer<typeof heroSchema>;
|
||||
Reference in New Issue
Block a user