update for new loading function in the DB

This commit is contained in:
Paul Trowbridge 2018-12-19 00:34:01 -05:00
parent f332fe84ff
commit a7f2e1781f

View File

@ -61,11 +61,8 @@ server.post("/source_single", bodyParser.json(), function (inReq, inRes)// remov
server.post("/source", bodyParser.json(), function (inReq, inRes)// remove body parsing, just pass post body to the sql string build server.post("/source", bodyParser.json(), function (inReq, inRes)// remove body parsing, just pass post body to the sql string build
{ {
x = inReq.body; x = inReq.body;
var sql = "SELECT\ var sql = "SELECT x.message FROM tps.srce_overwrite_all($1::jsonb) x(message)";
jsonb_agg(jsonb_build_object('name',d.def->>'name')||x.message) top_message \ console.log(JSON.stringify(inReq.body));
FROM\
jsonb_array_elements($1::jsonb) d(def)\
JOIN LATERAL tps.srce_set(d.def) x(message) ON TRUE";
Postgres.FirstRow(sql,[JSON.stringify(inReq.body)], inRes); Postgres.FirstRow(sql,[JSON.stringify(inReq.body)], inRes);
}); });