Some checks failed
Test and deploy staging / staging (push) Failing after 1m39s
24 lines
491 B
TypeScript
24 lines
491 B
TypeScript
import * as z from 'zod';
|
|
|
|
export const createArticleSchema = z.object({
|
|
title: z.string().min(1).max(256)
|
|
});
|
|
|
|
export const updateArticleSchema = z.object({
|
|
title: z.string().min(1).max(256),
|
|
slug: z.string().min(1).max(120),
|
|
content: z.string().max(50000),
|
|
tags: z.array(z.string().min(1).max(32)).max(8)
|
|
});
|
|
|
|
export function parseArticleTags(value: string) {
|
|
return [
|
|
...new Set(
|
|
value
|
|
.split(',')
|
|
.map((tag) => tag.trim().toLowerCase())
|
|
.filter(Boolean)
|
|
)
|
|
];
|
|
}
|