correct log stmt and add route

This commit is contained in:
Trowbridge 2019-03-22 04:49:35 -04:00
parent a8f8a8cffb
commit c85994b606

View File

@ -348,7 +348,49 @@ server.post('/new_part', bodyParser.json(), function (req, res) {
res.send("no body was sent"); res.send("no body was sent");
return; return;
} }
console.log("--------------------scale volume & price:-------------------"); console.log("--------------------new part:-------------------");
console.log(req.body);
//console.log(args);
sql = sql.replace(new RegExp("where_clause",'g'),w);
sql = sql.replace(new RegExp("target_vol",'g'),req.body.qty);
sql = sql.replace(new RegExp("target_prc",'g'),req.body.amount);
sql = sql.replace(new RegExp("replace_request",'g'),JSON.stringify(req.body));
sql = sql.replace(new RegExp("replace_version",'g'),req.body.scenario.version);
sql = sql.replace(new RegExp("replace_source",'g'),req.body.source);
sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body));
console.log(sql);
Postgres.FirstRow(sql,[],res)
}
fs.readFile(path, 'utf8', function(err, data){
if (!err){
callback(data);
} else {
console.log("fatal error pulling sql file")
callback(err);
}
});
})
server.post('/new_basket', bodyParser.json(), function (req, res) {
var sql = "";
var w = "";
var c = 1;
var d = 1;
var args = [];
var path = './route_sql/new_basket.sql';
var callback = function(arg){
sql = arg;
({ c, w, d } = build_where(req, c, w, d, args));
if (c == 1) {
res.send("no body was sent");
return;
}
console.log("--------------------new basket:-------------------");
console.log(req.body); console.log(req.body);
//console.log(args); //console.log(args);
sql = sql.replace(new RegExp("where_clause",'g'),w); sql = sql.replace(new RegExp("where_clause",'g'),w);