diff --git a/server.js b/server.js index 5693f9a..95677dc 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 @@ -86,6 +86,11 @@ server.get("/unmapped_all", function (inReq, inRes) server.get("/unmapped", function (inReq, inRes) { var sql = "SELECT jsonb_agg(row_to_json(x)::jsonb) regex FROM tps.report_unmapped($1::text) x"; + +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); }); @@ -122,6 +127,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) {