@@ -63,7 +63,7 @@ export default async function createClients(req: Request<any>, res: Response<any
6363 ( usr . firstname === undefined || typeof usr . firstname === 'string' ) &&
6464 ( usr . institution === undefined || typeof usr . institution === 'string' ) &&
6565 ( usr . priority === undefined || typeof usr . priority === 'string' ) &&
66- ( usr . firstIntegration === undefined || ! isNaN ( parseInt ( usr . firstIntegration ) ) ) &&
66+ ( usr . firstIntegration === undefined || ! isNaN ( new Date ( usr . firstIntegration ) . getTime ( ) ) ) &&
6767 ( usr . integrationReason === undefined || typeof usr . integrationReason === 'string' )
6868 ) ;
6969 } ) ;
@@ -147,8 +147,7 @@ export default async function createClients(req: Request<any>, res: Response<any
147147 const date = new Date ( usr . firstIntegration || '' ) ;
148148 return isNaN ( date . getTime ( ) ) ? Date . now ( ) : date . getTime ( ) ;
149149 } ) ( ) ,
150- integrationReason :
151- sanitizeString ( usr . integrationReason || '' ) ?? sanitizeString ( req . body . defaultReason )
150+ integrationReason : sanitizeString ( usr . integrationReason || req . body . defaultReason || '' )
152151 } ,
153152 { $push : { campaigns : campaign . _id } }
154153 ) ;
@@ -165,13 +164,12 @@ export default async function createClients(req: Request<any>, res: Response<any
165164 const date = new Date ( usr . firstIntegration || '' ) ;
166165 return isNaN ( date . getTime ( ) ) ? Date . now ( ) : date . getTime ( ) ;
167166 } ) ( ) ,
168- integrationReason :
169- sanitizeString ( usr . integrationReason || '' ) ?? sanitizeString ( req . body . defaultReason )
167+ integrationReason : sanitizeString ( usr . integrationReason || req . body . defaultReason || '' )
170168 }
171169 ) ;
172170 }
173171 } catch ( error : any ) {
174- errors . push ( [ usr . name || '' + ' ' + usr . firstname || '' , phone , error . message ] ) ;
172+ errors . push ( [ ( usr . name || '' ) + ' ' + ( usr . firstname || '' ) , phone , error . message ] ) ;
175173 }
176174 }
177175 ) ;
0 commit comments