From a2986f5904034c54f1e127291c70de1144a05f70 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Wed, 4 Jul 2018 16:05:16 -0400 Subject: [PATCH 1/2] new end point -> list import logs --- server.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server.js b/server.js index 1824b8b..b807f09 100644 --- a/server.js +++ b/server.js @@ -107,6 +107,14 @@ server.use("/import", upload.single('upload'), function (inReq, inRes) { } ); +//----------------------------------------------------------import_logs-------------------------------------------------------------------------------------------------------------------------------- + +server.get("/import_log", function (inReq, inRes) +{ + var sql = "SELECT jsonb_agg(info) info FROM tps.trans_log WHERE info @> $1::jsonb"; + Postgres.FirstRow(sql, [inReq.query], inRes); +}); + //-------------------------------------------------------------suggest source def---------------------------------------------------------------------------------------------------------------------- server.use("/csv_suggest", upload.single('upload'), function (inReq, inRes) { From 001b55ff821b549be7bc22058ded25c541fb2acd Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Wed, 4 Jul 2018 16:32:59 -0400 Subject: [PATCH 2/2] new end point -> mapping; mod regex list, specifiy source --- server.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index b807f09..6224641 100644 --- a/server.js +++ b/server.js @@ -62,8 +62,8 @@ server.post("/source", bodyParser.json(), function (inReq, inRes)// remove body //list all regex operations server.get("/regex", function (inReq, inRes) { - var sql = "SELECT jsonb_agg(regex) regex FROM tps.map_rm"; - Postgres.FirstRow(sql, [], inRes); + var sql = "SELECT jsonb_agg(regex) regex FROM tps.map_rm WHERE srce = $1::text"; + Postgres.FirstRow(sql, [inReq.query.srce], inRes); }); //set one or more map definitions @@ -82,6 +82,13 @@ server.get("/unmapped", function (inReq, inRes) Postgres.FirstRow(sql,[inReq.query.srce], inRes); }); +//list unmapped items flagged to be mapped ?srce= +server.get("/mapping", function (inReq, inRes) +{ + var sql = "SELECT jsonb_agg(row_to_json(x)::jsonb) regex FROM tps.map_rv x WHERE srce = $1::text"; + Postgres.FirstRow(sql,[inReq.query.srce], inRes); +}); + //add entries to lookup table server.post("/mapping", bodyParser.json(), function (inReq, inRes) {