@golemio/parkings 1.7.11-dev.1185129708 → 1.7.11-dev.1188124768

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 +44 -3
  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 +1 -0
  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 +177 -11
  87. package/package.json +1 -1
@@ -229,7 +229,7 @@ paths:
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
@@ -338,7 +338,7 @@ paths:
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[]`,
@@ -465,7 +465,7 @@ paths:
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:
@@ -615,7 +615,7 @@ paths:
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:
@@ -666,6 +666,111 @@ paths:
666
666
  application/json:
667
667
  schema:
668
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"}}'
669
774
  /v3/parking-tariffs:
670
775
  get:
671
776
  tags:
@@ -688,21 +793,21 @@ paths:
688
793
  schema:
689
794
  type: string
690
795
  example: '6c08e2f9-a884-4dce-81e3-00e3391f811a'
691
- 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)'
692
797
  - name: validFrom
693
798
  in: query
694
799
  schema:
695
800
  type: string
696
801
  format: date-time
697
802
  example: '2022-08-01T00:00:00.000Z'
698
- 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)'
699
804
  - name: validTo
700
805
  in: query
701
806
  schema:
702
807
  type: string
703
808
  format: date-time
704
809
  example: '2023-12-31T00:00:00.000Z'
705
- 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)'
706
811
  - name: limit
707
812
  in: query
708
813
  schema:
@@ -786,7 +891,7 @@ paths:
786
891
  schema:
787
892
  type: string
788
893
  example: '50.123,14.243,50.017,14.573'
789
- 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'
790
895
  - name: codeMask
791
896
  in: query
792
897
  schema:
@@ -1063,7 +1168,7 @@ components:
1063
1168
  10:
1064
1169
  type: number
1065
1170
  example: 51
1066
- 51:
1171
+ 11:
1067
1172
  type: number
1068
1173
  example: 51
1069
1174
  12:
@@ -1102,6 +1207,25 @@ components:
1102
1207
  23:
1103
1208
  type: number
1104
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)"
1105
1229
  ParkingLotHistory:
1106
1230
  type: object
1107
1231
  properties:
@@ -1632,6 +1756,12 @@ components:
1632
1756
  type: string
1633
1757
  format: uuid
1634
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'
1635
1765
  required:
1636
1766
  - id
1637
1767
  - primary_source
@@ -1785,11 +1915,47 @@ components:
1785
1915
  - rv
1786
1916
  additionalProperties:
1787
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.'
1788
1954
  ParkingAddress:
1789
1955
  type: object
1790
1956
  title: Parking Address
1791
1957
  properties:
1792
- address_formated:
1958
+ address_formatted:
1793
1959
  type: string
1794
1960
  nullable: true
1795
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.11-dev.1185129708",
3
+ "version": "1.7.11-dev.1188124768",
4
4
  "description": "Golemio Parkings Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",