-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathschema.zod.ts
61 lines (57 loc) · 1.56 KB
/
schema.zod.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { z } from 'zod';
import type { Database } from './database.types';
export type eventsInsertType = Database['public']['Tables']['events']['Insert'];
export type typeformInsertType =
Database['public']['Tables']['eventsregistrations']['Insert'];
export const eventsInsertSchema = z.object({
banner_image: z.string(),
description: z.string(),
end_date: z.string(),
event_type: z.enum(['online', 'offline', 'hybrid']).nullable().optional(),
is_featured: z.boolean().nullable().optional(),
more_info: z.string().nullable().optional(),
publish_date: z.string(),
rules: z.string().nullable().optional(),
slug: z.string().optional(),
start_date: z.string(),
tags: z.array(z.string()),
title: z.string(),
typeform_config: z.any(),
venue: z.string(),
});
export const typeformFieldSchema = z.object({
fieldType: z.enum([
'text',
'radio',
'select',
'slider',
'checkbox',
'date',
'textarea',
]),
label: z.string(),
name: z.string(),
description: z.string().optional(),
required: z.boolean().optional(),
options: z.array(z.string()).optional(),
min: z.number().optional(),
max: z.number().optional(),
validation: z
.object({
min: z.number().optional(),
max: z.number().optional(),
minLength: z.number().optional(),
maxLength: z.number().optional(),
pattern: z.string().optional(),
})
.optional(),
checkboxType: z.enum(['single', 'multiple']).optional(),
items: z
.array(
z.object({
id: z.string(),
label: z.string(),
})
)
.optional(),
});