@golemio/energetics 1.4.3-dev.1393228263 → 1.4.3-rc.1417628927

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.
Files changed (29) hide show
  1. package/db/migrations/postgresql/sqls/20230116095151-correct_v_energetis_upadate-down.sql +27 -27
  2. package/db/migrations/postgresql/sqls/20230116095151-correct_v_energetis_upadate-up.sql +28 -28
  3. package/db/migrations/postgresql/sqls/20230202122506-v_energetics_last_updates-down.sql +64 -64
  4. package/db/migrations/postgresql/sqls/20230202122506-v_energetics_last_updates-up.sql +168 -168
  5. package/db/migrations/postgresql/sqls/20230208144859-v_energetics_last_updates_corr-down.sql +50 -50
  6. package/db/migrations/postgresql/sqls/20230208144859-v_energetics_last_updates_corr-up.sql +51 -51
  7. package/db/migrations/postgresql/sqls/20230216151258-new_views_out_of_prague-down.sql +461 -461
  8. package/db/migrations/postgresql/sqls/20230216151258-new_views_out_of_prague-up.sql +464 -464
  9. package/db/migrations/postgresql/sqls/20230220063725-another_view_out_of_prague_-down.sql +126 -126
  10. package/db/migrations/postgresql/sqls/20230220063725-another_view_out_of_prague_-up.sql +127 -127
  11. package/db/migrations/postgresql/sqls/20230220132403-v_gas_reserve_correct-down.sql +111 -111
  12. package/db/migrations/postgresql/sqls/20230220132403-v_gas_reserve_correct-up.sql +110 -110
  13. package/dist/integration-engine/commodity-providers/ioc/Di.js +1 -1
  14. package/dist/integration-engine/commodity-providers/ioc/Di.js.map +1 -1
  15. package/dist/output-gateway/routers/v2/V2BuildingsRouter.d.ts +1 -0
  16. package/dist/output-gateway/routers/v2/V2BuildingsRouter.js +3 -2
  17. package/dist/output-gateway/routers/v2/V2BuildingsRouter.js.map +1 -1
  18. package/dist/output-gateway/routers/v2/V2DevicesRouter.d.ts +4 -1
  19. package/dist/output-gateway/routers/v2/V2DevicesRouter.js +11 -7
  20. package/dist/output-gateway/routers/v2/V2DevicesRouter.js.map +1 -1
  21. package/dist/output-gateway/routers/v2/V2MeasurementsRouter.d.ts +4 -1
  22. package/dist/output-gateway/routers/v2/V2MeasurementsRouter.js +12 -8
  23. package/dist/output-gateway/routers/v2/V2MeasurementsRouter.js.map +1 -1
  24. package/dist/output-gateway/routers/v2/V2OrganizationsRouter.d.ts +4 -1
  25. package/dist/output-gateway/routers/v2/V2OrganizationsRouter.js +11 -7
  26. package/dist/output-gateway/routers/v2/V2OrganizationsRouter.js.map +1 -1
  27. package/docs/index.md +3 -0
  28. package/docs/openapi-output.yaml +175 -127
  29. package/package.json +3 -3
@@ -1,50 +1,50 @@
1
- CREATE OR REPLACE VIEW v_consumption_energy_missing_devices_last_update_prague_10
2
- AS WITH missing_devices_last_update AS (
3
- SELECT replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) AS addr,
4
- "left"(consumption_energy_consumption.addr::text, "position"("right"(consumption_energy_consumption.addr::text, length(consumption_energy_consumption.addr::text) - 1), '/'::text)) AS building_code,
5
- max(consumption_energy_consumption.time_utc) AS last_update
6
- FROM consumption_energy_consumption
7
- WHERE NOT (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) IN ( SELECT
8
- CASE
9
- WHEN consumption_energy_devices.addr::text !~~ '/%'::text THEN ('/'::text || consumption_energy_devices.addr::text)::character varying
10
- ELSE consumption_energy_devices.addr
11
- END AS addr
12
- FROM consumption_energy_devices))
13
- GROUP BY (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text)), consumption_energy_consumption.addr
14
- ), missing_devices_last_not_zero AS (
15
- SELECT replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) AS addr,
16
- max(consumption_energy_consumption.time_utc) AS last_not_zero_value
17
- FROM consumption_energy_consumption
18
- WHERE consumption_energy_consumption.value > 0::numeric AND NOT (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) IN ( SELECT
19
- CASE
20
- WHEN consumption_energy_devices.addr::text !~~ '/%'::text THEN ('/'::text || consumption_energy_devices.addr::text)::character varying
21
- ELSE consumption_energy_devices.addr
22
- END AS addr
23
- FROM consumption_energy_devices))
24
- GROUP BY consumption_energy_consumption.addr, (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text))
25
- ), buildings_mapping AS (
26
- SELECT DISTINCT
27
- CASE
28
- WHEN d.addr::text !~~ '/%'::text THEN '/'::text || "left"(d.addr::text, "position"("right"(d.addr::text, length(d.addr::text) - 1), '/'::text))
29
- ELSE "left"(d.addr::text, "position"("right"(d.addr::text, length(d.addr::text) - 1), '/'::text))
30
- END AS building_code,
31
- b.building_name
32
- FROM consumption_energy_devices d
33
- JOIN consumption_energy_buildings b ON d.building_id = b.id
34
- WHERE b.building_address_code::text ~~ '10.%'::text
35
- )
36
- SELECT bm.building_name,
37
- lu.last_update,
38
- lu.addr,
39
- CASE
40
- WHEN lnz.last_not_zero_value = lu.last_update THEN NULL::timestamp without time zone
41
- ELSE lnz.last_not_zero_value
42
- END AS zero_values_after
43
- FROM missing_devices_last_update lu
44
- JOIN buildings_mapping bm ON lu.building_code =
45
- CASE
46
- WHEN bm.building_code !~~ '/%'::text THEN '/'::text || bm.building_code
47
- ELSE bm.building_code
48
- END
49
- LEFT JOIN missing_devices_last_not_zero lnz ON lu.addr = lnz.addr;
50
-
1
+ CREATE OR REPLACE VIEW v_consumption_energy_missing_devices_last_update_prague_10
2
+ AS WITH missing_devices_last_update AS (
3
+ SELECT replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) AS addr,
4
+ "left"(consumption_energy_consumption.addr::text, "position"("right"(consumption_energy_consumption.addr::text, length(consumption_energy_consumption.addr::text) - 1), '/'::text)) AS building_code,
5
+ max(consumption_energy_consumption.time_utc) AS last_update
6
+ FROM consumption_energy_consumption
7
+ WHERE NOT (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) IN ( SELECT
8
+ CASE
9
+ WHEN consumption_energy_devices.addr::text !~~ '/%'::text THEN ('/'::text || consumption_energy_devices.addr::text)::character varying
10
+ ELSE consumption_energy_devices.addr
11
+ END AS addr
12
+ FROM consumption_energy_devices))
13
+ GROUP BY (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text)), consumption_energy_consumption.addr
14
+ ), missing_devices_last_not_zero AS (
15
+ SELECT replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) AS addr,
16
+ max(consumption_energy_consumption.time_utc) AS last_not_zero_value
17
+ FROM consumption_energy_consumption
18
+ WHERE consumption_energy_consumption.value > 0::numeric AND NOT (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) IN ( SELECT
19
+ CASE
20
+ WHEN consumption_energy_devices.addr::text !~~ '/%'::text THEN ('/'::text || consumption_energy_devices.addr::text)::character varying
21
+ ELSE consumption_energy_devices.addr
22
+ END AS addr
23
+ FROM consumption_energy_devices))
24
+ GROUP BY consumption_energy_consumption.addr, (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text))
25
+ ), buildings_mapping AS (
26
+ SELECT DISTINCT
27
+ CASE
28
+ WHEN d.addr::text !~~ '/%'::text THEN '/'::text || "left"(d.addr::text, "position"("right"(d.addr::text, length(d.addr::text) - 1), '/'::text))
29
+ ELSE "left"(d.addr::text, "position"("right"(d.addr::text, length(d.addr::text) - 1), '/'::text))
30
+ END AS building_code,
31
+ b.building_name
32
+ FROM consumption_energy_devices d
33
+ JOIN consumption_energy_buildings b ON d.building_id = b.id
34
+ WHERE b.building_address_code::text ~~ '10.%'::text
35
+ )
36
+ SELECT bm.building_name,
37
+ lu.last_update,
38
+ lu.addr,
39
+ CASE
40
+ WHEN lnz.last_not_zero_value = lu.last_update THEN NULL::timestamp without time zone
41
+ ELSE lnz.last_not_zero_value
42
+ END AS zero_values_after
43
+ FROM missing_devices_last_update lu
44
+ JOIN buildings_mapping bm ON lu.building_code =
45
+ CASE
46
+ WHEN bm.building_code !~~ '/%'::text THEN '/'::text || bm.building_code
47
+ ELSE bm.building_code
48
+ END
49
+ LEFT JOIN missing_devices_last_not_zero lnz ON lu.addr = lnz.addr;
50
+
@@ -1,51 +1,51 @@
1
- DROP VIEW v_consumption_energy_missing_devices_last_update_prague_10;
2
-
3
- CREATE OR REPLACE VIEW v_consumption_energy_missing_devices_last_update_prague_10
4
- AS WITH missing_devices_last_update AS (
5
- SELECT replace(replace(replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text), '/NT'::text, '-NT'::text), '/VT'::text, '-VT'::text) AS addr,
6
- "left"(consumption_energy_consumption.addr::text, "position"("right"(consumption_energy_consumption.addr::text, length(consumption_energy_consumption.addr::text) - 1), '/'::text)) AS building_code,
7
- max(consumption_energy_consumption.time_utc) AS last_update
8
- FROM energetics.consumption_energy_consumption
9
- WHERE NOT (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) IN ( SELECT
10
- CASE
11
- WHEN consumption_energy_devices.addr::text !~~ '/%'::text THEN ('/'::text || consumption_energy_devices.addr::text)::character varying
12
- ELSE consumption_energy_devices.addr
13
- END AS addr
14
- FROM consumption_energy_devices))
15
- GROUP BY (replace(replace(replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text), '/NT'::text, '-NT'::text), '/VT'::text, '-VT'::text)), ("left"(consumption_energy_consumption.addr::text, "position"("right"(consumption_energy_consumption.addr::text, length(consumption_energy_consumption.addr::text) - 1), '/'::text)))
16
- ), missing_devices_last_not_zero AS (
17
- SELECT replace(replace(replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text), '/NT'::text, '-NT'::text), '/VT'::text, '-VT'::text) AS addr,
18
- max(consumption_energy_consumption.time_utc) AS last_not_zero_value
19
- FROM consumption_energy_consumption
20
- WHERE consumption_energy_consumption.value > 0::numeric AND NOT (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) IN ( SELECT
21
- CASE
22
- WHEN consumption_energy_devices.addr::text !~~ '/%'::text THEN ('/'::text || consumption_energy_devices.addr::text)::character varying
23
- ELSE consumption_energy_devices.addr
24
- END AS addr
25
- FROM consumption_energy_devices))
26
- GROUP BY (replace(replace(replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text), '/NT'::text, '-NT'::text), '/VT'::text, '-VT'::text))
27
- ), buildings_mapping AS (
28
- SELECT DISTINCT "left"(d.addr::text, "position"("right"(d.addr::text, length(d.addr::text) - 1), '/'::text)) AS building_code,
29
- b.building_name,
30
- b.id,
31
- d.building_id
32
- FROM consumption_energy_devices d
33
- JOIN consumption_energy_buildings b ON d.building_id = b.id
34
- WHERE b.building_address_code::text ~~ '10.%'::text
35
- )
36
- SELECT bm.building_name,
37
- lu.last_update,
38
- lu.addr,
39
- CASE
40
- WHEN lnz.last_not_zero_value = lu.last_update THEN NULL::timestamp without time zone
41
- ELSE lnz.last_not_zero_value
42
- END AS zero_values_after
43
- FROM missing_devices_last_update lu
44
- JOIN buildings_mapping bm ON lu.building_code =
45
- CASE
46
- WHEN bm.building_code !~~ '/%'::text THEN '/'::text || bm.building_code
47
- ELSE bm.building_code
48
- END
49
- LEFT JOIN missing_devices_last_not_zero lnz ON lu.addr = lnz.addr;
50
-
51
-
1
+ DROP VIEW v_consumption_energy_missing_devices_last_update_prague_10;
2
+
3
+ CREATE OR REPLACE VIEW v_consumption_energy_missing_devices_last_update_prague_10
4
+ AS WITH missing_devices_last_update AS (
5
+ SELECT replace(replace(replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text), '/NT'::text, '-NT'::text), '/VT'::text, '-VT'::text) AS addr,
6
+ "left"(consumption_energy_consumption.addr::text, "position"("right"(consumption_energy_consumption.addr::text, length(consumption_energy_consumption.addr::text) - 1), '/'::text)) AS building_code,
7
+ max(consumption_energy_consumption.time_utc) AS last_update
8
+ FROM energetics.consumption_energy_consumption
9
+ WHERE NOT (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) IN ( SELECT
10
+ CASE
11
+ WHEN consumption_energy_devices.addr::text !~~ '/%'::text THEN ('/'::text || consumption_energy_devices.addr::text)::character varying
12
+ ELSE consumption_energy_devices.addr
13
+ END AS addr
14
+ FROM consumption_energy_devices))
15
+ GROUP BY (replace(replace(replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text), '/NT'::text, '-NT'::text), '/VT'::text, '-VT'::text)), ("left"(consumption_energy_consumption.addr::text, "position"("right"(consumption_energy_consumption.addr::text, length(consumption_energy_consumption.addr::text) - 1), '/'::text)))
16
+ ), missing_devices_last_not_zero AS (
17
+ SELECT replace(replace(replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text), '/NT'::text, '-NT'::text), '/VT'::text, '-VT'::text) AS addr,
18
+ max(consumption_energy_consumption.time_utc) AS last_not_zero_value
19
+ FROM consumption_energy_consumption
20
+ WHERE consumption_energy_consumption.value > 0::numeric AND NOT (replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text) IN ( SELECT
21
+ CASE
22
+ WHEN consumption_energy_devices.addr::text !~~ '/%'::text THEN ('/'::text || consumption_energy_devices.addr::text)::character varying
23
+ ELSE consumption_energy_devices.addr
24
+ END AS addr
25
+ FROM consumption_energy_devices))
26
+ GROUP BY (replace(replace(replace(consumption_energy_consumption.addr::text, concat('/', consumption_energy_consumption.var), ''::text), '/NT'::text, '-NT'::text), '/VT'::text, '-VT'::text))
27
+ ), buildings_mapping AS (
28
+ SELECT DISTINCT "left"(d.addr::text, "position"("right"(d.addr::text, length(d.addr::text) - 1), '/'::text)) AS building_code,
29
+ b.building_name,
30
+ b.id,
31
+ d.building_id
32
+ FROM consumption_energy_devices d
33
+ JOIN consumption_energy_buildings b ON d.building_id = b.id
34
+ WHERE b.building_address_code::text ~~ '10.%'::text
35
+ )
36
+ SELECT bm.building_name,
37
+ lu.last_update,
38
+ lu.addr,
39
+ CASE
40
+ WHEN lnz.last_not_zero_value = lu.last_update THEN NULL::timestamp without time zone
41
+ ELSE lnz.last_not_zero_value
42
+ END AS zero_values_after
43
+ FROM missing_devices_last_update lu
44
+ JOIN buildings_mapping bm ON lu.building_code =
45
+ CASE
46
+ WHEN bm.building_code !~~ '/%'::text THEN '/'::text || bm.building_code
47
+ ELSE bm.building_code
48
+ END
49
+ LEFT JOIN missing_devices_last_not_zero lnz ON lu.addr = lnz.addr;
50
+
51
+