Skip to content

Commit

Permalink
regions_geom -> generic.regions_geom
Browse files Browse the repository at this point in the history
  • Loading branch information
jairomr authored Sep 11, 2024
1 parent bff4790 commit 0250377
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/server/database/queries/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
Expand Down
14 changes: 7 additions & 7 deletions src/server/database/queries/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}]
}
Expand Down
4 changes: 2 additions & 2 deletions src/server/database/queries/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
{
Expand Down

0 comments on commit 0250377

Please sign in to comment.