@golemio/pid 2.9.6-dev.1065207585 → 2.9.6-dev.1066422609

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.
@@ -3,5 +3,5 @@ import { IBoundingBox } from "../../domain/IBoudingBox";
3
3
  export interface IParams {
4
4
  boundingBox: IBoundingBox;
5
5
  routeShortName: string | undefined;
6
- type: GTFSRouteTypeEnum | undefined;
6
+ type: GTFSRouteTypeEnum[] | undefined;
7
7
  }
@@ -39,7 +39,11 @@ class PublicVehiclePositionsController {
39
39
  bottomRightLatitude: boundingBox ? boundingBox[2] : const_1.DEFAULT_BOUDINGBOX.bottomRightLatitude,
40
40
  },
41
41
  routeShortName: query.routeShortName ? query.routeShortName : undefined,
42
- type: query.type ? (0, RouteTypeEnums_1.getGtfsRouteType)(query.type) : undefined,
42
+ type: query.routeType
43
+ ? query.routeType instanceof Array
44
+ ? query.routeType.map((type) => (0, RouteTypeEnums_1.getGtfsRouteType)(type))
45
+ : [(0, RouteTypeEnums_1.getGtfsRouteType)(query.routeType)]
46
+ : undefined,
43
47
  };
44
48
  }
45
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PublicVehiclePositionsController.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/controllers/v1/PublicVehiclePositionsController.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA6D;AAC7D,qCAAsD;AACtD,2DAA6D;AAK7D,uEAA2D;AAE3D,MAAa,gCAAgC;IACzC;QAEO,WAAM,GAAG,CAAO,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;YACtE,IAAI;gBACA,MAAM,MAAM,GAAG,sBAAiB,CAAC,OAAO,CAA+B,6BAAa,CAAC,4BAA4B,CAAC,CAAC;gBACnH,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBAC3C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MA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+ {"version":3,"file":"PublicVehiclePositionsController.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/controllers/v1/PublicVehiclePositionsController.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA6D;AAC7D,qCAAsD;AACtD,2DAA6D;AAK7D,uEAA2D;AAE3D,MAAa,gCAAgC;IACzC;QAEO,WAAM,GAAG,CAAO,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;YACtE,IAAI;gBACA,MAAM,MAAM,GAAG,sBAAiB,CAAC,OAAO,CAA+B,6BAAa,CAAC,4BAA4B,CAAC,CAAC;gBACnH,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBAC3C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;gBAE3F,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aACpB;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,CAAC,GAAG,CAAC,CAAC;aACb;QACL,CAAC,CAAA,CAAC;IAZa,CAAC;IAcT,WAAW,CAAC,KAAe;QAC9B,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAE,KAAK,CAAC,WAAsB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACvH,mEAAmE;QACnE,OAAO;YACH,WAAW,EAAE;gBACT,gBAAgB,EAAE,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,0BAAkB,CAAC,gBAAgB;gBACpF,eAAe,EAAE,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,0BAAkB,CAAC,eAAe;gBAClF,oBAAoB,EAAE,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,0BAAkB,CAAC,oBAAoB;gBAC5F,mBAAmB,EAAE,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,0BAAkB,CAAC,mBAAmB;aAC7F;YACD,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAE,KAAK,CAAC,cAAyB,CAAC,CAAC,CAAC,SAAS;YACnF,IAAI,EAAE,KAAK,CAAC,SAAS;gBACjB,CAAC,CAAC,KAAK,CAAC,SAAS,YAAY,KAAK;oBAC9B,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,iCAAgB,EAAC,IAAc,CAAC,CAAC;oBACjE,CAAC,CAAC,CAAC,IAAA,iCAAgB,EAAC,KAAK,CAAC,SAAmB,CAAC,CAAC;gBACnD,CAAC,CAAC,SAAS;SAClB,CAAC;IACN,CAAC;CACJ;AAjCD,4EAiCC"}
@@ -4,7 +4,6 @@ export declare class PublicRouter {
4
4
  router: Router;
5
5
  private controller;
6
6
  private redisSubscriber;
7
- private supportedTypes;
8
7
  constructor();
9
8
  protected initRoutes(expire?: string | number | undefined): void;
10
9
  }
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.v1PublicRouter = exports.PublicRouter = void 0;
4
- const RouteTypeEnums_1 = require("../../../../helpers/RouteTypeEnums");
5
4
  const PublicVehiclePositionsController_1 = require("../../controllers/v1/PublicVehiclePositionsController");
6
5
  const Di_1 = require("../../ioc/Di");
7
6
  const OgModuleToken_1 = require("../../ioc/OgModuleToken");
8
7
  const Validation_1 = require("@golemio/core/dist/output-gateway/Validation");
9
8
  const express_1 = require("@golemio/core/dist/shared/express");
10
9
  const express_validator_1 = require("@golemio/core/dist/shared/express-validator");
10
+ const CustomTypeValidator_1 = require("./helpers/CustomTypeValidator");
11
11
  class PublicRouter {
12
12
  constructor() {
13
13
  this.router = (0, express_1.Router)();
@@ -15,7 +15,6 @@ class PublicRouter {
15
15
  this.initRoutes();
16
16
  this.redisSubscriber = Di_1.OgPublicContainer.resolve(OgModuleToken_1.OgModuleToken.VPSubscriber);
17
17
  this.redisSubscriber.initialize();
18
- this.supportedTypes = (0, RouteTypeEnums_1.getGtfsRouteTypesAsStrings)();
19
18
  }
20
19
  initRoutes(expire) {
21
20
  this.router.get("/vehiclepositions", [
@@ -24,10 +23,7 @@ class PublicRouter {
24
23
  .isString()
25
24
  .matches(/^\d+\.?\d*(,\d+\.?\d*){3}$/),
26
25
  (0, express_validator_1.query)("routeShortName").optional().isString(),
27
- (0, express_validator_1.oneOf)([
28
- [(0, express_validator_1.query)("type").optional().isArray(), (0, express_validator_1.query)("type.*").optional().isString().isIn(this.supportedTypes)],
29
- (0, express_validator_1.query)("type").optional().isString().isIn(this.supportedTypes),
30
- ]),
26
+ (0, express_validator_1.query)("routeType").optional().custom(CustomTypeValidator_1.CustomTypeValidator.validate),
31
27
  ], Validation_1.checkErrors, this.controller.getAll);
32
28
  }
33
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PublicRouter.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/routers/v1/PublicRouter.ts"],"names":[],"mappings":";;;AAAA,uEAAqE;AACrE,4GAA8G;AAC9G,qCAAsD;AACtD,2DAA6D;AAE7D,6EAA2E;AAC3E,+DAA2D;AAC3D,mFAA2E;AAE3E,MAAa,YAAY;IAMrB;QACI,IAAI,CAAC,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,IAAI,mEAAgC,EAAE,CAAC;QACzD,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,eAAe,GAAG,sBAAiB,CAAC,OAAO,CAAe,6BAAa,CAAC,YAAY,CAAC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GAAG,IAAI,mEAAgC,EAAE,CAAC;QACzD,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,eAAe,GAAG,sBAAiB,CAAC,OAAO,CAAe,6BAAa,CAAC,YAAY,CAAC,CAAC;QAC3F,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC;IACtC,CAAC;IAES,UAAU,CAAC,MAAoC;QACrD,IAAI,CAAC,MAAM,CAAC,GAAG,CACX,mBAAmB,EACnB;YACI,IAAA,yBAAK,EAAC,aAAa,CAAC;iBACf,QAAQ,EAAE;iBACV,QAAQ,EAAE;iBACV,OAAO,CAAC,4BAA4B,CAAC;YAC1C,IAAA,yBAAK,EAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;YAC7C,IAAA,yBAAK,EAAC,WAAW,CAAC,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,yCAAmB,CAAC,QAAQ,CAAC;SACrE,EACD,wBAAW,EACX,IAAI,CAAC,UAAU,CAAC,MAAM,CACzB,CAAC;IACN,CAAC;CACJ;AA5BD,oCA4BC;AAED,MAAM,cAAc,GAAG,IAAI,YAAY,EAAE,CAAC,MAAM,CAAC;AAExC,wCAAc"}
@@ -0,0 +1,5 @@
1
+ import { CustomValidator } from "@golemio/core/dist/shared/express-validator";
2
+ export declare class CustomTypeValidator {
3
+ static allowedTypes: string[];
4
+ static validate: CustomValidator;
5
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var _a;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.CustomTypeValidator = void 0;
14
+ const RouteTypeEnums_1 = require("../../../../../helpers/RouteTypeEnums");
15
+ class CustomTypeValidator {
16
+ }
17
+ exports.CustomTypeValidator = CustomTypeValidator;
18
+ _a = CustomTypeValidator;
19
+ CustomTypeValidator.allowedTypes = (0, RouteTypeEnums_1.getGtfsRouteTypesAsStrings)();
20
+ CustomTypeValidator.validate = (value, options) => __awaiter(void 0, void 0, void 0, function* () {
21
+ if (value instanceof Array) {
22
+ return value.every((source) => _a.allowedTypes.includes(source));
23
+ }
24
+ else {
25
+ return _a.allowedTypes.includes(value);
26
+ }
27
+ });
28
+ //# sourceMappingURL=CustomTypeValidator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomTypeValidator.js","sourceRoot":"","sources":["../../../../../../src/output-gateway/public/routers/v1/helpers/CustomTypeValidator.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,0EAAqE;AAGrE,MAAa,mBAAmB;;AAAhC,kDAUC;;AATiB,gCAAY,GAAa,IAAA,2CAA0B,GAAE,AAAzC,CAA0C;AAEtD,4BAAQ,GAAoB,CAAO,KAAK,EAAE,OAAO,EAAE,EAAE;IAC/D,IAAI,KAAK,YAAY,KAAK,EAAE;QACxB,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,MAAc,EAAE,EAAE,CAAC,EAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;KAC9E;SAAM;QACH,OAAO,EAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;KAC5C;AACL,CAAC,CAAA,AANqB,CAMpB"}
@@ -8,6 +8,6 @@ export declare class PublicVehiclePositionsFacade {
8
8
  private log;
9
9
  private transformation;
10
10
  constructor(repository: IVehiclePositionsRepository, log: ILogger);
11
- getAll(boundingBox: IBoundingBox, routeShortName: string | undefined, type: GTFSRouteTypeEnum | undefined): Promise<IGeoJSONFeatureCollection>;
11
+ getAll(boundingBox: IBoundingBox, routeShortName: string | undefined, type: GTFSRouteTypeEnum[] | undefined): Promise<IGeoJSONFeatureCollection>;
12
12
  private filterClientSide;
13
13
  }
@@ -28,11 +28,11 @@ class PublicVehiclePositionsFacade {
28
28
  return (0, output_gateway_1.buildGeojsonFeatureCollection)(this.transformation.transformArray(filteredResults));
29
29
  });
30
30
  }
31
- filterClientSide(el, routeShortName, type) {
31
+ filterClientSide(el, routeShortName, types) {
32
32
  if (routeShortName && el.gtfs_route_short_name !== routeShortName) {
33
33
  return false;
34
34
  }
35
- if (type && el.gtfs_route_type !== type) {
35
+ if (types && types.every((type) => type !== el.gtfs_route_type)) {
36
36
  return false;
37
37
  }
38
38
  return true;
@@ -1 +1 @@
1
- {"version":3,"file":"VehiclePositionsFacade.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/service/facade/VehiclePositionsFacade.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,sEAA6G;AAC7G,oEAAiE;AACjE,kHAA+G;AAE/G,MAAa,4BAA4B;IAGrC,YAAoB,UAAuC,EAAU,GAAY;QAA7D,eAAU,GAAV,UAAU,CAA6B;QAAU,QAAG,GAAH,GAAG,CAAS;QAC7E,IAAI,CAAC,cAAc,GAAG,IAAI,2EAAoC,EAAE,CAAC;IACrE,CAAC;IAEY,MAAM,CACf,WAAyB,EACzB,cAAkC,EAClC,IAAmC;;YAEnC,MAAM,qBAAqB,GAAG,qCAAiB,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;YAC/E,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,qBAAqB,CAAC,KAAK,cAAc,qBAAqB,CAAC,MAAM,GAAG,CAAC,CAAC;YAEnG,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,sBAAsB,CAAC,qBAAqB,CAAC,CAAC;YAC7F,MAAM,eAAe,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC;YAEzG,OAAO,IAAA,8CAA6B,EAAC,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC;QAC9F,CAAC;KAAA;IAEO,gBAAgB,CACpB,EAAsB,EACtB,cAAkC,EAClC,IAAmC;QAEnC,IAAI,cAAc,IAAI,EAAE,CAAC,qBAAqB,KAAK,cAAc,EAAE;YAC/D,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,IAAI,IAAI,EAAE,CAAC,eAAe,KAAK,IAAI,EAAE;YACrC,OAAO,KAAK,CAAC;SAChB;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AApCD,oEAoCC"}
1
+ {"version":3,"file":"VehiclePositionsFacade.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/service/facade/VehiclePositionsFacade.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,sEAA6G;AAC7G,oEAAiE;AACjE,kHAA+G;AAE/G,MAAa,4BAA4B;IAGrC,YAAoB,UAAuC,EAAU,GAAY;QAA7D,eAAU,GAAV,UAAU,CAA6B;QAAU,QAAG,GAAH,GAAG,CAAS;QAC7E,IAAI,CAAC,cAAc,GAAG,IAAI,2EAAoC,EAAE,CAAC;IACrE,CAAC;IAEY,MAAM,CACf,WAAyB,EACzB,cAAkC,EAClC,IAAqC;;YAErC,MAAM,qBAAqB,GAAG,qCAAiB,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;YAC/E,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,qBAAqB,CAAC,KAAK,cAAc,qBAAqB,CAAC,MAAM,GAAG,CAAC,CAAC;YAEnG,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,sBAAsB,CAAC,qBAAqB,CAAC,CAAC;YAC7F,MAAM,eAAe,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC;YAEzG,OAAO,IAAA,8CAA6B,EAAC,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC;QAC9F,CAAC;KAAA;IAEO,gBAAgB,CACpB,EAAsB,EACtB,cAAkC,EAClC,KAAsC;QAEtC,IAAI,cAAc,IAAI,EAAE,CAAC,qBAAqB,KAAK,cAAc,EAAE;YAC/D,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,eAAe,CAAC,EAAE;YAC7D,OAAO,KAAK,CAAC;SAChB;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AApCD,oEAoCC"}
@@ -832,6 +832,23 @@ Worker má na starost zpracování a transformaci polohových dat, výpočet zpo
832
832
  - VPTripsModel `vehiclepositions_trips`
833
833
  - VPTripsHistoryModel `vehiclepositions_trips_history`
834
834
 
835
+ #### _task: RefreshPublicCache_
836
+
837
+ - vstupní rabbitmq fronta
838
+ - název: vehicle-positions.vehiclepositions.refreshPublicCache
839
+ - TTL: 1s
840
+ - parametry: žádné
841
+ - závislé fronty (do kterých jsou odesílány zprávy z metody workeru)
842
+ - `vehicle-positions.vehiclepositions.refreshPublicCache` task se spouští sám sebe a cron plní doplňující funkci.
843
+ - popis
844
+ - před samotným spuštěním se zkontroluje pomocí semaforu zdali task již někde neběží
845
+ - připraví zjednodušené informace o aktuálních pozicích, které se odešlou do redisu
846
+ - pomocí pub/sub se pak pošle do og informace o novém setu v redisu
847
+ - data modely
848
+ - VPPositionsModel `vehiclepositions_positions`
849
+ - VPTripsModel `vehiclepositions_trips`
850
+
851
+
835
852
  ### _RunsWorker_
836
853
 
837
854
  Worker má na starost zpracování a transformaci TCP oběhů
@@ -1218,3 +1235,11 @@ Worker má na starost stahování informací o vozidlech (např. dostupnost klim
1218
1235
 
1219
1236
  - zdrojové tabulky
1220
1237
  - `ropidvymi_events`, `ropidvymi_events_stops`, `ropidvymi_events_routes`, `ropidgtfs_stops`
1238
+
1239
+ ### Public
1240
+
1241
+ #### _/public/vehiclepositions_
1242
+
1243
+ - načte aktuální polohy vozidel z redisu a vrátí je ve formátu geojson
1244
+ - možno filtrovat dle bouding box na straně redisu
1245
+ - podle typu vozidla a gtfs route number na klientské straně
@@ -31,6 +31,9 @@ tags:
31
31
  - name: 🚏 PID Departure Boards
32
32
  description: ""
33
33
 
34
+ - name: 🕐 Public Vehicle Positions
35
+ description: ""
36
+
34
37
  paths:
35
38
  /gtfs/services:
36
39
  get:
@@ -949,6 +952,61 @@ paths:
949
952
  "404":
950
953
  description: Not found
951
954
 
955
+ /public/vehiclepositions:
956
+ get:
957
+ tags:
958
+ - 🕐 Public Vehicle Positions
959
+ summary: GET All Vehicle Positions
960
+ parameters:
961
+ - name: boundingBox
962
+ in: query
963
+ schema:
964
+ type: string
965
+ example: '50.123,14.243,50.017,14.573'
966
+ 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'
967
+ - name: routeShortName
968
+ in: query
969
+ schema:
970
+ type: string
971
+ example: '705'
972
+ description: 'Filter by short name of route'
973
+ - name: routeType
974
+ in: query
975
+ schema:
976
+ type: array
977
+ items:
978
+ type: string
979
+ enum:
980
+ - tram
981
+ - metro
982
+ - train
983
+ - bus
984
+ - ferry
985
+ - funicular
986
+ - trolleybus
987
+ example: 'metro'
988
+ description: 'filter by transport type'
989
+ responses:
990
+ 200:
991
+ description: OK
992
+ content:
993
+ application/json; charset=utf-8:
994
+ schema:
995
+ type: object
996
+ properties:
997
+ features:
998
+ type: array
999
+ items:
1000
+ $ref: '#/components/schemas/VehiclePositionsFeature'
1001
+ type:
1002
+ type: string
1003
+ example: FeatureCollection
1004
+ 401:
1005
+ $ref: "#/components/responses/UnauthorizedError"
1006
+ 404:
1007
+ description: Not found
1008
+
1009
+
952
1010
  components:
953
1011
  responses:
954
1012
  UnauthorizedError:
@@ -1864,3 +1922,99 @@ components:
1864
1922
  - is_night
1865
1923
  - is_regional
1866
1924
  - is_substitute_transport
1925
+
1926
+ VehiclePositionsFeature:
1927
+ type: object
1928
+ properties:
1929
+ geometry:
1930
+ type: object
1931
+ description: GeoJson geometry
1932
+ properties:
1933
+ coordinates:
1934
+ oneOf:
1935
+ - type: array
1936
+ items:
1937
+ type: number
1938
+ example: [14.441252, 50.109318]
1939
+ description: Point
1940
+ - type: array
1941
+ items:
1942
+ type: array
1943
+ items:
1944
+ type: array
1945
+ items:
1946
+ type: number
1947
+ example:
1948
+ [[
1949
+ [14.50823156003554, 50.10498927328214],
1950
+ [14.505782430390298, 50.1031042405622],
1951
+ [14.509701037821998, 50.1029471511537],
1952
+ [14.50823156003554, 50.10498927328214]
1953
+ ]]
1954
+ description: Polygon
1955
+ - type: array
1956
+ items:
1957
+ type: array
1958
+ items:
1959
+ type: array
1960
+ items:
1961
+ type: array
1962
+ items:
1963
+ type: number
1964
+ example:
1965
+ [
1966
+ [[
1967
+ [14.50823156003554, 50.10498927328214],
1968
+ [14.505782430390298, 50.1031042405622],
1969
+ [14.509701037821998, 50.1029471511537],
1970
+ [14.50823156003554, 50.10498927328214]
1971
+ ]],
1972
+ [[
1973
+ [14.50823156003554, 50.10498927328214],
1974
+ [14.505782430390298, 50.1031042405622],
1975
+ [14.509701037821998, 50.1029471511537],
1976
+ [14.50823156003554, 50.10498927328214]
1977
+ ]]
1978
+ ]
1979
+ description: MultiPolygon
1980
+ type:
1981
+ type: string
1982
+ enum:
1983
+ - Point
1984
+ - Polygon
1985
+ - MultiPolygon
1986
+ properties:
1987
+ type: object
1988
+ properties:
1989
+ gtfs_trip_id:
1990
+ type: string
1991
+ example: 705_735_231002
1992
+ gtfs_route_type:
1993
+ type: string
1994
+ example: bus
1995
+ gtfs_route_short_name:
1996
+ type: string
1997
+ example: '705'
1998
+ run_number:
1999
+ type: number
2000
+ nullable: true
2001
+ example: 29
2002
+ vehicle_registration_number:
2003
+ type: number
2004
+ nullable: true
2005
+ example: 8585
2006
+ bearing:
2007
+ type: number
2008
+ nullable: true
2009
+ example: 221
2010
+ delay:
2011
+ type: number
2012
+ nullable: true
2013
+ example: 20
2014
+ required:
2015
+ - gtfs_trip_id
2016
+ - gtfs_route_type
2017
+ - gtfs_route_short_name
2018
+ type:
2019
+ type: string
2020
+ example: Feature
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/pid",
3
- "version": "2.9.6-dev.1065207585",
3
+ "version": "2.9.6-dev.1066422609",
4
4
  "description": "Golemio PID Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",