1
- const joi = require ( 'joi' )
1
+ const joi = require ( 'joi' ) ;
2
2
3
3
const createUser = async ( req , res , next ) => {
4
4
const schema = joi . object ( ) . keys ( {
5
- phone_number : joi . string ( ) . optional ( ) ,
5
+ phone : joi . string ( ) . optional ( ) ,
6
6
email : joi . string ( ) . optional ( ) ,
7
7
company_name : joi . string ( ) . optional ( ) ,
8
8
username : joi . string ( ) . optional ( ) ,
@@ -21,20 +21,20 @@ const createUser = async (req, res, next) => {
21
21
isMember : joi . boolean ( ) . optional ( ) ,
22
22
tokens : joi . object ( ) . optional ( ) ,
23
23
website : joi . string ( ) . optional ( )
24
- } )
24
+ } ) ;
25
25
26
26
try {
27
- await schema . validateAsync ( req . body )
28
- next ( )
27
+ await schema . validateAsync ( req . body ) ;
28
+ next ( ) ;
29
29
} catch ( error ) {
30
- logger . error ( `Error validating createUser payload : ${ error } ` )
31
- res . boom . badRequest ( error . details [ 0 ] . message )
30
+ logger . error ( `Error validating createUser payload : ${ error } ` ) ;
31
+ res . boom . badRequest ( error . details [ 0 ] . message ) ;
32
32
}
33
- }
33
+ } ;
34
34
35
35
const updateUser = async ( req , res , next ) => {
36
36
const schema = joi . object ( ) . keys ( {
37
- phone_number : joi . string ( ) . optional ( ) ,
37
+ phone : joi . string ( ) . optional ( ) ,
38
38
email : joi . string ( ) . optional ( ) ,
39
39
company_name : joi . string ( ) . optional ( ) ,
40
40
username : joi . string ( ) . optional ( ) ,
@@ -53,18 +53,18 @@ const updateUser = async (req, res, next) => {
53
53
isMember : joi . boolean ( ) . optional ( ) ,
54
54
tokens : joi . object ( ) . optional ( ) ,
55
55
website : joi . string ( ) . optional ( )
56
- } )
56
+ } ) ;
57
57
58
58
try {
59
- await schema . validateAsync ( req . body )
60
- next ( )
59
+ await schema . validateAsync ( req . body ) ;
60
+ next ( ) ;
61
61
} catch ( error ) {
62
- logger . error ( `Error validating updateUser payload : ${ error } ` )
63
- res . boom . badRequest ( error . details [ 0 ] . message )
62
+ logger . error ( `Error validating updateUser payload : ${ error } ` ) ;
63
+ res . boom . badRequest ( error . details [ 0 ] . message ) ;
64
64
}
65
- }
65
+ } ;
66
66
67
67
module . exports = {
68
68
createUser,
69
69
updateUser
70
- }
70
+ } ;
0 commit comments