게시물과 페이지 공개 상태 확장 v1.5.4
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import { z } from 'zod'
|
||||
import { normalizeMarkdownContent } from '../../lib/markdown-content-normalizer.js'
|
||||
import { pageStatusSchema } from './content-schema.js'
|
||||
|
||||
export const adminPageInputSchema = z.object({
|
||||
title: z.string().trim().min(1),
|
||||
slug: z.string().trim().min(1).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),
|
||||
renderMode: z.enum(['markdown', 'html_document']).default('html_document'),
|
||||
status: pageStatusSchema.default('published'),
|
||||
content: z.string().default(''),
|
||||
featuredImage: z.string().trim().nullable().default(null)
|
||||
}).transform((input) => ({
|
||||
|
||||
@@ -18,7 +18,7 @@ export const adminPostInputSchema = z.object({
|
||||
canonicalUrl: z.string().trim().url().or(z.literal('')).default(''),
|
||||
noindex: z.boolean().default(false),
|
||||
ogImage: z.string().trim().nullable().default(null),
|
||||
status: z.preprocess((val) => (val === 'private' ? 'draft' : val), postStatusSchema).default('draft'),
|
||||
status: postStatusSchema.default('draft'),
|
||||
publishedAt: z.string().datetime().nullable().default(null),
|
||||
tags: z.array(z.string().trim().min(1)).default([])
|
||||
})
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const postStatusSchema = z.enum(['published', 'draft'])
|
||||
export const postStatusSchema = z.enum(['published', 'draft', 'members', 'private'])
|
||||
export const pageStatusSchema = z.enum(['published', 'draft', 'private'])
|
||||
|
||||
export const postSchema = z.object({
|
||||
id: z.string().uuid(),
|
||||
@@ -29,6 +30,7 @@ export const pageSchema = z.object({
|
||||
slug: z.string().min(1),
|
||||
content: z.string(),
|
||||
renderMode: z.enum(['markdown', 'html_document']).default('markdown'),
|
||||
status: pageStatusSchema.default('published'),
|
||||
featuredImage: z.string().nullable().default(null),
|
||||
createdAt: z.string(),
|
||||
updatedAt: z.string()
|
||||
|
||||
Reference in New Issue
Block a user