@golemio/parkings 1.13.6-dev.1450936865 → 1.13.6-dev.1452701867

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ INSERT INTO parkings_secondary (id,"source",source_id,data_provider,"name",category,date_modified,address,"location",area_served,total_spot_number,create_batch_id,created_at,created_by,update_batch_id,updated_at,updated_by,tariff_id,valid_from,valid_to,parking_type,zone_type,centroid,"security",max_vehicle_dimensions,covered,contact,parking_policy) VALUES
2
+ ('osm-w_28161149','osm','w_28161149','www.openstreetmap.org',NULL,NULL,'2024-09-08 16:00:09.371+02',NULL,'SRID=4326;MULTIPOLYGON (((14.4475389 50.100533, 14.4475305 50.1004522, 14.4475252 50.1003825, 14.4494002 50.100328, 14.4494082 50.100544, 14.4484037 50.1005766, 14.4483993 50.1005134, 14.4483498 50.1005145, 14.4475389 50.100533)))',NULL,NULL,NULL,'2024-04-30 16:37:42.099+02',NULL,NULL,'2024-09-08 16:00:10.035+02',NULL,NULL,NULL,NULL,'surface',NULL,'SRID=4326;POINT (14.4484667 50.1004523)',false,NULL,NULL,NULL,'commercial');
3
+
4
+ INSERT INTO parkings_location (id,"source",source_id,data_provider,"location",centroid,address,total_spot_number,create_batch_id,created_at,created_by,update_batch_id,updated_at,updated_by,special_access) VALUES
5
+ ('osm-w_28161149','osm','w_28161149','www.openstreetmap.org','SRID=4326;MULTIPOLYGON (((14.4475389 50.100533, 14.4475305 50.1004522, 14.4475252 50.1003825, 14.4494002 50.100328, 14.4494082 50.100544, 14.4484037 50.1005766, 14.4483993 50.1005134, 14.4483498 50.1005145, 14.4475389 50.100533)))','SRID=4326;POINT (14.4484667 50.1004523)',NULL,60,NULL,'2024-04-30 16:37:51.074+02',NULL,NULL,'2024-09-08 16:00:41.645+02',NULL,NULL);
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ var dbm;
4
+ var type;
5
+ var seed;
6
+ var fs = require('fs');
7
+ var path = require('path');
8
+ var Promise;
9
+
10
+ /**
11
+ * We receive the dbmigrate dependency from dbmigrate initially.
12
+ * This enables us to not have to rely on NODE_PATH.
13
+ */
14
+ exports.setup = function(options, seedLink) {
15
+ dbm = options.dbmigrate;
16
+ type = dbm.dataType;
17
+ seed = seedLink;
18
+ Promise = options.Promise;
19
+ };
20
+
21
+ exports.up = function(db) {
22
+ var filePath = path.join(__dirname, 'sqls', '20240912091523-alter-filtered-locations-up.sql');
23
+ return new Promise( function( resolve, reject ) {
24
+ fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
25
+ if (err) return reject(err);
26
+ console.log('received data: ' + data);
27
+
28
+ resolve(data);
29
+ });
30
+ })
31
+ .then(function(data) {
32
+ return db.runSql(data);
33
+ });
34
+ };
35
+
36
+ exports.down = function(db) {
37
+ var filePath = path.join(__dirname, 'sqls', '20240912091523-alter-filtered-locations-down.sql');
38
+ return new Promise( function( resolve, reject ) {
39
+ fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
40
+ if (err) return reject(err);
41
+ console.log('received data: ' + data);
42
+
43
+ resolve(data);
44
+ });
45
+ })
46
+ .then(function(data) {
47
+ return db.runSql(data);
48
+ });
49
+ };
50
+
51
+ exports._meta = {
52
+ "version": 1
53
+ };
@@ -0,0 +1,26 @@
1
+ CREATE OR REPLACE VIEW v_parkings_filtered AS
2
+ SELECT
3
+ *
4
+ FROM
5
+ ONLY parkings p1
6
+ UNION
7
+ ALL
8
+ SELECT
9
+ *
10
+ FROM
11
+ parkings_secondary p2
12
+ WHERE
13
+ p2.id NOT IN (
14
+ SELECT
15
+ DISTINCT p2.id
16
+ FROM
17
+ ONLY parkings p1
18
+ INNER JOIN parkings_secondary p2 ON ST_Intersects(p1.sanitized_location, p2.sanitized_location)
19
+ );
20
+
21
+ DROP INDEX parkings_secondary_sanitized_location_idx;
22
+
23
+ DROP INDEX parkings_location_sanitized_location_idx;
24
+
25
+ ALTER TABLE
26
+ parkings_location DROP COLUMN sanitized_locations;
@@ -0,0 +1,27 @@
1
+ ALTER TABLE
2
+ parkings_location
3
+ ADD
4
+ sanitized_locations geometry GENERATED ALWAYS AS (st_makevalid("location", 'method=structure')) STORED;
5
+
6
+ CREATE INDEX parkings_secondary_sanitized_location_idx ON parkings_secondary USING gist(sanitized_location);
7
+
8
+ CREATE INDEX parkings_location_sanitized_location_idx ON parkings_location USING gist(sanitized_locations);
9
+
10
+ CREATE OR REPLACE VIEW v_parkings_filtered as WITH parkings_loc as (
11
+ select coalesce(p.id, pl.id) as id, coalesce(pl.sanitized_locations, p.sanitized_location) as location from ONLY parkings p
12
+ left join parkings_location pl
13
+ on p.id = pl.id)
14
+ SELECT
15
+ *
16
+ FROM
17
+ ONLY parkings p
18
+ UNION
19
+ ALL
20
+ SELECT
21
+ *
22
+ FROM
23
+ ONLY parkings_secondary ps
24
+ where ps.id not in (
25
+ select distinct ps.id
26
+ from parkings_loc plo
27
+ inner join parkings_secondary ps on ST_Intersects(plo.location, ps.sanitized_location));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/parkings",
3
- "version": "1.13.6-dev.1450936865",
3
+ "version": "1.13.6-dev.1452701867",
4
4
  "description": "Golemio Parkings Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",