mlm binary tree logic
Refferal.js const connection = require ( '../database' ); const shortid = require ( 'shortid' ); exports . generateShortUniqueId = () => { const id = shortid . generate (); return id ; } function checkTree ( array ) { let hasZero = false ; let hasOne = false ; for ( const item of array ) { if ( item . side === 0 ) { hasZero = true ; } else if ( item . side === 1 ) { hasOne = true ; } } if ( hasZero && hasOne ) { return true ; } else if ( hasZero ) { return "addtoright" ; } else { return "addtoleft" ; } } exports . getRefferal = ( refferalid ) => { try { ...