From 001b55ff821b549be7bc22058ded25c541fb2acd Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Wed, 4 Jul 2018 16:32:59 -0400 Subject: [PATCH] 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) {