new end point -> mapping; mod regex list, specifiy source

This commit is contained in:
Paul Trowbridge 2018-07-04 16:32:59 -04:00
parent a2986f5904
commit 001b55ff82

View File

@ -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)
{