index.js
function initBLModel(soajs, cb) {
    let modelName = driverConfig.model;
    if (soajs.servicesConfig && soajs.servicesConfig.model) {
        modelName = soajs.servicesConfig.model;
    }
    if (process.env.SOAJS_TEST && soajs.inputmaskData && soajs.inputmaskData.model) {
        modelName = soajs.inputmaskData.model;
    }

    let modelPath = __dirname + "/model/" + modelName + ".js";
    return requireModel(modelPath, cb);

    /**
     * checks if model file exists, requires it and returns it.
     * @param filePath
     * @param cb
     */
    function requireModel(filePath, cb) {
        //check if file exist. if not return error
        fs.exists(filePath, function (exists) {
            if (!exists) {
                soajs.log.error('Requested Model Not Found!');
                return cb(601);
            }

            driver.model = require(filePath);
            return cb();
        });
    }

}
function initBLModel(soajs, cb) {
    let modelName = driverConfig.model;
    if (soajs.servicesConfig && soajs.servicesConfig.model) {
        modelName = soajs.servicesConfig.model;
    }
    if (process.env.SOAJS_TEST && soajs.inputmaskData && soajs.inputmaskData.model) {
        modelName = soajs.inputmaskData.model;
    }

    let modelPath = __dirname + "/model/" + modelName + ".js";
    return requireModel(modelPath, cb);

    /**
     * checks if model file exists, requires it and returns it.
     * @param filePath
     * @param cb
     */
    function requireModel(filePath, cb) {
        //check if file exist. if not return error
        fs.exists(filePath, function (exists) {
            if (!exists) {
                soajs.log.error('Requested Model Not Found!');
                return cb(601);
            }

            driver.model = require(filePath);
            return cb();
        });
    }

}
function initBLModel ( soajs , cb ) { let modelName = driverConfig . model ; if ( soajs . servicesConfig && soajs . servicesConfig . model ) { modelName = soajs . servicesConfig . model ; } if ( process . env . SOAJS_TEST && soajs . inputmaskData && soajs . inputmaskData . model ) { modelName = soajs . inputmaskData . model ; } let modelPath = __dirname + "/model/" + modelName + ".js" ; return requireModel ( modelPath , cb ) ; /**
     * checks if model file exists, requires it and returns it.
     * @param filePath
     * @param cb
     */ function requireModel ( filePath , cb ) { //check if file exist. if not return error fs . exists ( filePath , function ( exists ) { if ( ! exists ) { soajs . log . error ( 'Requested Model Not Found!' ) ; return cb ( 601 ) ; } driver . model = require ( filePath ) ; return cb ( ) ; } ) ; } }
Initialize the Business Logic model and set it on driver
Initialize the Business Logic model and set it on driver