From 5c89910cb0dd0415dfb97d6147d10b25722ff94a Mon Sep 17 00:00:00 2001 From: fleetside72 Date: Tue, 4 Sep 2018 15:06:27 -0400 Subject: [PATCH] add nodes --- server.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 1824b8b..5693f9a 100644 --- a/server.js +++ b/server.js @@ -27,7 +27,7 @@ var Postgres = new pg.Client({ host: process.env.host, port: process.env.port, database: process.env.database, - ssl: true, + ssl: false, application_name: "tps_etl_api" }); Postgres.FirstRow = function(inSQL,args, inResponse) @@ -76,12 +76,19 @@ server.post("/regex", bodyParser.json(), function (inReq, inRes) //------------------------------------------------------------mappings--------------------------------------------------------------------------------------------------------------------------------- //list unmapped items flagged to be mapped ?srce= -server.get("/unmapped", function (inReq, inRes) +server.get("/unmapped_all", function (inReq, inRes) { var sql = "SELECT jsonb_agg(row_to_json(x)::jsonb) regex FROM tps.report_unmapped_recs($1::text) x"; Postgres.FirstRow(sql,[inReq.query.srce], inRes); }); +//list unmapped items flagged to be mapped ?srce= +server.get("/unmapped", function (inReq, inRes) +{ + var sql = "SELECT jsonb_agg(row_to_json(x)::jsonb) regex FROM tps.report_unmapped($1::text) x"; + Postgres.FirstRow(sql,[inReq.query.srce], inRes); +}); + //add entries to lookup table server.post("/mapping", bodyParser.json(), function (inReq, inRes) { @@ -89,6 +96,14 @@ server.post("/mapping", bodyParser.json(), function (inReq, inRes) Postgres.FirstRow(sql,[JSON.stringify( inReq.body)], inRes); }); +//---------------------------------------------------------list imports-------------------------------------------------------------------------------------------------------------------------------- + +server.get("/import_log", function (inReq, inRes) +{ + var sql = "SELECT jsonb_agg(row_to_json(l)::jsonb) regex FROM tps.trans_log l"; + Postgres.FirstRow(sql,[], inRes); +}); + //-------------------------------------------------------------import data-----------------------------------------------------------------------------------------------------------------------------