controllers/api.js
function checkIfSentvaluesAreSufficient(req,dbField) {
    if(dbField.Default == 'FILE') {
        //For 'File' fields just return the link ot the file
        if(req.files.hasOwnProperty(dbField.Field)) {

            var file = req.files[dbField.Field].hasOwnProperty('name') ? req.files[dbField.Field] : req.files[dbField.Field][0];

            if(settings.maxFileSize !== -1 && file.size > settings.maxFileSize) {
                return false;
            }

            return file.name;

        } else {
            return false;
        }
    } else {
        if (req.body[dbField.Field] === null || typeof req.body[dbField.Field] == "undefined") {
            return dbField.Null == "YES" ? null : false;
        }
        //Normle Werte
        if((dbField.Type.indexOf("int") != -1 || dbField.Type.indexOf("float") != -1 || dbField.Type.indexOf("double") != -1 )) {
            return !isNaN(req.body[dbField.Field]) ? req.body[dbField.Field] : false;
        } else if(typeof req.body[dbField.Field] === 'string') {
            return escape(req.body[dbField.Field]);
        }
        return false;
    }
}
function checkIfSentvaluesAreSufficient(req,dbField) {
    if(dbField.Default == 'FILE') {
        //For 'File' fields just return the link ot the file
        if(req.files.hasOwnProperty(dbField.Field)) {

            var file = req.files[dbField.Field].hasOwnProperty('name') ? req.files[dbField.Field] : req.files[dbField.Field][0];

            if(settings.maxFileSize !== -1 && file.size > settings.maxFileSize) {
                return false;
            }

            return file.name;

        } else {
            return false;
        }
    } else {
        if (req.body[dbField.Field] === null || typeof req.body[dbField.Field] == "undefined") {
            return dbField.Null == "YES" ? null : false;
        }
        //Normle Werte
        if((dbField.Type.indexOf("int") != -1 || dbField.Type.indexOf("float") != -1 || dbField.Type.indexOf("double") != -1 )) {
            return !isNaN(req.body[dbField.Field]) ? req.body[dbField.Field] : false;
        } else if(typeof req.body[dbField.Field] === 'string') {
            return escape(req.body[dbField.Field]);
        }
        return false;
    }
}
function checkIfSentvaluesAreSufficient ( req , dbField ) { if ( dbField . Default == 'FILE' ) { //For 'File' fields just return the link ot the file if ( req . files . hasOwnProperty ( dbField . Field ) ) { var file = req . files [ dbField . Field ] . hasOwnProperty ( 'name' ) ? req . files [ dbField . Field ] : req . files [ dbField . Field ] [ 0 ] ; if ( settings . maxFileSize !== - 1 && file . size > settings . maxFileSize ) { return false ; } return file . name ; } else { return false ; } } else { if ( req . body [ dbField . Field ] === null || typeof req . body [ dbField . Field ] == "undefined" ) { return dbField . Null == "YES" ? null : false ; } //Normle Werte if ( ( dbField . Type . indexOf ( "int" ) != - 1 || dbField . Type . indexOf ( "float" ) != - 1 || dbField . Type . indexOf ( "double" ) != - 1 ) ) { return ! isNaN ( req . body [ dbField . Field ] ) ? req . body [ dbField . Field ] : false ; } else if ( typeof req . body [ dbField . Field ] === 'string' ) { return escape ( req . body [ dbField . Field ] ) ; } return false ; } }
Check roughly if the provided value is sufficient for the database field
@param req
@param dbField
@returns {*}
Check roughly if the provided value is sufficient for the database field