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-----------------------------------------------------------------------------------------------------------------------------