update
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import vine from '@vinejs/vine'
|
||||
import { jsonObjectSchema } from '#validators/schemas/json_object_schema'
|
||||
|
||||
export const createCustomFieldValidator = vine.compile(
|
||||
vine.object({
|
||||
entity_type: vine.literal('contact'),
|
||||
name: vine.string().trim().minLength(1),
|
||||
key: vine
|
||||
.string()
|
||||
.trim()
|
||||
.minLength(1)
|
||||
.regex(/^[a-z][a-z0-9_]*$/),
|
||||
field_type: vine.enum(['text', 'number', 'boolean', 'date', 'select'] as const),
|
||||
required: vine.boolean().optional(),
|
||||
options: jsonObjectSchema.optional(),
|
||||
})
|
||||
)
|
||||
Reference in New Issue
Block a user