added tons of features
This commit is contained in:
26
lib/schemas/admin/category.ts
Normal file
26
lib/schemas/admin/category.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import {z} from 'zod'
|
||||
|
||||
import {db} from '@/lib/db/prisma/client'
|
||||
|
||||
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)
|
||||
})
|
||||
Reference in New Issue
Block a user