File size: 946 Bytes
a6fbb8d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import joi from 'joi';
import { userBaseValidation } from '../../../common/User/validation/user.baseValidation';

export class userValidation extends userBaseValidation {
    static loginValidation = {
        body: joi.object().required().keys({

            email: joi.string().required().email({ minDomainSegments: 2, tlds: { allow: ['com', 'net', 'org', 'eg', 'io'] } }).empty().messages({
                "string.email": "please enter a valid email",
                "any.required": "email must be entered",
                "string.empty": "email can not be empty"
            }),
            password: joi.string().empty().min(8).required().messages({
                "string.base": "please enter a valid password",
                "any.required": "password must be entered",
                "string.empty": "password cannot be empty",
                "string.min": "password must be at least 8 characters"
            })
        })
    }
}