@golemio/parkings 1.7.10 → 1.7.11-dev.1187905601

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 (87) hide show
  1. package/db/example/00_clear_test_data.sql +1 -0
  2. package/db/example/04_tsk_parking_v2.sql +6 -0
  3. package/db/example/98_calculate_occupancy.sql +1 -0
  4. package/db/migrations/postgresql/20240205151926-average-occupancy.js +53 -0
  5. package/db/migrations/postgresql/sqls/20240205151926-average-occupancy-down.sql +3 -0
  6. package/db/migrations/postgresql/sqls/20240205151926-average-occupancy-up.sql +66 -0
  7. package/dist/integration-engine/ioc/Di.js +5 -1
  8. package/dist/integration-engine/ioc/Di.js.map +1 -1
  9. package/dist/integration-engine/ioc/ModuleContainerToken.d.ts +2 -0
  10. package/dist/integration-engine/ioc/ModuleContainerToken.js +4 -0
  11. package/dist/integration-engine/ioc/ModuleContainerToken.js.map +1 -1
  12. package/dist/integration-engine/repositories/AverageOccupancyRepository.d.ts +9 -0
  13. package/dist/integration-engine/repositories/AverageOccupancyRepository.js +41 -0
  14. package/dist/integration-engine/repositories/AverageOccupancyRepository.js.map +1 -0
  15. package/dist/integration-engine/workers/NewParkingsWorker.js +1 -0
  16. package/dist/integration-engine/workers/NewParkingsWorker.js.map +1 -1
  17. package/dist/integration-engine/workers/schemas/Smart4CityTaskTypeSchema.js.map +1 -1
  18. package/dist/integration-engine/workers/tasks/CalculateAverageOccupancyTask.d.ts +9 -0
  19. package/dist/integration-engine/workers/tasks/CalculateAverageOccupancyTask.js +57 -0
  20. package/dist/integration-engine/workers/tasks/CalculateAverageOccupancyTask.js.map +1 -0
  21. package/dist/output-gateway/controllers/v3/V3ParkingController.d.ts +5 -1
  22. package/dist/output-gateway/controllers/v3/V3ParkingController.js +19 -3
  23. package/dist/output-gateway/controllers/v3/V3ParkingController.js.map +1 -1
  24. package/dist/output-gateway/controllers/v3/V3ParkingMeasurementsController.d.ts +10 -0
  25. package/dist/output-gateway/controllers/v3/V3ParkingMeasurementsController.js +56 -0
  26. package/dist/output-gateway/controllers/v3/V3ParkingMeasurementsController.js.map +1 -0
  27. package/dist/output-gateway/data-access/ParkingAverageOccupancyRepository.d.ts +12 -0
  28. package/dist/output-gateway/data-access/ParkingAverageOccupancyRepository.js +87 -0
  29. package/dist/output-gateway/data-access/ParkingAverageOccupancyRepository.js.map +1 -0
  30. package/dist/output-gateway/data-access/ParkingLatestMeasurementRepository.d.ts +8 -0
  31. package/dist/output-gateway/data-access/ParkingLatestMeasurementRepository.js +72 -0
  32. package/dist/output-gateway/data-access/ParkingLatestMeasurementRepository.js.map +1 -0
  33. package/dist/output-gateway/data-access/ParkingMeasurementRepository.d.ts +6 -0
  34. package/dist/output-gateway/data-access/ParkingMeasurementRepository.js +33 -0
  35. package/dist/output-gateway/data-access/ParkingMeasurementRepository.js.map +1 -0
  36. package/dist/output-gateway/data-access/ParkingRepository.d.ts +6 -4
  37. package/dist/output-gateway/data-access/ParkingRepository.js +45 -4
  38. package/dist/output-gateway/data-access/ParkingRepository.js.map +1 -1
  39. package/dist/output-gateway/data-access/interfaces/IParkingMeasurementsDto.d.ts +4 -0
  40. package/dist/output-gateway/data-access/interfaces/IParkingMeasurementsDto.js +3 -0
  41. package/dist/output-gateway/data-access/interfaces/IParkingMeasurementsDto.js.map +1 -0
  42. package/dist/output-gateway/helpers/params/IParkingMeasurementsParams.d.ts +5 -0
  43. package/dist/output-gateway/helpers/params/IParkingMeasurementsParams.js +3 -0
  44. package/dist/output-gateway/helpers/params/IParkingMeasurementsParams.js.map +1 -0
  45. package/dist/output-gateway/index.js +3 -4
  46. package/dist/output-gateway/index.js.map +1 -1
  47. package/dist/output-gateway/ioc/Di.js +6 -0
  48. package/dist/output-gateway/ioc/Di.js.map +1 -1
  49. package/dist/output-gateway/ioc/ModuleContainerToken.d.ts +3 -0
  50. package/dist/output-gateway/ioc/ModuleContainerToken.js +3 -0
  51. package/dist/output-gateway/ioc/ModuleContainerToken.js.map +1 -1
  52. package/dist/output-gateway/routers/index.d.ts +1 -0
  53. package/dist/output-gateway/routers/index.js +1 -0
  54. package/dist/output-gateway/routers/index.js.map +1 -1
  55. package/dist/output-gateway/routers/v3/V3ParkingMeasurementsRouter.d.ts +3 -0
  56. package/dist/output-gateway/routers/v3/V3ParkingMeasurementsRouter.js +45 -0
  57. package/dist/output-gateway/routers/v3/V3ParkingMeasurementsRouter.js.map +1 -0
  58. package/dist/output-gateway/routers/v3/V3ParkingRouter.js +3 -2
  59. package/dist/output-gateway/routers/v3/V3ParkingRouter.js.map +1 -1
  60. package/dist/output-gateway/transformations/interfaces/v3/IV3ParkingMeasurementsDto.d.ts +15 -0
  61. package/dist/output-gateway/transformations/interfaces/v3/IV3ParkingMeasurementsDto.js +3 -0
  62. package/dist/output-gateway/transformations/interfaces/v3/IV3ParkingMeasurementsDto.js.map +1 -0
  63. package/dist/output-gateway/transformations/v3/ParkingDtoTransformation.d.ts +9 -4
  64. package/dist/output-gateway/transformations/v3/ParkingDtoTransformation.js +13 -0
  65. package/dist/output-gateway/transformations/v3/ParkingDtoTransformation.js.map +1 -1
  66. package/dist/output-gateway/transformations/v3/ParkingMeasurementDtoTransformation.d.ts +7 -0
  67. package/dist/output-gateway/transformations/v3/ParkingMeasurementDtoTransformation.js +27 -0
  68. package/dist/output-gateway/transformations/v3/ParkingMeasurementDtoTransformation.js.map +1 -0
  69. package/dist/schema-definitions/index.d.ts +5 -0
  70. package/dist/schema-definitions/index.js +5 -0
  71. package/dist/schema-definitions/index.js.map +1 -1
  72. package/dist/schema-definitions/models/ParkingAverageOccupancyModel.d.ts +15 -0
  73. package/dist/schema-definitions/models/ParkingAverageOccupancyModel.js +32 -0
  74. package/dist/schema-definitions/models/ParkingAverageOccupancyModel.js.map +1 -0
  75. package/dist/schema-definitions/models/ParkingMeasurementsModel.d.ts +15 -0
  76. package/dist/schema-definitions/models/ParkingMeasurementsModel.js +26 -0
  77. package/dist/schema-definitions/models/ParkingMeasurementsModel.js.map +1 -0
  78. package/dist/schema-definitions/models/interfaces/IParking.d.ts +2 -1
  79. package/dist/schema-definitions/models/interfaces/IParkingAverageOccupancy.d.ts +10 -0
  80. package/dist/schema-definitions/models/interfaces/IParkingAverageOccupancy.js +3 -0
  81. package/dist/schema-definitions/models/interfaces/IParkingAverageOccupancy.js.map +1 -0
  82. package/dist/schema-definitions/models/interfaces/IParkingMeasurements.d.ts +10 -0
  83. package/dist/schema-definitions/models/interfaces/IParkingMeasurements.js +3 -0
  84. package/dist/schema-definitions/models/interfaces/IParkingMeasurements.js.map +1 -0
  85. package/docs/implementation-documentation.md +30 -3
  86. package/docs/openapi-output.yaml +192 -27
  87. package/package.json +2 -2
@@ -221,15 +221,15 @@ paths:
221
221
  - name: minutesBefore
222
222
  in: query
223
223
  schema:
224
- type: integer
225
- example: 10
224
+ type: integer
225
+ example: 10
226
226
  description: 'Filter by time conditions based on last data update. By maximal minutes before last update.'
227
227
  - name: updatedSince
228
228
  in: query
229
229
  schema:
230
230
  type: string
231
231
  example: '2022-07-25T00:00:00.000Z'
232
- description: 'Filter by time conditions based on last data update. Date has to be in ISO8601 format. Cannot be used together with minutsBefore.'
232
+ description: 'Filter by time conditions based on last data update. Date has to be in ISO8601 format. Cannot be used together with minutesBefore.'
233
233
  responses:
234
234
  200:
235
235
  description: OK
@@ -330,15 +330,15 @@ paths:
330
330
  - name: minutesBefore
331
331
  in: query
332
332
  schema:
333
- type: integer
334
- example: 10
333
+ type: integer
334
+ example: 10
335
335
  description: 'Filter by time conditions based on last data update. By maximal minutes before last update.'
336
336
  - name: updatedSince
337
337
  in: query
338
338
  schema:
339
339
  type: string
340
340
  example: '2022-07-25T00:00:00.000Z'
341
- description: 'Filter by time conditions based on last data update. Date has to be in ISO8601 format. Cannot be used together with minutsBefore.'
341
+ description: 'Filter by time conditions based on last data update. Date has to be in ISO8601 format. Cannot be used together with minutesBefore.'
342
342
  - name: zoneType
343
343
  in: query
344
344
  description: Filter by parking zone. Use with square brackets `zoneType[]`,
@@ -457,15 +457,15 @@ paths:
457
457
  - name: minutesBefore
458
458
  in: query
459
459
  schema:
460
- type: integer
461
- example: 10
460
+ type: integer
461
+ example: 10
462
462
  description: 'Filter by time conditions based on last data update. By maximal minutes before last update.'
463
463
  - name: updatedSince
464
464
  in: query
465
465
  schema:
466
466
  type: string
467
467
  example: '2022-07-25T00:00:00.000Z'
468
- description: 'Filter by time conditions based on last data update. Date has to be in ISO8601 format. Cannot be used together with minutsBefore.'
468
+ description: 'Filter by time conditions based on last data update. Date has to be in ISO8601 format. Cannot be used together with minutesBefore.'
469
469
  responses:
470
470
  200:
471
471
  description: OK
@@ -577,7 +577,7 @@ paths:
577
577
  schema:
578
578
  type: string
579
579
  example: '50.123,14.243,50.017,14.573'
580
- description: 'Filter by bounding box in format "topLeft.lat,topLeft.lon,bottomRight.lat,bottomRight.lon", polygons that fit only partialy to selected bounding box are included'
580
+ description: 'Filter by bounding box in format "topLeft.lat,topLeft.lon,bottomRight.lat,bottomRight.lon", polygons that fit only partially to selected bounding box are included'
581
581
  - name: validFrom
582
582
  in: query
583
583
  schema:
@@ -602,20 +602,20 @@ paths:
602
602
  - designated
603
603
  - truck
604
604
  - motorcycle
605
- - RV
605
+ - RV
606
606
  description: 'Experimental: Filter by access combinations to specific spaces in parking. Return only strictly matched parking by access to parking spaces'
607
607
  - name: minutesBefore
608
608
  in: query
609
609
  schema:
610
- type: integer
611
- example: 10
610
+ type: integer
611
+ example: 10
612
612
  description: 'Filter by time conditions based on last data update. By maximal minutes before last update.'
613
613
  - name: updatedSince
614
614
  in: query
615
615
  schema:
616
616
  type: string
617
617
  example: '2022-07-25T00:00:00.000Z'
618
- description: 'Filter by time conditions based on last data update. Date has to be in ISO8601 format. Cannot be used together with minutsBefore.'
618
+ description: 'Filter by time conditions based on last data update. Date has to be in ISO8601 format. Cannot be used together with minutesBefore.'
619
619
  - name: limit
620
620
  in: query
621
621
  schema:
@@ -657,9 +657,8 @@ paths:
657
657
  required: true
658
658
  schema:
659
659
  type: string
660
- format: uuid
661
- example: 'c66bb668-eab6-49da-bc84-002263e1dce0'
662
- description: 'The UUID identifier of the parking location to retrieve'
660
+ example: 'tsk2-P1-0586'
661
+ description: 'The identifier of the parking location to retrieve'
663
662
  responses:
664
663
  '200':
665
664
  description: 'Successful response'
@@ -667,12 +666,117 @@ paths:
667
666
  application/json:
668
667
  schema:
669
668
  $ref: '#/components/schemas/Parking'
669
+ /v3/parking/{id}/average-occupancy:
670
+ get:
671
+ tags:
672
+ - 🅿️ Parking (v3)
673
+ summary: 'Get detailed information about the average occupancy by ID'
674
+ parameters:
675
+ - name: id
676
+ in: path
677
+ required: true
678
+ schema:
679
+ type: string
680
+ example: 'tsk2-P1-0586'
681
+ description: 'The identifier of the parking space to retrieve'
682
+ responses:
683
+ 200:
684
+ description: 'Successful response'
685
+ content:
686
+ application/json:
687
+ schema:
688
+ $ref: '#/components/schemas/AverageOccupancyWeek'
689
+ 401:
690
+ $ref: "#/components/responses/UnauthorizedError"
691
+ 404:
692
+ description: Not found
693
+ 400:
694
+ description: Bad request
695
+ content:
696
+ application/json; charset=utf-8:
697
+ schema:
698
+ type: object
699
+ properties:
700
+ error_message:
701
+ type: string
702
+ example: Bad request
703
+ error_status:
704
+ type: number
705
+ example: 400
706
+ error_info:
707
+ type: string
708
+ example: '{"limit":{"location":"query","param":"limit","value":"-2","msg":"Invalid value"}}'
709
+ /v3/parking-measurements:
710
+ get:
711
+ tags:
712
+ - 🅿️ Parking (v3)
713
+ summary: 'Get a list of the latest (max 1h old) parking measurements with filtering options'
714
+ parameters:
715
+ - name: primarySource
716
+ in: query
717
+ schema:
718
+ type: array
719
+ items:
720
+ type: string
721
+ enum:
722
+ - tsk_v2
723
+ description: 'Filter by primary source. Use with square brackets `primarySource[]`'
724
+ - name: primarySourceId
725
+ in: query
726
+ schema:
727
+ type: array
728
+ items:
729
+ type: string
730
+ example: 'c66bb668-eab6-49da-bc84-002263e1dce0'
731
+ description: 'Filter by primary source ID. Use with square brackets `primarySourceId[]`'
732
+ - name: limit
733
+ in: query
734
+ schema:
735
+ type: integer
736
+ default: 1000
737
+ maximum: 10000
738
+ minimum: 0
739
+ description: 'Number of results to return'
740
+ - name: offset
741
+ in: query
742
+ schema:
743
+ type: integer
744
+ default: 0
745
+ minimum: 0
746
+ description: 'Number of results to skip for pagination'
747
+ responses:
748
+ 200:
749
+ description: 'Successful response'
750
+ content:
751
+ application/json; charset=utf-8:
752
+ schema:
753
+ type: array
754
+ items:
755
+ $ref: '#/components/schemas/ParkingOccupancyMeasurement'
756
+ 401:
757
+ $ref: "#/components/responses/UnauthorizedError"
758
+ 400:
759
+ description: Bad request
760
+ content:
761
+ application/json; charset=utf-8:
762
+ schema:
763
+ type: object
764
+ properties:
765
+ error_message:
766
+ type: string
767
+ example: Bad request
768
+ error_status:
769
+ type: number
770
+ example: 400
771
+ error_info:
772
+ type: string
773
+ example: '{"limit":{"location":"query","param":"limit","value":"-2","msg":"Invalid value"}}'
670
774
  /v3/parking-tariffs:
671
775
  get:
672
776
  tags:
673
777
  - 🅿️ Parking (v3)
674
778
  summary: 'Get a list of tariffs with filtering options'
675
- parameters:
779
+ parameters:
676
780
  - name: primarySource
677
781
  in: query
678
782
  schema:
@@ -689,21 +793,21 @@ paths:
689
793
  schema:
690
794
  type: string
691
795
  example: '6c08e2f9-a884-4dce-81e3-00e3391f811a'
692
- description: 'Filter by primary source ID of ChargeBand in Tariff (result show all tariffs that contains atleast one ChargeBand with the selected primary sources id and inside only ChargeBand objects that fit into that filter)'
796
+ description: 'Filter by primary source ID of ChargeBand in Tariff (result show all tariffs that contains at least one ChargeBand with the selected primary sources id and inside only ChargeBand objects that fit into that filter)'
693
797
  - name: validFrom
694
798
  in: query
695
799
  schema:
696
800
  type: string
697
801
  format: date-time
698
802
  example: '2022-08-01T00:00:00.000Z'
699
- description: 'Filter by valid from date of ChargeBand in Tariff (result show all tariffs that contains atleast one valid ChargeBand and inside only ChargeBand objects that fit into that filter)'
803
+ description: 'Filter by valid from date of ChargeBand in Tariff (result show all tariffs that contains at least one valid ChargeBand and inside only ChargeBand objects that fit into that filter)'
700
804
  - name: validTo
701
805
  in: query
702
806
  schema:
703
807
  type: string
704
808
  format: date-time
705
809
  example: '2023-12-31T00:00:00.000Z'
706
- description: 'Filter by valid to date of ChargeBand in Tariff (result show all tariffs that contains atleast one valid ChargeBand and inside only ChargeBand objects that fit into that filter)'
810
+ description: 'Filter by valid to date of ChargeBand in Tariff (result show all tariffs that contains at least one valid ChargeBand and inside only ChargeBand objects that fit into that filter)'
707
811
  - name: limit
708
812
  in: query
709
813
  schema:
@@ -787,7 +891,7 @@ paths:
787
891
  schema:
788
892
  type: string
789
893
  example: '50.123,14.243,50.017,14.573'
790
- description: 'Filter by bounding box in format "topLeft.lat,topLeft.lon,bottomRight.lat,bottomRight.lon", polygons that fit only partialy to selected bounding box are included'
894
+ description: 'Filter by bounding box in format "topLeft.lat,topLeft.lon,bottomRight.lat,bottomRight.lon", polygons that fit only partially to selected bounding box are included'
791
895
  - name: codeMask
792
896
  in: query
793
897
  schema:
@@ -1064,7 +1168,7 @@ components:
1064
1168
  10:
1065
1169
  type: number
1066
1170
  example: 51
1067
- 51:
1171
+ 11:
1068
1172
  type: number
1069
1173
  example: 51
1070
1174
  12:
@@ -1103,6 +1207,25 @@ components:
1103
1207
  23:
1104
1208
  type: number
1105
1209
  example: 16
1210
+ AverageOccupancyWeek:
1211
+ type: object
1212
+ nullable: true
1213
+ properties:
1214
+ 0:
1215
+ $ref: '#/components/schemas/AverageOccupancyDay'
1216
+ 1:
1217
+ $ref: '#/components/schemas/AverageOccupancyDay'
1218
+ 2:
1219
+ $ref: '#/components/schemas/AverageOccupancyDay'
1220
+ 3:
1221
+ $ref: '#/components/schemas/AverageOccupancyDay'
1222
+ 4:
1223
+ $ref: '#/components/schemas/AverageOccupancyDay'
1224
+ 5:
1225
+ $ref: '#/components/schemas/AverageOccupancyDay'
1226
+ 6:
1227
+ $ref: '#/components/schemas/AverageOccupancyDay'
1228
+ description: "The day of the week (0 - 6; Sunday is 0)"
1106
1229
  ParkingLotHistory:
1107
1230
  type: object
1108
1231
  properties:
@@ -1550,7 +1673,7 @@ components:
1550
1673
  type: object
1551
1674
  properties:
1552
1675
  id:
1553
- type: string
1676
+ type: string
1554
1677
  description: 'The identifier for the parking location.'
1555
1678
  primary_source:
1556
1679
  type: string
@@ -1595,7 +1718,7 @@ components:
1595
1718
  description: 'Whether the parking location has security.'
1596
1719
  example: null
1597
1720
  dimensions:
1598
- $ref: '#/components/schemas/ParkingDimension'
1721
+ $ref: '#/components/schemas/ParkingDimension'
1599
1722
  covered:
1600
1723
  type: boolean
1601
1724
  nullable: true
@@ -1633,6 +1756,12 @@ components:
1633
1756
  type: string
1634
1757
  format: uuid
1635
1758
  description: 'UUID of related parking tariff.'
1759
+ has_measurement_info:
1760
+ type: boolean
1761
+ description: 'True if occupancy measurements are available'
1762
+ has_occupancy_info:
1763
+ type: boolean
1764
+ description: 'True if average occupancy info calculated from measurements is available'
1636
1765
  required:
1637
1766
  - id
1638
1767
  - primary_source
@@ -1709,7 +1838,7 @@ components:
1709
1838
  type: object
1710
1839
  properties:
1711
1840
  id:
1712
- type: string
1841
+ type: string
1713
1842
  description: 'The identifier for the parking space.'
1714
1843
  capacity:
1715
1844
  type: integer
@@ -1786,11 +1915,47 @@ components:
1786
1915
  - rv
1787
1916
  additionalProperties:
1788
1917
  type: boolean
1918
+ ParkingOccupancyMeasurement:
1919
+ type: object
1920
+ title: Parking Occupancy
1921
+ properties:
1922
+ parking_id:
1923
+ type: string
1924
+ nullable: false
1925
+ primary_source:
1926
+ type: string
1927
+ enum:
1928
+ - tsk_v2
1929
+ description: 'The primary source of the parking location. Assigned by us.'
1930
+ primary_source_id:
1931
+ type: string
1932
+ nullable: true
1933
+ description: 'The ID defined by the primary source. As in the source data.'
1934
+ has_free_spots:
1935
+ type: boolean
1936
+ nullable: false
1937
+ total_spot_number:
1938
+ type: number
1939
+ nullable: true
1940
+ free_spot_number:
1941
+ type: number
1942
+ nullable: true
1943
+ closed_spot_number:
1944
+ type: number
1945
+ nullable: true
1946
+ occupied_spot_number:
1947
+ type: number
1948
+ nullable: true
1949
+ last_updated:
1950
+ type: string
1951
+ nullable: false
1952
+ format: date-time
1953
+ description: 'The date and time when the info about the occupancy measurement was last updated.'
1789
1954
  ParkingAddress:
1790
1955
  type: object
1791
1956
  title: Parking Address
1792
1957
  properties:
1793
- address_formated:
1958
+ address_formatted:
1794
1959
  type: string
1795
1960
  nullable: true
1796
1961
  description: 'Formatted address of the parking location.'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/parkings",
3
- "version": "1.7.10",
3
+ "version": "1.7.11-dev.1187905601",
4
4
  "description": "Golemio Parkings Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -79,4 +79,4 @@
79
79
  "@turf/turf": "^6.5.0",
80
80
  "uuid-by-string": "^3.0.2"
81
81
  }
82
- }
82
+ }