-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaddBot.validations.ts
More file actions
32 lines (31 loc) · 1.3 KB
/
addBot.validations.ts
File metadata and controls
32 lines (31 loc) · 1.3 KB
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
import * as yup from 'yup'
export const ADD_BOT_SCHEMA = yup.object({
name: yup.string().required('Name is required').min(3, 'Minimum 3 characters').max(128, 'Maximum 128 characters'),
isAutoPublished: yup.boolean().optional(),
installLink: yup
.string()
.required('Install Link is required')
.url('Invalid URL')
.test('url-length', 'URL is too long', (val) => val.length <= 2082),
headline: yup
.string()
.required('Headline is required')
.min(50, 'Minimum 50 characters')
.max(510, 'Maximum 510 characters'),
description: yup.string().required('Full Description is required'),
prefix: yup.string().required('Prefix is required').min(1, 'Minimum 1 characters').max(10, 'Maximum 10 characters'),
featuredImage: yup.string().optional(),
supportUrl: yup
.string()
.required('Support URL is required')
.url('Invalid URL')
.test('url-length', 'URL is too long', (val) => val.length <= 2082),
remark: yup.string().optional(),
tagIds: yup.array().of(yup.string().required()).min(1, 'At least one tag is required').strict().defined(),
socialLinks: yup.array().of(
yup.object().shape({
url: yup.string().test('url-length', 'URL is too long', (val) => (val || "").length <= 2082),
linkTypeId: yup.string().required('Link Type is required')
})
)
})