25 lines
622 B
TypeScript
25 lines
622 B
TypeScript
import {z} from 'zod'
|
|
|
|
export const categoryLocaleSchema = z.object({
|
|
lang: z.enum(['uk', 'ru']),
|
|
title: z.string().trim().min(1).max(384),
|
|
/*.refine(async current => {
|
|
const count = await db.categoryLocale.count({
|
|
where: {
|
|
title: current
|
|
}
|
|
})
|
|
|
|
return count === 0
|
|
}, "Імя категорії вже існує")*/
|
|
// slug: z.string().trim().min(5, {
|
|
// message: 'slug_required'
|
|
// }),
|
|
short_title: z.string().trim().max(384).optional(),
|
|
description: z.string().trim().max(3840).optional()
|
|
})
|
|
|
|
export const createCategoryFormSchema = z.object({
|
|
locales: z.array(categoryLocaleSchema)
|
|
})
|