@golemio/air-quality-stations 1.1.13-dev.1288654294 → 1.2.0
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/AirQualityHistoryRouter.d.ts +2 -0
- package/dist/output-gateway/AirQualityHistoryRouter.js +4 -1
- package/dist/output-gateway/AirQualityHistoryRouter.js.map +1 -1
- package/dist/output-gateway/AirQualityRouter.js +5 -3
- package/dist/output-gateway/AirQualityRouter.js.map +1 -1
- package/dist/output-gateway/ioc/Di.d.ts +3 -0
- package/dist/output-gateway/ioc/Di.js +8 -0
- package/dist/output-gateway/ioc/Di.js.map +1 -0
- package/dist/output-gateway/models/AirQualityIndexesModel.d.ts +3 -0
- package/dist/output-gateway/models/AirQualityIndexesModel.js +10 -1
- package/dist/output-gateway/models/AirQualityIndexesModel.js.map +1 -1
- package/docs/openapi.yaml +162 -12
- package/package.json +4 -2
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { CacheHeaderMiddleware } from "@golemio/core/dist/output-gateway";
|
|
1
2
|
import { BaseRouter } from "@golemio/core/dist/output-gateway/routes/BaseRouter";
|
|
2
3
|
import { NextFunction, Request, Response } from "@golemio/core/dist/shared/express";
|
|
3
4
|
import { ValidationChain } from "@golemio/core/dist/shared/express-validator";
|
|
4
5
|
import HistoryModel from "./models/AirQualityHistoryModel";
|
|
5
6
|
export default class AirQualityHistoryRouter extends BaseRouter {
|
|
6
7
|
protected historyModel: HistoryModel;
|
|
8
|
+
protected cacheHeaderMiddleware: CacheHeaderMiddleware;
|
|
7
9
|
constructor();
|
|
8
10
|
initRoutes: () => Promise<void>;
|
|
9
11
|
GetAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
@@ -12,7 +12,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const Di_1 = require("./ioc/Di");
|
|
15
16
|
const output_gateway_1 = require("@golemio/core/dist/output-gateway");
|
|
17
|
+
const ioc_1 = require("@golemio/core/dist/output-gateway/ioc");
|
|
16
18
|
const BaseRouter_1 = require("@golemio/core/dist/output-gateway/routes/BaseRouter");
|
|
17
19
|
const express_validator_1 = require("@golemio/core/dist/shared/express-validator");
|
|
18
20
|
const AirQualityHistoryModel_1 = __importDefault(require("./models/AirQualityHistoryModel"));
|
|
@@ -25,7 +27,7 @@ class AirQualityHistoryRouter extends BaseRouter_1.BaseRouter {
|
|
|
25
27
|
(0, express_validator_1.query)("from").optional().isISO8601().not().isArray(),
|
|
26
28
|
(0, express_validator_1.query)("to").optional().isISO8601().not().isArray(),
|
|
27
29
|
sensorIdParam,
|
|
28
|
-
], output_gateway_1.pagination, output_gateway_1.checkErrors, (
|
|
30
|
+
], output_gateway_1.pagination, output_gateway_1.checkErrors, this.cacheHeaderMiddleware.getMiddleware(20 * 60, 5 * 60), (0, output_gateway_1.paginationLimitMiddleware)("AirQualityHistoryRouter"), this.GetAll);
|
|
29
31
|
});
|
|
30
32
|
this.GetAll = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
31
33
|
const timestampFrom = new Date(req.query.from).toISOString();
|
|
@@ -48,6 +50,7 @@ class AirQualityHistoryRouter extends BaseRouter_1.BaseRouter {
|
|
|
48
50
|
return (0, express_validator_1.query)("sensorId").optional().not().isEmpty({ ignore_whitespace: true }).not().isArray();
|
|
49
51
|
});
|
|
50
52
|
this.historyModel = new AirQualityHistoryModel_1.default();
|
|
53
|
+
this.cacheHeaderMiddleware = Di_1.AirQualityContainer.resolve(ioc_1.ContainerToken.CacheHeaderMiddleware);
|
|
51
54
|
}
|
|
52
55
|
}
|
|
53
56
|
exports.default = AirQualityHistoryRouter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AirQualityHistoryRouter.js","sourceRoot":"","sources":["../../src/output-gateway/AirQualityHistoryRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"AirQualityHistoryRouter.js","sourceRoot":"","sources":["../../src/output-gateway/AirQualityHistoryRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,iCAAiD;AACjD,sEAA8H;AAC9H,+DAAuE;AACvE,oFAAiF;AAEjF,mFAAqF;AACrF,6FAA2D;AAE3D,MAAqB,uBAAwB,SAAQ,uBAAU;IAI3D;QACI,KAAK,EAAE,CAAC;QAKL,eAAU,GAAG,GAAS,EAAE;YAC3B,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,8BAA8B,EAAE,CAAC;YAClE,IAAI,CAAC,MAAM,CAAC,GAAG,CACX,GAAG,EACH;gBACI,IAAA,yBAAK,EAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE;gBACpD,IAAA,yBAAK,EAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE;gBAClD,aAAa;aAChB,EACD,2BAAU,EACV,4BAAW,EACX,IAAI,CAAC,qBAAqB,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,EACzD,IAAA,0CAAyB,EAAC,yBAAyB,CAAC,EACpD,IAAI,CAAC,MAAM,CACd,CAAC;QACN,CAAC,CAAA,CAAC;QAEK,WAAM,GAAG,CAAO,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;YACtE,MAAM,aAAa,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAc,CAAC,CAAC,WAAW,EAAE,CAAC;YACvE,MAAM,WAAW,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAY,CAAC,CAAC,WAAW,EAAE,CAAC;YAEnE,IAAI;gBACA,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC;oBACxC,IAAI,EAAE,aAAa;oBACnB,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC;oBAC9B,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC;oBAChC,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,QAAkB;oBACtC,EAAE,EAAE,WAAW;iBAClB,CAAC,CAAC;gBAEH,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAC9B;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,CAAC,GAAG,CAAC,CAAC;aACb;QACL,CAAC,CAAA,CAAC;QAEQ,mCAA8B,GAAG,GAAmC,EAAE;YAC5E,OAAO,IAAA,yBAAK,EAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;QACnG,CAAC,CAAA,CAAC;QA1CE,IAAI,CAAC,YAAY,GAAG,IAAI,gCAAY,EAAE,CAAC;QACvC,IAAI,CAAC,qBAAqB,GAAG,wBAAmB,CAAC,OAAO,CAAwB,oBAAc,CAAC,qBAAqB,CAAC,CAAC;IAC1H,CAAC;CAyCJ;AAjDD,0CAiDC"}
|
|
@@ -19,6 +19,8 @@ const AirQualityHistoryRouter_1 = __importDefault(require("./AirQualityHistoryRo
|
|
|
19
19
|
const AirQualityComponentTypes_1 = __importDefault(require("./models/AirQualityComponentTypes"));
|
|
20
20
|
const AirQualityIndexesModel_1 = __importDefault(require("./models/AirQualityIndexesModel"));
|
|
21
21
|
const AirQualityIndexTypesModel_1 = __importDefault(require("./models/AirQualityIndexTypesModel"));
|
|
22
|
+
const CACHE_MAX_AGE = 20 * 60;
|
|
23
|
+
const CACHE_STALE_WHILE_REVALIDATE = 5 * 60;
|
|
22
24
|
class AirQualityRouter extends output_gateway_1.GeoJsonRouter {
|
|
23
25
|
constructor() {
|
|
24
26
|
super(new AirQualityIndexesModel_1.default());
|
|
@@ -41,9 +43,9 @@ class AirQualityRouter extends output_gateway_1.GeoJsonRouter {
|
|
|
41
43
|
next(err);
|
|
42
44
|
}
|
|
43
45
|
});
|
|
44
|
-
this.initRoutes();
|
|
45
|
-
this.router.get("/indextypes", (
|
|
46
|
-
this.router.get("/componenttypes", (
|
|
46
|
+
this.initRoutes({ maxAge: CACHE_MAX_AGE, staleWhileRevalidate: CACHE_STALE_WHILE_REVALIDATE });
|
|
47
|
+
this.router.get("/indextypes", this.cacheHeaderMiddleware.getMiddleware(CACHE_MAX_AGE, CACHE_STALE_WHILE_REVALIDATE), this.GetIndexTypes);
|
|
48
|
+
this.router.get("/componenttypes", this.cacheHeaderMiddleware.getMiddleware(CACHE_MAX_AGE, CACHE_STALE_WHILE_REVALIDATE), this.GetComponentTypes);
|
|
47
49
|
this.airQualityComponentTypes = new AirQualityComponentTypes_1.default();
|
|
48
50
|
this.airQualityIndexTypes = new AirQualityIndexTypesModel_1.default();
|
|
49
51
|
const historyRouter = new AirQualityHistoryRouter_1.default();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AirQualityRouter.js","sourceRoot":"","sources":["../../src/output-gateway/AirQualityRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sEAAsF;AACtF,+DAA4F;AAC5F,wFAAgE;AAChE,iGAA6E;AAC7E,6FAAqE;AACrE,mGAA2E;AAE3E,MAAqB,gBAAiB,SAAQ,8BAAa;IAKvD;QACI,KAAK,CAAC,IAAI,gCAAsB,EAAE,CAAC,CAAC;QALjC,WAAM,GAAW,IAAA,gBAAM,GAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"AirQualityRouter.js","sourceRoot":"","sources":["../../src/output-gateway/AirQualityRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;;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AAa,CACrB,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,GAAG,CACX,iBAAiB,EACjB,IAAI,CAAC,qBAAqB,CAAC,aAAa,CAAC,aAAa,EAAE,4BAA4B,CAAC,EACrF,IAAI,CAAC,iBAAiB,CACzB,CAAC;QAEF,IAAI,CAAC,wBAAwB,GAAG,IAAI,kCAA4B,EAAE,CAAC;QACnE,IAAI,CAAC,oBAAoB,GAAG,IAAI,mCAAyB,EAAE,CAAC;QAE5D,MAAM,aAAa,GAAG,IAAI,iCAAuB,EAAE,CAAC;QACpD,aAAa,CAAC,UAAU,EAAE,CAAC;QAC3B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACtD,CAAC;CAmBJ;AA5CD,mCA4CC;AAED,MAAM,gBAAgB,GAAW,IAAI,gBAAgB,EAAE,CAAC,MAAM,CAAC;AAEtD,4CAAgB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AirQualityContainer = void 0;
|
|
4
|
+
const Di_1 = require("@golemio/core/dist/output-gateway/ioc/Di");
|
|
5
|
+
//#region Initialization
|
|
6
|
+
const airQualityContainer = Di_1.OutputGatewayContainer.createChildContainer();
|
|
7
|
+
exports.AirQualityContainer = airQualityContainer;
|
|
8
|
+
//# sourceMappingURL=Di.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../src/output-gateway/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,iEAAkF;AAGlF,wBAAwB;AACxB,MAAM,mBAAmB,GAAwB,2BAAsB,CAAC,oBAAoB,EAAE,CAAC;AAM/D,kDAAmB"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { AirQualityIndexModel } from "../../schema-definitions/models/AirQualityIndexModel";
|
|
1
2
|
import { IGeoJsonAllFilterParameters, SequelizeModel } from "@golemio/core/dist/output-gateway";
|
|
2
3
|
import { IGeoJsonModel } from "@golemio/core/dist/output-gateway/models/interfaces/IGeoJsonModel";
|
|
4
|
+
import IAirQualityIndex from "../../schema-definitions/models/interfaces/IAirQualityIndex";
|
|
3
5
|
export default class AirQualityIndexesModel extends SequelizeModel implements IGeoJsonModel {
|
|
4
6
|
constructor();
|
|
5
7
|
GetAll: (options?: IGeoJsonAllFilterParameters) => Promise<any>;
|
|
@@ -7,4 +9,5 @@ export default class AirQualityIndexesModel extends SequelizeModel implements IG
|
|
|
7
9
|
GetProperties: () => never;
|
|
8
10
|
IsPrimaryIdNumber(idKey: string): Promise<boolean>;
|
|
9
11
|
PrimaryIdentifierSelection(arg0: string): object;
|
|
12
|
+
formatResult: (result: AirQualityIndexModel[] | IAirQualityIndex[] | undefined) => import("@golemio/core/dist/output-gateway").IGeoJSONFeatureCollection;
|
|
10
13
|
}
|
|
@@ -19,6 +19,7 @@ const output_gateway_1 = require("@golemio/core/dist/output-gateway");
|
|
|
19
19
|
const sequelize_1 = require("@golemio/core/dist/shared/sequelize");
|
|
20
20
|
const OutputDtoMapper_1 = __importDefault(require("./helpers/OutputDtoMapper"));
|
|
21
21
|
const ParamHelper_1 = require("./helpers/ParamHelper");
|
|
22
|
+
const IAirQualityIndex_1 = __importDefault(require("../../schema-definitions/models/interfaces/IAirQualityIndex"));
|
|
22
23
|
class AirQualityIndexesModel extends output_gateway_1.SequelizeModel {
|
|
23
24
|
constructor() {
|
|
24
25
|
super(_sch_1.AirQualityStations.name + "BaseIndexModel", AirQualityIndexModel_1.AirQualityIndexModel.tableName, AirQualityIndexModel_1.AirQualityIndexModel.attributeModel, {
|
|
@@ -40,11 +41,19 @@ class AirQualityIndexesModel extends output_gateway_1.SequelizeModel {
|
|
|
40
41
|
offset: Number.isInteger(options === null || options === void 0 ? void 0 : options.offset) ? options === null || options === void 0 ? void 0 : options.offset : 0,
|
|
41
42
|
},
|
|
42
43
|
}));
|
|
43
|
-
return
|
|
44
|
+
return this.formatResult(result);
|
|
44
45
|
});
|
|
45
46
|
this.GetProperties = () => {
|
|
46
47
|
throw new Error("Method not implemented.");
|
|
47
48
|
};
|
|
49
|
+
this.formatResult = (result) => {
|
|
50
|
+
if (!result) {
|
|
51
|
+
return (0, output_gateway_1.buildGeojsonFeatureCollection)([]);
|
|
52
|
+
}
|
|
53
|
+
const featureItems = result.map((element) => OutputDtoMapper_1.default.mapToFeatureItem(element));
|
|
54
|
+
const nonEmptyItems = featureItems.filter((item) => item !== undefined);
|
|
55
|
+
return (0, output_gateway_1.buildGeojsonFeatureCollection)(nonEmptyItems);
|
|
56
|
+
};
|
|
48
57
|
}
|
|
49
58
|
GetOne(id) {
|
|
50
59
|
throw new Error("Method not implemented.");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AirQualityIndexesModel.js","sourceRoot":"","sources":["../../../src/output-gateway/models/AirQualityIndexesModel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,iEAAwE;AACxE,mDAA0C;AAC1C,+FAAwE;AACxE,
|
|
1
|
+
{"version":3,"file":"AirQualityIndexesModel.js","sourceRoot":"","sources":["../../../src/output-gateway/models/AirQualityIndexesModel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,iEAAwE;AACxE,mDAA0C;AAC1C,+FAAwE;AACxE,sEAK2C;AAE3C,mEAAiE;AACjE,gFAAwD;AACxD,uDAAoD;AACpD,mHAAuE;AAEvE,MAAqB,sBAAuB,SAAQ,+BAAc;IAC9D;QACI,KAAK,CAAC,yBAAkB,CAAC,IAAI,GAAG,gBAAgB,EAAE,2CAAoB,CAAC,SAAS,EAAE,2CAAoB,CAAC,cAAc,EAAE;YACnH,MAAM,EAAE,yBAAkB,CAAC,QAAQ;SACtC,CAAC,CAAC;QAGA,WAAM,GAAG,CAAO,OAAqC,EAAgB,EAAE;;YAC1E,MAAM,MAAM,GAAG,MAAM,CAAA,MAAA,IAAI,CAAC,cAAc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C,CAAC;YACF,MAAM,aAAa,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAsB,CAAC;YAC7F,OAAO,IAAA,8CAA6B,EAAC,aAAa,CAAC,CAAC;QACxD,CAAC,CAAC;IAhDF,CAAC;IAqBD,MAAM,CAAC,EAAO;QACV,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IAMD,yBAAyB;IACzB,iBAAiB,CAAC,KAAa;QAC3B,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,0BAA0B,CAAC,IAAY;QACnC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IAChC,CAAC;CAaJ;AAtDD,yCAsDC"}
|
package/docs/openapi.yaml
CHANGED
|
@@ -68,15 +68,15 @@ paths:
|
|
|
68
68
|
schema:
|
|
69
69
|
type: string
|
|
70
70
|
example: "2019-05-18T07:38:37.000Z"
|
|
71
|
-
- name: x-access-token
|
|
72
|
-
in: header
|
|
73
|
-
description: e.g. YOUR_ACCESS_TOKEN
|
|
74
|
-
schema:
|
|
75
|
-
type: string
|
|
76
|
-
example: YOUR_ACCESS_TOKEN
|
|
77
71
|
responses:
|
|
78
72
|
200:
|
|
79
73
|
description: OK
|
|
74
|
+
headers:
|
|
75
|
+
Cache-Control:
|
|
76
|
+
description: Cache control directive for caching proxies
|
|
77
|
+
schema:
|
|
78
|
+
type: string
|
|
79
|
+
example: public, s-maxage=1200, stale-while-revalidate=300
|
|
80
80
|
content:
|
|
81
81
|
application/json; charset=utf-8:
|
|
82
82
|
schema:
|
|
@@ -111,6 +111,45 @@ paths:
|
|
|
111
111
|
name: Praha 4-Chodov
|
|
112
112
|
updated_at: "2019-05-18T07:38:37.000Z"
|
|
113
113
|
type: Feature
|
|
114
|
+
401:
|
|
115
|
+
$ref: "#/components/responses/UnauthorizedError"
|
|
116
|
+
403:
|
|
117
|
+
description: Forbidden
|
|
118
|
+
content:
|
|
119
|
+
application/json; charset=utf-8:
|
|
120
|
+
schema:
|
|
121
|
+
$ref: "#/components/schemas/Error"
|
|
122
|
+
example:
|
|
123
|
+
error_message: Forbidden
|
|
124
|
+
error_status: 403
|
|
125
|
+
/v2/airqualitystations/componenttypes:
|
|
126
|
+
get:
|
|
127
|
+
tags:
|
|
128
|
+
- 🌦 Air Quality (v2)
|
|
129
|
+
summary: GET Air Quality Station Component Types
|
|
130
|
+
responses:
|
|
131
|
+
200:
|
|
132
|
+
description: OK
|
|
133
|
+
headers:
|
|
134
|
+
Cache-Control:
|
|
135
|
+
description: Cache control directive for caching proxies
|
|
136
|
+
schema:
|
|
137
|
+
type: string
|
|
138
|
+
example: public, s-maxage=1200, stale-while-revalidate=300
|
|
139
|
+
content:
|
|
140
|
+
application/json; charset=utf-8:
|
|
141
|
+
schema:
|
|
142
|
+
type: array
|
|
143
|
+
items:
|
|
144
|
+
$ref: "#/components/schemas/AirQualityStationComponentType"
|
|
145
|
+
example:
|
|
146
|
+
- id: 1
|
|
147
|
+
component_code: SO2
|
|
148
|
+
unit: µg/m³
|
|
149
|
+
description_cs: oxid siřičitý
|
|
150
|
+
description_en: sulfur dioxide
|
|
151
|
+
401:
|
|
152
|
+
$ref: "#/components/responses/UnauthorizedError"
|
|
114
153
|
403:
|
|
115
154
|
description: Forbidden
|
|
116
155
|
content:
|
|
@@ -157,15 +196,15 @@ paths:
|
|
|
157
196
|
schema:
|
|
158
197
|
type: string
|
|
159
198
|
example: "12345"
|
|
160
|
-
- name: x-access-token
|
|
161
|
-
in: header
|
|
162
|
-
description: e.g. YOUR_ACCESS_TOKEN
|
|
163
|
-
schema:
|
|
164
|
-
type: string
|
|
165
|
-
example: YOUR_ACCESS_TOKEN
|
|
166
199
|
responses:
|
|
167
200
|
200:
|
|
168
201
|
description: OK
|
|
202
|
+
headers:
|
|
203
|
+
Cache-Control:
|
|
204
|
+
description: Cache control directive for caching proxies
|
|
205
|
+
schema:
|
|
206
|
+
type: string
|
|
207
|
+
example: public, s-maxage=1200, stale-while-revalidate=300
|
|
169
208
|
content:
|
|
170
209
|
application/json; charset=utf-8:
|
|
171
210
|
schema:
|
|
@@ -182,6 +221,48 @@ paths:
|
|
|
182
221
|
value: 10.7
|
|
183
222
|
type: NO2
|
|
184
223
|
updated_at: "2019-05-18T07:38:37.000Z"
|
|
224
|
+
401:
|
|
225
|
+
$ref: "#/components/responses/UnauthorizedError"
|
|
226
|
+
403:
|
|
227
|
+
description: Forbidden
|
|
228
|
+
content:
|
|
229
|
+
application/json; charset=utf-8:
|
|
230
|
+
schema:
|
|
231
|
+
$ref: "#/components/schemas/Error"
|
|
232
|
+
example:
|
|
233
|
+
error_message: Forbidden
|
|
234
|
+
error_status: 403
|
|
235
|
+
/v2/airqualitystations/indextypes:
|
|
236
|
+
get:
|
|
237
|
+
tags:
|
|
238
|
+
- 🌦 Air Quality (v2)
|
|
239
|
+
summary: GET Air Quality Station Index Types
|
|
240
|
+
responses:
|
|
241
|
+
200:
|
|
242
|
+
description: OK
|
|
243
|
+
headers:
|
|
244
|
+
Cache-Control:
|
|
245
|
+
description: Cache control directive for caching proxies
|
|
246
|
+
schema:
|
|
247
|
+
type: string
|
|
248
|
+
example: public, s-maxage=1200, stale-while-revalidate=300
|
|
249
|
+
content:
|
|
250
|
+
application/json; charset=utf-8:
|
|
251
|
+
schema:
|
|
252
|
+
type: array
|
|
253
|
+
items:
|
|
254
|
+
$ref: "#/components/schemas/AirQualityStationIndexType"
|
|
255
|
+
example:
|
|
256
|
+
- id: 1
|
|
257
|
+
index_code: 1A
|
|
258
|
+
limit_gte: 0
|
|
259
|
+
limit_lt: 0.34
|
|
260
|
+
color: "009900"
|
|
261
|
+
color_text: "000000"
|
|
262
|
+
description_cs: velmi dobrá až dobrá
|
|
263
|
+
description_en: very good to good
|
|
264
|
+
401:
|
|
265
|
+
$ref: "#/components/responses/UnauthorizedError"
|
|
185
266
|
403:
|
|
186
267
|
description: Forbidden
|
|
187
268
|
content:
|
|
@@ -192,6 +273,13 @@ paths:
|
|
|
192
273
|
error_message: Forbidden
|
|
193
274
|
error_status: 403
|
|
194
275
|
components:
|
|
276
|
+
responses:
|
|
277
|
+
UnauthorizedError:
|
|
278
|
+
description: API key is missing or invalid
|
|
279
|
+
headers:
|
|
280
|
+
x-access-token:
|
|
281
|
+
schema:
|
|
282
|
+
type: string
|
|
195
283
|
schemas:
|
|
196
284
|
Point:
|
|
197
285
|
title: Point
|
|
@@ -283,6 +371,31 @@ components:
|
|
|
283
371
|
type:
|
|
284
372
|
type: string
|
|
285
373
|
example: NO2
|
|
374
|
+
AirQualityStationComponentType:
|
|
375
|
+
title: Air Quality Station Component Type
|
|
376
|
+
type: object
|
|
377
|
+
required:
|
|
378
|
+
- id
|
|
379
|
+
properties:
|
|
380
|
+
id:
|
|
381
|
+
type: number
|
|
382
|
+
example: 1
|
|
383
|
+
component_code:
|
|
384
|
+
type: string
|
|
385
|
+
nullable: true
|
|
386
|
+
example: SO2
|
|
387
|
+
unit:
|
|
388
|
+
type: string
|
|
389
|
+
nullable: true
|
|
390
|
+
example: µg/m³
|
|
391
|
+
description_cs:
|
|
392
|
+
type: string
|
|
393
|
+
nullable: true
|
|
394
|
+
example: oxid siřičitý
|
|
395
|
+
description_en:
|
|
396
|
+
type: string
|
|
397
|
+
nullable: true
|
|
398
|
+
example: sulfur dioxide
|
|
286
399
|
AirQualityStationHistory:
|
|
287
400
|
title: Air Quality Station History
|
|
288
401
|
required:
|
|
@@ -305,3 +418,40 @@ components:
|
|
|
305
418
|
updated_at:
|
|
306
419
|
type: string
|
|
307
420
|
example: "2019-05-18T07:38:37.000Z"
|
|
421
|
+
AirQualityStationIndexType:
|
|
422
|
+
title: Air Quality Station Index Type
|
|
423
|
+
type: object
|
|
424
|
+
required:
|
|
425
|
+
- id
|
|
426
|
+
properties:
|
|
427
|
+
id:
|
|
428
|
+
type: number
|
|
429
|
+
example: 1
|
|
430
|
+
index_code:
|
|
431
|
+
type: string
|
|
432
|
+
nullable: true
|
|
433
|
+
example: 1A
|
|
434
|
+
limit_gte:
|
|
435
|
+
type: number
|
|
436
|
+
nullable: true
|
|
437
|
+
example: 0
|
|
438
|
+
limit_lt:
|
|
439
|
+
type: number
|
|
440
|
+
nullable: true
|
|
441
|
+
example: 0.34
|
|
442
|
+
color:
|
|
443
|
+
type: string
|
|
444
|
+
nullable: true
|
|
445
|
+
example: "009900"
|
|
446
|
+
color_text:
|
|
447
|
+
type: string
|
|
448
|
+
nullable: true
|
|
449
|
+
example: "000000"
|
|
450
|
+
description_cs:
|
|
451
|
+
type: string
|
|
452
|
+
nullable: true
|
|
453
|
+
example: velmi dobrá až dobrá
|
|
454
|
+
description_en:
|
|
455
|
+
type: string
|
|
456
|
+
nullable: true
|
|
457
|
+
example: very good to good
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golemio/air-quality-stations",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Golemio Air Quality Stations Module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@commitlint/config-conventional": "^11.0.0",
|
|
37
37
|
"@golemio/city-districts": "1.2.10",
|
|
38
38
|
"@golemio/cli": "1.5.0",
|
|
39
|
-
"@golemio/core": "1.10.
|
|
39
|
+
"@golemio/core": "1.10.3",
|
|
40
40
|
"@golemio/db-common": "1.1.4",
|
|
41
41
|
"@golemio/eslint-config": "1.1.2",
|
|
42
42
|
"@types/chai": "4.2.3",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"@types/mocha": "^8.2.0",
|
|
45
45
|
"@types/node": "^20.12.7",
|
|
46
46
|
"@types/sinon": "^9.0.10",
|
|
47
|
+
"@types/supertest": "^6.0.2",
|
|
47
48
|
"chai": "4.2.0",
|
|
48
49
|
"chai-as-promised": "7.1.1",
|
|
49
50
|
"cross-env": "^7.0.3",
|
|
@@ -57,6 +58,7 @@
|
|
|
57
58
|
"rimraf": "^3.0.2",
|
|
58
59
|
"sinon": "^9.2.3",
|
|
59
60
|
"source-map-support": "0.5.21",
|
|
61
|
+
"supertest": "^7.0.0",
|
|
60
62
|
"ts-node": "^10.9.1",
|
|
61
63
|
"ts-patch": "3.0.0-beta3",
|
|
62
64
|
"tsconfig-paths": "^4.2.0",
|