@golemio/fcd 1.0.4 → 1.0.5-dev.495524269
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.
- package/dist/output-gateway/FCDRouter.js +1 -8
- package/dist/output-gateway/FCDRouter.js.map +1 -1
- package/dist/output-gateway/models/FloatingCarDataModel.d.ts +0 -2
- package/dist/output-gateway/models/FloatingCarDataModel.js +6 -15
- package/dist/output-gateway/models/FloatingCarDataModel.js.map +1 -1
- package/docs/openapi.yaml +1 -18
- package/package.json +80 -80
|
@@ -27,8 +27,6 @@ class FCDRouter extends BaseRouter_1.BaseRouter {
|
|
|
27
27
|
locationId: req.query.locationId,
|
|
28
28
|
limit: req.query.limit ? +req.query.limit : undefined,
|
|
29
29
|
offset: req.query.offset ? +req.query.offset : undefined,
|
|
30
|
-
from: req.query.from,
|
|
31
|
-
to: req.query.to,
|
|
32
30
|
});
|
|
33
31
|
if (!(dataFromDb === null || dataFromDb === void 0 ? void 0 : dataFromDb.length)) {
|
|
34
32
|
throw new golemio_errors_1.CustomError("No data found", true, "FCDRouter", 404);
|
|
@@ -42,12 +40,7 @@ class FCDRouter extends BaseRouter_1.BaseRouter {
|
|
|
42
40
|
});
|
|
43
41
|
this.floatingCarDataModel = new models_1.FloatingCarDataModel();
|
|
44
42
|
this.outputFloatingCarDataTransformation = new OutputFloatingCarDataTransformation_1.OutputFloatingCarDataTransformation();
|
|
45
|
-
this.router.get("/info", [
|
|
46
|
-
(0, express_validator_1.query)("osmPath").optional().isString(),
|
|
47
|
-
(0, express_validator_1.query)("locationId").optional().isString(),
|
|
48
|
-
(0, express_validator_1.query)("from").optional().isISO8601(),
|
|
49
|
-
(0, express_validator_1.query)("to").optional().isISO8601(),
|
|
50
|
-
], Validation_1.pagination, Validation_1.checkErrors, (0, Validation_1.paginationLimitMiddleware)("FCDRouter"), (0, redis_1.useCacheMiddleware)(), this.GetFloatingCarData);
|
|
43
|
+
this.router.get("/info", [(0, express_validator_1.query)("osmPath").optional().isString(), (0, express_validator_1.query)("locationId").optional().isString()], Validation_1.pagination, Validation_1.checkErrors, (0, Validation_1.paginationLimitMiddleware)("FCDRouter"), (0, redis_1.useCacheMiddleware)(), this.GetFloatingCarData);
|
|
51
44
|
}
|
|
52
45
|
}
|
|
53
46
|
exports.FCDRouter = FCDRouter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FCDRouter.js","sourceRoot":"","sources":["../../src/output-gateway/FCDRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,mFAAoE;AACpE,6EAAuE;AACvE,mEAA6E;AAC7E,oFAAiF;AACjF,6EAAkH;AAClH,qCAAgD;AAChD,+GAA8G;AAE9G,MAAa,SAAU,SAAQ,uBAAU;IAIrC;QACI,KAAK,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"FCDRouter.js","sourceRoot":"","sources":["../../src/output-gateway/FCDRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,mFAAoE;AACpE,6EAAuE;AACvE,mEAA6E;AAC7E,oFAAiF;AACjF,6EAAkH;AAClH,qCAAgD;AAChD,+GAA8G;AAE9G,MAAa,SAAU,SAAQ,uBAAU;IAIrC;QACI,KAAK,EAAE,CAAC;QAeL,uBAAkB,GAAG,CAAO,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;YAClF,IAAI;gBACA,MAAM,kBAAkB,GAAI,GAAG,CAAC,KAAK,CAAC,OAAkB,IAAI,MAAM,CAAC;gBAEnE,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC;oBACtD,UAAU,EAAE,GAAG,CAAC,KAAK,CAAC,UAAoB;oBAC1C,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;oBACrD,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CA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}) => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
const { locationId, limit, offset
|
|
33
|
+
const { locationId, limit, offset } = options;
|
|
34
34
|
try {
|
|
35
35
|
const Op = sequelize_1.default.Op;
|
|
36
36
|
const where = {
|
|
@@ -41,20 +41,11 @@ class FloatingCarDataModel extends models_1.SequelizeModel {
|
|
|
41
41
|
predefined_location: locationId,
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
if (to) {
|
|
52
|
-
where[Op.and].push({
|
|
53
|
-
measurement_or_calculation_time: {
|
|
54
|
-
[Op.lte]: to,
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
}
|
|
44
|
+
where[Op.and].push({
|
|
45
|
+
measurement_or_calculation_time: {
|
|
46
|
+
[Op.eq]: sequelize_1.default.literal(`(select max(measurement_or_calculation_time) from ${index_1.FCD.fcd_info.pgTableName})`),
|
|
47
|
+
},
|
|
48
|
+
});
|
|
58
49
|
const floatingCarDataFromDB = yield this.sequelizeModel.findAll({
|
|
59
50
|
limit,
|
|
60
51
|
offset,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FloatingCarDataModel.js","sourceRoot":"","sources":["../../../src/output-gateway/models/FloatingCarDataModel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oFAA4D;AAC5D,6EAAuE;AACvE,qEAA0E;AAC1E,0DAAiC;AAEjC,MAAa,oBAAqB,SAAQ,uBAAc;IACpD;QACI,KAAK,CAAC,WAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,WAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAG,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAC;QAG/F;;;;;;;;WAQG;QAEI,WAAM,GAAG,CACZ,
|
|
1
|
+
{"version":3,"file":"FloatingCarDataModel.js","sourceRoot":"","sources":["../../../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,sBAAsB,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;aACxF;QACL,CAAC,CAAA,CAAC;QAEK,WAAM,GAAG,GAAiC,EAAE;YAC/C,MAAM,IAAI,4BAAW,CAAC,iBAAiB,EAAE,IAAI,EAAE,sBAAsB,CAAC,CAAC;QAC3E,CAAC,CAAA,CAAC;IArDF,CAAC;CAsDJ;AAzDD,oDAyDC"}
|
package/docs/openapi.yaml
CHANGED
|
@@ -22,7 +22,7 @@ tags:
|
|
|
22
22
|
paths:
|
|
23
23
|
/fcd/info:
|
|
24
24
|
get:
|
|
25
|
-
summary: GET
|
|
25
|
+
summary: GET Latest floating Car Data
|
|
26
26
|
description: ""
|
|
27
27
|
tags:
|
|
28
28
|
- 🚢 Floating Car Data
|
|
@@ -44,23 +44,6 @@ paths:
|
|
|
44
44
|
schema:
|
|
45
45
|
type: boolean
|
|
46
46
|
example: true
|
|
47
|
-
|
|
48
|
-
- name: from
|
|
49
|
-
in: query
|
|
50
|
-
description: >-
|
|
51
|
-
Filters data where the measurement moment is greater than the query-specified moment.
|
|
52
|
-
required: false
|
|
53
|
-
schema:
|
|
54
|
-
type: string
|
|
55
|
-
example: 2021-06-21 10:00
|
|
56
|
-
- name: to
|
|
57
|
-
in: query
|
|
58
|
-
description: >-
|
|
59
|
-
Filters data where the measurement moment is less than the query-specified moment.
|
|
60
|
-
required: false
|
|
61
|
-
schema:
|
|
62
|
-
type: string
|
|
63
|
-
example: 2021-12-21 10:00
|
|
64
47
|
- name: limit
|
|
65
48
|
in: query
|
|
66
49
|
description: >-
|
package/package.json
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
2
|
+
"name": "@golemio/fcd",
|
|
3
|
+
"version": "1.0.5-dev.495524269",
|
|
4
|
+
"description": "Golemio Floating Car Data Module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "rimraf ./dist && ttsc -p ./tsconfig.build.json",
|
|
9
|
+
"build-minimal": "run-s 'build --sourceMap false --declaration false'",
|
|
10
|
+
"build-watch": "run-s 'build --watch --preserveWatchOutput'",
|
|
11
|
+
"pretest": "golemio-import-test-data",
|
|
12
|
+
"test": "cross-env NODE_ENV=test TS_NODE_COMPILER='ttypescript' mocha --exit --check-leaks --timeout 120000 -r ts-node/register -r dotenv/config 'test/**/*.test.ts'",
|
|
13
|
+
"apidocs-test": "cross-env NODE_ENV=test TS_NODE_COMPILER='ttypescript' ts-node -r dotenv/config test/api-docs/index.ts",
|
|
14
|
+
"test-debug": "run-s 'test --inspect-brk=9230'",
|
|
15
|
+
"code-coverage": "nyc run-s 'test -r source-map-support/register'",
|
|
16
|
+
"generate-docs": "typedoc --out docs/typedoc src",
|
|
17
|
+
"lint": "eslint \"{src,test}/**/*.ts\""
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"golemio",
|
|
21
|
+
"fcd"
|
|
22
|
+
],
|
|
23
|
+
"author": "Operator ICT, a.s.",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://gitlab.com/operator-ict/golemio/code/modules/fcd"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@commitlint/cli": "^11.0.0",
|
|
31
|
+
"@commitlint/config-conventional": "^11.0.0",
|
|
32
|
+
"@golemio/core": "1.2.2",
|
|
33
|
+
"@golemio/eslint-config": "^1.0.2",
|
|
34
|
+
"@golemio/schema-definitions": "2.0.27",
|
|
35
|
+
"@types/body-parser-xml": "^1.1.0",
|
|
36
|
+
"@types/chai": "4.2.3",
|
|
37
|
+
"@types/chai-as-promised": "7.1.2",
|
|
38
|
+
"@types/mocha": "^8.2.0",
|
|
39
|
+
"@types/node": "^14.14.20",
|
|
40
|
+
"@types/sinon": "^9.0.10",
|
|
41
|
+
"@types/supertest": "^2.0.10",
|
|
42
|
+
"@zerollup/ts-transform-paths": "^1.7.18",
|
|
43
|
+
"body-parser": "^1.19.0",
|
|
44
|
+
"body-parser-xml": "^2.0.0",
|
|
45
|
+
"chai": "4.2.0",
|
|
46
|
+
"chai-as-promised": "7.1.1",
|
|
47
|
+
"cross-env": "^7.0.3",
|
|
48
|
+
"dotenv": "^8.2.0",
|
|
49
|
+
"eslint": "^7.17.0",
|
|
50
|
+
"husky": "^4.3.7",
|
|
51
|
+
"mocha": "^8.2.1",
|
|
52
|
+
"npm-run-all": "^4.1.5",
|
|
53
|
+
"nyc": "^15.1.0",
|
|
54
|
+
"prettier": "^2.2.1",
|
|
55
|
+
"pretty-quick": "^3.1.0",
|
|
56
|
+
"rimraf": "^3.0.2",
|
|
57
|
+
"sinon": "^9.2.3",
|
|
58
|
+
"source-map-support": "0.5.19",
|
|
59
|
+
"supertest": "^6.0.1",
|
|
60
|
+
"ts-node": "^9.1.1",
|
|
61
|
+
"ttypescript": "^1.5.12",
|
|
62
|
+
"typedoc": "^0.21.4",
|
|
63
|
+
"typescript": "^4.1.3"
|
|
64
|
+
},
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"@golemio/core": "^1.0.5"
|
|
67
|
+
},
|
|
68
|
+
"dependencies": {
|
|
69
|
+
"@apideck/portman": "^1.13.0",
|
|
70
|
+
"ajv": "^8.2.0",
|
|
71
|
+
"xmldom": "github:xmldom/xmldom#0.7.0",
|
|
72
|
+
"xsd2jsonschema": "^0.3.7"
|
|
73
|
+
},
|
|
74
|
+
"resolutions": {
|
|
75
|
+
"@commitlint/cli/**/trim-newlines": "^3.0.1",
|
|
76
|
+
"hosted-git-info": "^3.0.8",
|
|
77
|
+
"xmldom": "github:xmldom/xmldom#0.7.0",
|
|
78
|
+
"mpath": "^0.8.4",
|
|
79
|
+
"follow-redirects": "1.14.7",
|
|
80
|
+
"xsd2jsonschema/urijs": "^1.19.10"
|
|
81
|
+
}
|
|
82
82
|
}
|