@golemio/waze-tt 1.1.4-dev.815779080 → 1.1.4-dev.818981879

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,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', '20230323114749-pp20230323-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', '20230323114749-pp20230323-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,2 @@
1
+ drop VIEW analytic.v_sck_route_live;
2
+ drop VIEW analytic.v_sck_route_details;
@@ -0,0 +1,63 @@
1
+ -- pavelp.v_sck_route_details source
2
+
3
+ CREATE OR REPLACE VIEW analytic.v_sck_route_details
4
+ AS
5
+ SELECT DISTINCT
6
+ ON ((wazett_routes.name::json ->> 'project'::text), (wazett_routes.name::json ->> 'route number'::text), (wazett_routes.name::json ->> 'dir'::text)) wazett_routes.id,
7
+ wazett_routes.name::json ->> 'name'::text AS name ,
8
+ false AS section ,
9
+ CASE
10
+ WHEN
11
+ (wazett_routes.name::json ->> 'dir'::text) = 'Tam'::text
12
+ THEN
13
+ false
14
+ ELSE
15
+ true
16
+ END AS reverse_direction,
17
+ wazett_routes.from_name ,
18
+ wazett_routes.to_name ,
19
+ wazett_routes.name::json ->> 'route number'::text AS poradi
20
+ FROM
21
+ wazett.wazett_routes
22
+ WHERE
23
+ wazett_routes.feed_id = 7
24
+ AND wazett_routes.name ~~ '{%'::text
25
+ AND (
26
+ wazett_routes.name::json ->> 'project'::text) = 'IPR SčK'::text
27
+ ORDER BY
28
+ (wazett_routes.name::json ->> 'project'::text) ,
29
+ (wazett_routes.name::json ->> 'route number'::text),
30
+ (wazett_routes.name::json ->> 'dir'::text) ,
31
+ wazett_routes.created_at DESC;
32
+
33
+
34
+
35
+
36
+ -- v_sck_route_live source
37
+
38
+ CREATE OR REPLACE VIEW analytic.v_sck_route_live
39
+ AS
40
+ SELECT
41
+ wrl.route_id ,
42
+ wrl.update_time ,
43
+ wrl."time" ,
44
+ wrl.length ,
45
+ wrl.historic_time ,
46
+ wrl.jam_level ,
47
+ wrl.create_batch_id,
48
+ wrl.created_at ,
49
+ wrl.created_by ,
50
+ wrl.update_batch_id,
51
+ wrl.updated_at ,
52
+ wrl.updated_by
53
+ FROM
54
+ wazett.wazett_route_lives wrl
55
+ WHERE
56
+ (
57
+ wrl.route_id IN
58
+ (
59
+ SELECT DISTINCT
60
+ vsrd.id
61
+ FROM
62
+ analytic.v_sck_route_details vsrd))
63
+ AND wrl.update_time::double precision >= (date_part('epoch'::text, CURRENT_DATE - '7 days'::interval) * 1000::double precision);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/waze-tt",
3
- "version": "1.1.4-dev.815779080",
3
+ "version": "1.1.4-dev.818981879",
4
4
  "description": "Golemio Waze TT Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",