-
Notifications
You must be signed in to change notification settings - Fork 0
/
validation.js
52 lines (22 loc) · 1.1 KB
/
validation.js
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
const joi=require("joi");
const registerValidation=(data)=>{
const Schema=joi.object({
name:joi.string().required().min(2).max(10),
//email: joi.string().email().required(),
email:joi.string().email({ minDomainSegments: 2, tlds: { allow: ['com', 'net'] } }).required(),
//repeat_email: joi.ref('email'),
mobile:joi.number().integer().min(1000000000).max(9999999999).required(),
password: joi.string().required().min(5).max(8)
})
return Schema.validate(data);
}
const loginValidation=(data)=>{
const Schema=joi.object({
email: joi.string().email().required(),
// email:joi.string().email({ minDomainSegments: 2, tlds: { allow: ['com', 'net'] } }).required(),
password: joi.string().required().min(5).max(8)
})
return Schema.validate(data);
}
module.exports.loginValidation=loginValidation;
module.exports.registerValidation = registerValidation;