diff --git a/src/server/database/queries/example.js b/src/server/database/queries/example.js index e4c59f8..fcc2afe 100755 --- a/src/server/database/queries/example.js +++ b/src/server/database/queries/example.js @@ -22,9 +22,9 @@ module.exports = function(app) { mantain: true }, { - source: 'general', + source: 'lapig', id: 'teste', - sql: "SELECT * from regions_geom LIMIT ${amount}", + sql: "SELECT * from generic.regions_geom LIMIT ${amount}", mantain: true } ] diff --git a/src/server/database/queries/map.js b/src/server/database/queries/map.js index 870be0c..eed1e81 100755 --- a/src/server/database/queries/map.js +++ b/src/server/database/queries/map.js @@ -10,22 +10,22 @@ module.exports = function (app) { Query.extent = function (params) { return [{ - source: 'general', + source: 'lapig', id: 'extent', - sql: "SELECT geom_json as geojson FROM regions_geom WHERE type=${type} AND unaccent(value) ilike unaccent(${key}) LIMIT 1", + sql: "SELECT geom_json as geojson FROM generic.regions_geom WHERE type=${type} AND unaccent(value) ilike unaccent(${key}) LIMIT 1", mantain: true }] } Query.search = function () { return [{ - source: 'general', + source: 'lapig', id: 'search', sql: "With priority_search AS (" - + " SELECT distinct concat_ws(' - ', text , uf) as text, value, type, 1 AS priority FROM regions_geom " + + " SELECT distinct concat_ws(' - ', text , uf) as text, value, type, 1 AS priority FROM generic.regions_geom " + "WHERE unaccent(text) ILIKE unaccent(${key}) AND type NOT in ('country') " + "UNION ALL " - + "SELECT distinct concat_ws(' - ', text , uf) as text, value, type, 2 AS priority FROM regions_geom " + + "SELECT distinct concat_ws(' - ', text , uf) as text, value, type, 2 AS priority FROM generic.regions_geom " + "WHERE unaccent(text) ILIKE unaccent(${key}%) AND type NOT in ('country') ) " + "select * from priority_search order by priority asc limit 10", mantain: true @@ -35,9 +35,9 @@ module.exports = function (app) { Query.searchregion = function () { return [{ - source: 'general', + source: 'lapig', id: 'search', - sql: "SELECT text, value, type FROM regions_geom WHERE unaccent(value) ILIKE unaccent(${key}) AND type = (${type}) LIMIT 10", + sql: "SELECT text, value, type FROM generic.regions_geom WHERE unaccent(value) ILIKE unaccent(${key}) AND type = (${type}) LIMIT 10", mantain: true }] } diff --git a/src/server/database/queries/upload.js b/src/server/database/queries/upload.js index e9e9d1b..3c2191d 100755 --- a/src/server/database/queries/upload.js +++ b/src/server/database/queries/upload.js @@ -7,9 +7,9 @@ module.exports = function (app) { return [ { - source: 'general', + source: 'lapig', id: 'regions_pershape', - sql: "select s.text, s.type, s.value, s.uf from regions_geom s INNER JOIN upload_shapes up on ST_Intersects(up.geom, s.geom) where s.type not in ('fronteira', 'biome') AND up.token= ${token} order by 1 asc", + sql: "select s.text, s.type, s.value, s.uf from generic.regions_geom s INNER JOIN upload_shapes up on ST_Intersects(up.geom, s.geom) where s.type not in ('fronteira', 'biome') AND up.token= ${token} order by 1 asc", mantain: true }, {