@golemio/air-quality-stations 1.0.3-dev.506727417 → 1.0.3
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/integration-engine/AirQualityStationsWorker.d.ts +4 -0
- package/dist/integration-engine/AirQualityStationsWorker.js +34 -6
- package/dist/integration-engine/AirQualityStationsWorker.js.map +1 -1
- package/dist/integration-engine/queueDefinitions.js +10 -0
- package/dist/integration-engine/queueDefinitions.js.map +1 -1
- package/dist/output-gateway/AirQualityHistoryRouter.d.ts +6 -0
- package/dist/output-gateway/AirQualityHistoryRouter.js +27 -0
- package/dist/output-gateway/AirQualityHistoryRouter.js.map +1 -0
- package/dist/output-gateway/AirQualityRouter.d.ts +13 -0
- package/dist/output-gateway/AirQualityRouter.js +57 -0
- package/dist/output-gateway/AirQualityRouter.js.map +1 -0
- package/dist/output-gateway/index.d.ts +1 -0
- package/dist/output-gateway/index.js +14 -0
- package/dist/output-gateway/index.js.map +1 -0
- package/dist/output-gateway/models/AirQualityComponentTypes.d.ts +6 -0
- package/dist/output-gateway/models/AirQualityComponentTypes.js +17 -0
- package/dist/output-gateway/models/AirQualityComponentTypes.js.map +1 -0
- package/dist/output-gateway/models/AirQualityHistoryModel.d.ts +10 -0
- package/dist/output-gateway/models/AirQualityHistoryModel.js +84 -0
- package/dist/output-gateway/models/AirQualityHistoryModel.js.map +1 -0
- package/dist/output-gateway/models/AirQualityIndexTypesModel.d.ts +6 -0
- package/dist/output-gateway/models/AirQualityIndexTypesModel.js +17 -0
- package/dist/output-gateway/models/AirQualityIndexTypesModel.js.map +1 -0
- package/dist/output-gateway/models/AirQualityIndexesModel.d.ts +9 -0
- package/dist/output-gateway/models/AirQualityIndexesModel.js +55 -0
- package/dist/output-gateway/models/AirQualityIndexesModel.js.map +1 -0
- package/dist/output-gateway/models/AirQualityMeasurementsModel.d.ts +6 -0
- package/dist/output-gateway/models/AirQualityMeasurementsModel.js +17 -0
- package/dist/output-gateway/models/AirQualityMeasurementsModel.js.map +1 -0
- package/dist/output-gateway/models/AirQualityStationsModel.d.ts +6 -0
- package/dist/output-gateway/models/AirQualityStationsModel.js +26 -0
- package/dist/output-gateway/models/AirQualityStationsModel.js.map +1 -0
- package/dist/output-gateway/models/helpers/HistoryModelHelper.d.ts +7 -0
- package/dist/output-gateway/models/helpers/HistoryModelHelper.js +34 -0
- package/dist/output-gateway/models/helpers/HistoryModelHelper.js.map +1 -0
- package/dist/output-gateway/models/helpers/OutputDtoMapper.d.ts +7 -0
- package/dist/output-gateway/models/helpers/OutputDtoMapper.js +50 -0
- package/dist/output-gateway/models/helpers/OutputDtoMapper.js.map +1 -0
- package/dist/output-gateway/models/helpers/ParamHelper.d.ts +3 -0
- package/dist/output-gateway/models/helpers/ParamHelper.js +16 -0
- package/dist/output-gateway/models/helpers/ParamHelper.js.map +1 -0
- package/dist/output-gateway/models/helpers/RawQueryProvider.d.ts +2 -0
- package/dist/output-gateway/models/helpers/RawQueryProvider.js +86 -0
- package/dist/output-gateway/models/helpers/RawQueryProvider.js.map +1 -0
- package/dist/schema-definitions/index.js +4 -0
- package/dist/schema-definitions/index.js.map +1 -1
- package/dist/schema-definitions/sequelize-models/AirQualityComponentType.d.ts +10 -0
- package/dist/schema-definitions/sequelize-models/AirQualityComponentType.js +15 -0
- package/dist/schema-definitions/sequelize-models/AirQualityComponentType.js.map +1 -0
- package/dist/schema-definitions/sequelize-models/AirQualityIndex.d.ts +13 -0
- package/dist/schema-definitions/sequelize-models/AirQualityIndex.js +8 -0
- package/dist/schema-definitions/sequelize-models/AirQualityIndex.js.map +1 -0
- package/dist/schema-definitions/sequelize-models/AirQualityIndexType.d.ts +13 -0
- package/dist/schema-definitions/sequelize-models/AirQualityIndexType.js +18 -0
- package/dist/schema-definitions/sequelize-models/AirQualityIndexType.js.map +1 -0
- package/dist/schema-definitions/sequelize-models/interfaces/IAirQualityComponentType.d.ts +7 -0
- package/dist/schema-definitions/sequelize-models/interfaces/IAirQualityComponentType.js +3 -0
- package/dist/schema-definitions/sequelize-models/interfaces/IAirQualityComponentType.js.map +1 -0
- package/dist/schema-definitions/sequelize-models/interfaces/IAirQualityIndex.d.ts +11 -0
- package/dist/schema-definitions/sequelize-models/interfaces/IAirQualityIndex.js +3 -0
- package/dist/schema-definitions/sequelize-models/interfaces/IAirQualityIndex.js.map +1 -0
- package/dist/schema-definitions/sequelize-models/interfaces/IAirQualityIndexType.d.ts +10 -0
- package/dist/schema-definitions/sequelize-models/interfaces/IAirQualityIndexType.js +3 -0
- package/dist/schema-definitions/sequelize-models/interfaces/IAirQualityIndexType.js.map +1 -0
- package/dist/schema-definitions/sequelize-models/interfaces/IAirQualityMeasurement.d.ts +8 -0
- package/dist/schema-definitions/sequelize-models/interfaces/IAirQualityMeasurement.js +3 -0
- package/dist/schema-definitions/sequelize-models/interfaces/IAirQualityMeasurement.js.map +1 -0
- package/dist/schema-definitions/sequelize-models/interfaces/IAirQualityStation.d.ts +15 -0
- package/dist/schema-definitions/sequelize-models/interfaces/IAirQualityStation.js +3 -0
- package/dist/schema-definitions/sequelize-models/interfaces/IAirQualityStation.js.map +1 -0
- package/package.json +59 -56
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { BaseWorker } from "@golemio/core/dist/integration-engine/workers";
|
|
2
2
|
export declare class AirQualityStationsWorker extends BaseWorker {
|
|
3
|
+
private queuePrefix;
|
|
3
4
|
private dataSource1H;
|
|
4
5
|
private dataSource3H;
|
|
5
6
|
private transformation;
|
|
6
7
|
private indexesModel;
|
|
7
8
|
private measurementsModel;
|
|
8
9
|
private stationsModel;
|
|
10
|
+
private cityDistrictModel;
|
|
9
11
|
constructor();
|
|
10
12
|
refresh1HDataInDB: (msg: any) => Promise<void>;
|
|
11
13
|
refresh3HDataInDB: (msg: any) => Promise<void>;
|
|
14
|
+
updateDistrict: (msg: any) => Promise<void>;
|
|
15
|
+
private prepareQueueForDistrictUpdate;
|
|
12
16
|
}
|
|
@@ -8,14 +8,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.AirQualityStationsWorker = void 0;
|
|
13
|
-
const
|
|
16
|
+
const index_1 = require("../schema-definitions/index");
|
|
17
|
+
const CityDistrictModel_1 = __importDefault(require("@golemio/city-districts/dist/integration-engine/models/CityDistrictModel"));
|
|
18
|
+
const integration_engine_1 = require("@golemio/core/dist/integration-engine");
|
|
14
19
|
const config_1 = require("@golemio/core/dist/integration-engine/config");
|
|
15
20
|
const datasources_1 = require("@golemio/core/dist/integration-engine/datasources");
|
|
16
|
-
const models_1 = require("@golemio/core/dist/integration-engine/models");
|
|
17
21
|
const workers_1 = require("@golemio/core/dist/integration-engine/workers");
|
|
18
|
-
const
|
|
22
|
+
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
19
23
|
const _1 = require("./");
|
|
20
24
|
class AirQualityStationsWorker extends workers_1.BaseWorker {
|
|
21
25
|
constructor() {
|
|
@@ -37,7 +41,30 @@ class AirQualityStationsWorker extends workers_1.BaseWorker {
|
|
|
37
41
|
this.measurementsModel.save(transformedData.measurements),
|
|
38
42
|
this.indexesModel.save(transformedData.indexes),
|
|
39
43
|
]);
|
|
44
|
+
this.prepareQueueForDistrictUpdate();
|
|
45
|
+
});
|
|
46
|
+
this.updateDistrict = (msg) => __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
const airQualityStation = JSON.parse(msg.content.toString());
|
|
48
|
+
if (airQualityStation.id) {
|
|
49
|
+
const dbData = yield this.stationsModel.findOne({
|
|
50
|
+
where: { id: airQualityStation.id },
|
|
51
|
+
});
|
|
52
|
+
if (!dbData.district) {
|
|
53
|
+
dbData.district = yield this.cityDistrictModel.getDistrict(dbData.longitude, dbData.latitude);
|
|
54
|
+
dbData.save();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
this.prepareQueueForDistrictUpdate = () => __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
const result = yield this.stationsModel["sequelizeModel"].findAll({ where: { district: null, region_name: "Praha" } });
|
|
60
|
+
const stationIds = result.map((station) => station.id);
|
|
61
|
+
let promises = [];
|
|
62
|
+
for (const stationId of stationIds) {
|
|
63
|
+
promises.push(this.sendMessageToExchange("workers." + this.queuePrefix + ".updateDistrict", JSON.stringify({ id: stationId })));
|
|
64
|
+
}
|
|
65
|
+
yield Promise.all(promises);
|
|
40
66
|
});
|
|
67
|
+
this.queuePrefix = config_1.config.RABBIT_EXCHANGE_NAME + "." + index_1.AirQualityStations.name.toLowerCase();
|
|
41
68
|
this.dataSource1H = new datasources_1.DataSource(index_1.AirQualityStations.name + "1HDataSource", new datasources_1.HTTPProtocolStrategy({
|
|
42
69
|
headers: {},
|
|
43
70
|
method: "GET",
|
|
@@ -49,21 +76,22 @@ class AirQualityStationsWorker extends workers_1.BaseWorker {
|
|
|
49
76
|
url: config_1.config.datasources.AirQualityStations3H,
|
|
50
77
|
}), new datasources_1.JSONDataTypeStrategy({ resultsPath: "" }), new golemio_validator_1.JSONSchemaValidator(index_1.AirQualityStations.name + "3HDataSource", index_1.AirQualityStations.datasourceJsonSchema));
|
|
51
78
|
this.transformation = new _1.AirQualityStationsTransformation();
|
|
52
|
-
this.stationsModel = new
|
|
79
|
+
this.stationsModel = new integration_engine_1.PostgresModel(index_1.AirQualityStations.stations.name + "Model", {
|
|
53
80
|
outputSequelizeAttributes: index_1.AirQualityStations.stations.outputSequelizeAttributes,
|
|
54
81
|
pgTableName: index_1.AirQualityStations.stations.pgTableName,
|
|
55
82
|
savingType: "insertOrUpdate",
|
|
56
83
|
}, new golemio_validator_1.Validator(index_1.AirQualityStations.stations.name + "ModelValidator", index_1.AirQualityStations.stations.outputMongooseSchemaObject));
|
|
57
|
-
this.measurementsModel = new
|
|
84
|
+
this.measurementsModel = new integration_engine_1.PostgresModel(index_1.AirQualityStations.measurements.name + "Model", {
|
|
58
85
|
outputSequelizeAttributes: index_1.AirQualityStations.measurements.outputSequelizeAttributes,
|
|
59
86
|
pgTableName: index_1.AirQualityStations.measurements.pgTableName,
|
|
60
87
|
savingType: "insertOrUpdate",
|
|
61
88
|
}, new golemio_validator_1.Validator(index_1.AirQualityStations.measurements.name + "ModelValidator", index_1.AirQualityStations.measurements.outputMongooseSchemaObject));
|
|
62
|
-
this.indexesModel = new
|
|
89
|
+
this.indexesModel = new integration_engine_1.PostgresModel(index_1.AirQualityStations.indexes.name + "Model", {
|
|
63
90
|
outputSequelizeAttributes: index_1.AirQualityStations.indexes.outputSequelizeAttributes,
|
|
64
91
|
pgTableName: index_1.AirQualityStations.indexes.pgTableName,
|
|
65
92
|
savingType: "insertOrUpdate",
|
|
66
93
|
}, new golemio_validator_1.Validator(index_1.AirQualityStations.indexes.name + "ModelValidator", index_1.AirQualityStations.indexes.outputMongooseSchemaObject));
|
|
94
|
+
this.cityDistrictModel = new CityDistrictModel_1.default();
|
|
67
95
|
}
|
|
68
96
|
}
|
|
69
97
|
exports.AirQualityStationsWorker = AirQualityStationsWorker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AirQualityStationsWorker.js","sourceRoot":"","sources":["../../src/integration-engine/AirQualityStationsWorker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AirQualityStationsWorker.js","sourceRoot":"","sources":["../../src/integration-engine/AirQualityStationsWorker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uDAAgD;AAChD,iIAA0G;AAC1G,8EAAsE;AACtE,yEAAsE;AACtE,mFAA2H;AAC3H,2EAA2E;AAC3E,mFAA6F;AAC7F,yBAAsD;AAEtD,MAAa,wBAAyB,SAAQ,oBAAU;IAUpD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C,IAAI,GAAG,OAAO,EAC9C;YACI,yBAAyB,EAAE,0BAAkB,CAAC,YAAY,CAAC,yBAAyB;YACpF,WAAW,EAAE,0BAAkB,CAAC,YAAY,CAAC,WAAW;YACxD,UAAU,EAAE,gBAAgB;SAC/B,EACD,IAAI,6BAAS,CACT,0BAAkB,CAAC,YAAY,CAAC,IAAI,GAAG,gBAAgB,EACvD,0BAAkB,CAAC,YAAY,CAAC,0BAA0B,CAC7D,CACJ,CAAC;QACF,IAAI,CAAC,YAAY,GAAG,IAAI,kCAAa,CACjC,0BAAkB,CAAC,OAAO,CAAC,IAAI,GAAG,OAAO,EACzC;YACI,yBAAyB,EAAE,0BAAkB,CAAC,OAAO,CAAC,yBAAyB;YAC/E,WAAW,EAAE,0BAAkB,CAAC,OAAO,CAAC,WAAW;YACnD,UAAU,EAAE,gBAAgB;SAC/B,EACD,IAAI,6BAAS,CACT,0BAAkB,CAAC,OAAO,CAAC,IAAI,GAAG,gBAAgB,EAClD,0BAAkB,CAAC,OAAO,CAAC,0BAA0B,CACxD,CACJ,CAAC;QAEF,IAAI,CAAC,iBAAiB,GAAG,IAAI,2BAAkB,EAAE,CAAC;IACtD,CAAC;CAmDJ;AA3HD,4DA2HC"}
|
|
@@ -29,6 +29,16 @@ const queueDefinitions = [
|
|
|
29
29
|
worker: AirQualityStationsWorker_1.AirQualityStationsWorker,
|
|
30
30
|
workerMethod: "refresh3HDataInDB",
|
|
31
31
|
},
|
|
32
|
+
{
|
|
33
|
+
name: "updateDistrict",
|
|
34
|
+
options: {
|
|
35
|
+
deadLetterExchange: config_1.config.RABBIT_EXCHANGE_NAME,
|
|
36
|
+
deadLetterRoutingKey: "dead",
|
|
37
|
+
messageTtl: 23 * 60 * 60 * 1000, // 23 hours
|
|
38
|
+
},
|
|
39
|
+
worker: AirQualityStationsWorker_1.AirQualityStationsWorker,
|
|
40
|
+
workerMethod: "updateDistrict",
|
|
41
|
+
},
|
|
32
42
|
],
|
|
33
43
|
},
|
|
34
44
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queueDefinitions.js","sourceRoot":"","sources":["../../src/integration-engine/queueDefinitions.ts"],"names":[],"mappings":";;;AAAA,yEAAsE;AAEtE,uDAAgD;AAChD,yEAAwE;AAExE,MAAM,gBAAgB,GAAuB;IACzC;QACI,IAAI,EAAE,0BAAkB,CAAC,IAAI;QAC7B,WAAW,EAAE,eAAM,CAAC,oBAAoB,GAAG,GAAG,GAAG,0BAAkB,CAAC,IAAI,CAAC,WAAW,EAAE;QACtF,MAAM,EAAE;YACJ;gBACI,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE;oBACL,kBAAkB,EAAE,eAAM,CAAC,oBAAoB;oBAC/C,oBAAoB,EAAE,MAAM;oBAC5B,UAAU,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,aAAa;iBAC5C;gBACD,MAAM,EAAE,mDAAwB;gBAChC,YAAY,EAAE,mBAAmB;aACpC;YACD;gBACI,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE;oBACL,kBAAkB,EAAE,eAAM,CAAC,oBAAoB;oBAC/C,oBAAoB,EAAE,MAAM;oBAC5B,UAAU,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,aAAa;iBAC5C;gBACD,MAAM,EAAE,mDAAwB;gBAChC,YAAY,EAAE,mBAAmB;aACpC;SACJ;KACJ;CACJ,CAAC;AAEO,4CAAgB"}
|
|
1
|
+
{"version":3,"file":"queueDefinitions.js","sourceRoot":"","sources":["../../src/integration-engine/queueDefinitions.ts"],"names":[],"mappings":";;;AAAA,yEAAsE;AAEtE,uDAAgD;AAChD,yEAAwE;AAExE,MAAM,gBAAgB,GAAuB;IACzC;QACI,IAAI,EAAE,0BAAkB,CAAC,IAAI;QAC7B,WAAW,EAAE,eAAM,CAAC,oBAAoB,GAAG,GAAG,GAAG,0BAAkB,CAAC,IAAI,CAAC,WAAW,EAAE;QACtF,MAAM,EAAE;YACJ;gBACI,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE;oBACL,kBAAkB,EAAE,eAAM,CAAC,oBAAoB;oBAC/C,oBAAoB,EAAE,MAAM;oBAC5B,UAAU,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,aAAa;iBAC5C;gBACD,MAAM,EAAE,mDAAwB;gBAChC,YAAY,EAAE,mBAAmB;aACpC;YACD;gBACI,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE;oBACL,kBAAkB,EAAE,eAAM,CAAC,oBAAoB;oBAC/C,oBAAoB,EAAE,MAAM;oBAC5B,UAAU,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,aAAa;iBAC5C;gBACD,MAAM,EAAE,mDAAwB;gBAChC,YAAY,EAAE,mBAAmB;aACpC;YACD;gBACI,IAAI,EAAE,gBAAgB;gBACtB,OAAO,EAAE;oBACL,kBAAkB,EAAE,eAAM,CAAC,oBAAoB;oBAC/C,oBAAoB,EAAE,MAAM;oBAC5B,UAAU,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,WAAW;iBAC/C;gBACD,MAAM,EAAE,mDAAwB;gBAChC,YAAY,EAAE,gBAAgB;aACjC;SACJ;KACJ;CACJ,CAAC;AAEO,4CAAgB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AbstractHistoryRouter } from "@golemio/core/dist/output-gateway/routes/AbstractHistoryRouter";
|
|
2
|
+
import { ValidationChain } from "express-validator/check";
|
|
3
|
+
export default class AirQualityHistoryRouter extends AbstractHistoryRouter {
|
|
4
|
+
constructor();
|
|
5
|
+
protected GetIdQueryParamWithCorrectType: () => Promise<ValidationChain>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const AbstractHistoryRouter_1 = require("@golemio/core/dist/output-gateway/routes/AbstractHistoryRouter");
|
|
16
|
+
const check_1 = require("express-validator/check");
|
|
17
|
+
const AirQualityHistoryModel_1 = __importDefault(require("./models/AirQualityHistoryModel"));
|
|
18
|
+
class AirQualityHistoryRouter extends AbstractHistoryRouter_1.AbstractHistoryRouter {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(new AirQualityHistoryModel_1.default());
|
|
21
|
+
this.GetIdQueryParamWithCorrectType = () => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
return (0, check_1.query)("sensorId.*").optional().isString();
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.default = AirQualityHistoryRouter;
|
|
27
|
+
//# sourceMappingURL=AirQualityHistoryRouter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AirQualityHistoryRouter.js","sourceRoot":"","sources":["../../src/output-gateway/AirQualityHistoryRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,0GAAuG;AACvG,mDAAiE;AACjE,6FAA2D;AAE3D,MAAqB,uBAAwB,SAAQ,6CAAqB;IACtE;QACI,KAAK,CAAC,IAAI,gCAAY,EAAE,CAAC,CAAC;QAGpB,mCAA8B,GAAG,GAAmC,EAAE;YAC5E,OAAO,IAAA,aAAK,EAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC;QACrD,CAAC,CAAA,CAAC;IAJF,CAAC;CAKJ;AARD,0CAQC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="express" />
|
|
2
|
+
import { GeoJsonRouter } from "@golemio/core/dist/output-gateway";
|
|
3
|
+
import { NextFunction, Request, Response, Router } from "@golemio/core/dist/shared/express";
|
|
4
|
+
export default class AirQualityRouter extends GeoJsonRouter {
|
|
5
|
+
router: Router;
|
|
6
|
+
private airQualityComponentTypes;
|
|
7
|
+
private airQualityIndexTypes;
|
|
8
|
+
constructor();
|
|
9
|
+
GetIndexTypes: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
10
|
+
GetComponentTypes: (req: Request, res: Response, next: any) => Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
declare const airQualityRouter: Router;
|
|
13
|
+
export { airQualityRouter };
|
|
@@ -0,0 +1,57 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.airQualityRouter = void 0;
|
|
16
|
+
const output_gateway_1 = require("@golemio/core/dist/output-gateway");
|
|
17
|
+
const express_1 = require("@golemio/core/dist/shared/express");
|
|
18
|
+
const AirQualityHistoryRouter_1 = __importDefault(require("./AirQualityHistoryRouter"));
|
|
19
|
+
const AirQualityComponentTypes_1 = __importDefault(require("./models/AirQualityComponentTypes"));
|
|
20
|
+
const AirQualityIndexesModel_1 = __importDefault(require("./models/AirQualityIndexesModel"));
|
|
21
|
+
const AirQualityIndexTypesModel_1 = __importDefault(require("./models/AirQualityIndexTypesModel"));
|
|
22
|
+
class AirQualityRouter extends output_gateway_1.GeoJsonRouter {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(new AirQualityIndexesModel_1.default());
|
|
25
|
+
this.router = (0, express_1.Router)();
|
|
26
|
+
this.GetIndexTypes = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
try {
|
|
28
|
+
const data = yield this.airQualityIndexTypes.GetAll();
|
|
29
|
+
res.status(200).send(data);
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
next(err);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
this.GetComponentTypes = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
try {
|
|
37
|
+
const data = yield this.airQualityComponentTypes.GetAll();
|
|
38
|
+
res.status(200).send(data);
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
next(err);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
this.initRoutes();
|
|
45
|
+
this.router.get("/indextypes", (0, output_gateway_1.useCacheMiddleware)(), this.GetIndexTypes);
|
|
46
|
+
this.router.get("/componenttypes", (0, output_gateway_1.useCacheMiddleware)(), this.GetComponentTypes);
|
|
47
|
+
this.airQualityComponentTypes = new AirQualityComponentTypes_1.default();
|
|
48
|
+
this.airQualityIndexTypes = new AirQualityIndexTypesModel_1.default();
|
|
49
|
+
const historyRouter = new AirQualityHistoryRouter_1.default();
|
|
50
|
+
historyRouter.initRoutes();
|
|
51
|
+
this.router.use("/history", historyRouter.router);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.default = AirQualityRouter;
|
|
55
|
+
const airQualityRouter = new AirQualityRouter().router;
|
|
56
|
+
exports.airQualityRouter = airQualityRouter;
|
|
57
|
+
//# sourceMappingURL=AirQualityRouter.js.map
|
|
@@ -0,0 +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;QAkB1B,kBAAa,GAAG,CAAO,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;YAC7E,IAAI;gBACA,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,CAAC;gBACtD,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;QAEK,sBAAiB,GAAG,CAAO,GAAY,EAAE,GAAa,EAAE,IAAS,EAAE,EAAE;YACxE,IAAI;gBACA,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,wBAAwB,CAAC,MAAM,EAAE,CAAC;gBAC1D,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;QA5BE,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,aAAa,EAAE,IAAA,mCAAkB,GAAE,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QACzE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAA,mCAAkB,GAAE,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAEjF,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;AApCD,mCAoCC;AAED,MAAM,gBAAgB,GAAW,IAAI,gBAAgB,EAAE,CAAC,MAAM,CAAC;AAEtD,4CAAgB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./AirQualityRouter";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./AirQualityRouter"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/output-gateway/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAmC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const AirQualityComponentType_1 = require("../../schema-definitions/sequelize-models/AirQualityComponentType");
|
|
4
|
+
const output_gateway_1 = require("@golemio/core/dist/output-gateway");
|
|
5
|
+
class AirQualityComponentTypeModel extends output_gateway_1.SequelizeModel {
|
|
6
|
+
constructor() {
|
|
7
|
+
super("AirQualityComponentTypesModel", "airqualitystations_component_types", AirQualityComponentType_1.AirQualityComponentType.attributeModel);
|
|
8
|
+
this.GetAll = (options) => {
|
|
9
|
+
return this.sequelizeModel.findAll();
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
GetOne(id) {
|
|
13
|
+
throw new Error("Method not implemented.");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.default = AirQualityComponentTypeModel;
|
|
17
|
+
//# sourceMappingURL=AirQualityComponentTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AirQualityComponentTypes.js","sourceRoot":"","sources":["../../../src/output-gateway/models/AirQualityComponentTypes.ts"],"names":[],"mappings":";;AAAA,+GAAwF;AACxF,sEAAmE;AAEnE,MAAqB,4BAA6B,SAAQ,+BAAc;IACpE;QACI,KAAK,CAAC,+BAA+B,EAAE,oCAAoC,EAAE,iDAAuB,CAAC,cAAc,CAAC,CAAC;QAGlH,WAAM,GAAG,CAAC,OAAa,EAAgB,EAAE;YAC5C,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,EAA2B,CAAC;QAClE,CAAC,CAAC;IAJF,CAAC;IAMD,MAAM,CAAC,EAAO;QACV,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;CACJ;AAZD,+CAYC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SequelizeModel } from "@golemio/core/dist/output-gateway";
|
|
2
|
+
import { IBaseModel } from "@golemio/core/dist/output-gateway/models/interfaces/IBaseModel";
|
|
3
|
+
import IHistoryFilterParameters from "@golemio/core/dist/output-gateway/routes/interfaces/IHistoryFilterParameters";
|
|
4
|
+
export default class HistoryModel extends SequelizeModel implements IBaseModel {
|
|
5
|
+
private stationModel;
|
|
6
|
+
private measurementsModel;
|
|
7
|
+
constructor();
|
|
8
|
+
GetAll: (options?: IHistoryFilterParameters | undefined) => Promise<any>;
|
|
9
|
+
GetOne(id: any): Promise<any>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const _sch_1 = require("../../schema-definitions");
|
|
16
|
+
const output_gateway_1 = require("@golemio/core/dist/output-gateway");
|
|
17
|
+
const sequelize_1 = __importDefault(require("@golemio/core/dist/shared/sequelize"));
|
|
18
|
+
const AirQualityMeasurementsModel_1 = __importDefault(require("./AirQualityMeasurementsModel"));
|
|
19
|
+
const AirQualityStationsModel_1 = __importDefault(require("./AirQualityStationsModel"));
|
|
20
|
+
const HistoryModelHelper_1 = __importDefault(require("./helpers/HistoryModelHelper"));
|
|
21
|
+
const OutputDtoMapper_1 = __importDefault(require("./helpers/OutputDtoMapper"));
|
|
22
|
+
const ParamHelper_1 = require("./helpers/ParamHelper");
|
|
23
|
+
class HistoryModel extends output_gateway_1.SequelizeModel {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(_sch_1.AirQualityStations.indexes.name + "Model", _sch_1.AirQualityStations.indexes.pgTableName, _sch_1.AirQualityStations.indexes.outputSequelizeAttributes);
|
|
26
|
+
this.GetAll = (options) => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const result = yield this.sequelizeModel.findAll({
|
|
28
|
+
attributes: {
|
|
29
|
+
include: ["updated_at"],
|
|
30
|
+
},
|
|
31
|
+
include: [
|
|
32
|
+
{
|
|
33
|
+
model: this.stationModel.sequelizeModel,
|
|
34
|
+
attributes: {
|
|
35
|
+
include: ["updated_at"],
|
|
36
|
+
},
|
|
37
|
+
as: "station",
|
|
38
|
+
required: true,
|
|
39
|
+
where: {
|
|
40
|
+
[sequelize_1.default.Op.and]: [
|
|
41
|
+
{ region_code: "A" },
|
|
42
|
+
...HistoryModelHelper_1.default.filterByStationId(options),
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
model: this.measurementsModel.sequelizeModel,
|
|
48
|
+
where: sequelize_1.default.literal(`airqualitystations_indexes.measured_from = measurements.measured_from
|
|
49
|
+
and airqualitystations_indexes.measured_to = measurements.measured_to`),
|
|
50
|
+
as: "measurements",
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
where: options
|
|
54
|
+
? {
|
|
55
|
+
[sequelize_1.default.Op.and]: [
|
|
56
|
+
...HistoryModelHelper_1.default.filterByMeasuredFrom(options),
|
|
57
|
+
...HistoryModelHelper_1.default.filterByMeasuredTo(options),
|
|
58
|
+
],
|
|
59
|
+
}
|
|
60
|
+
: {},
|
|
61
|
+
limit: ParamHelper_1.ParamHelper.getPaginationLimit(options === null || options === void 0 ? void 0 : options.limit),
|
|
62
|
+
offset: Number.isInteger(options === null || options === void 0 ? void 0 : options.offset) ? options === null || options === void 0 ? void 0 : options.offset : 0,
|
|
63
|
+
});
|
|
64
|
+
return result.map((element) => OutputDtoMapper_1.default.mapToHistoricItem(element));
|
|
65
|
+
});
|
|
66
|
+
this.stationModel = new AirQualityStationsModel_1.default();
|
|
67
|
+
this.measurementsModel = new AirQualityMeasurementsModel_1.default();
|
|
68
|
+
this.sequelizeModel.hasOne(this.stationModel.sequelizeModel, {
|
|
69
|
+
sourceKey: "station_id",
|
|
70
|
+
foreignKey: "id",
|
|
71
|
+
as: "station",
|
|
72
|
+
});
|
|
73
|
+
this.sequelizeModel.hasMany(this.measurementsModel.sequelizeModel, {
|
|
74
|
+
sourceKey: "station_id",
|
|
75
|
+
foreignKey: "station_id",
|
|
76
|
+
as: "measurements",
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
GetOne(id) {
|
|
80
|
+
throw new Error("Method not implemented.");
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.default = HistoryModel;
|
|
84
|
+
//# sourceMappingURL=AirQualityHistoryModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AirQualityHistoryModel.js","sourceRoot":"","sources":["../../../src/output-gateway/models/AirQualityHistoryModel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,mDAA0C;AAE1C,sEAAmE;AAGnE,oFAA4D;AAC5D,gGAAwE;AACxE,wFAAgE;AAChE,sFAAoE;AACpE,gFAAwD;AACxD,uDAAoD;AAEpD,MAAqB,YAAa,SAAQ,+BAAc;IAIpD;QACI,KAAK,CACD,yBAAk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AO,uBAAP,OAAO,CAAE,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,CAAC,CAAC,CAAC,CAAC;aAClE,CAAC,CAAC;YAEH,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,yBAAe,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/E,CAAC,CAAA,CAAC;QA1DE,IAAI,CAAC,YAAY,GAAG,IAAI,iCAAuB,EAAE,CAAC;QAClD,IAAI,CAAC,iBAAiB,GAAG,IAAI,qCAA2B,EAAE,CAAC;QAE3D,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE;YACzD,SAAS,EAAE,YAAY;YACvB,UAAU,EAAE,IAAI;YAChB,EAAE,EAAE,SAAS;SAChB,CAAC,CAAC;QAEH,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,cAAc,EAAE;YAC/D,SAAS,EAAE,YAAY;YACvB,UAAU,EAAE,YAAY;YACxB,EAAE,EAAE,cAAc;SACrB,CAAC,CAAC;IACP,CAAC;IA8CM,MAAM,CAAC,EAAO;QACjB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;CACJ;AA1ED,+BA0EC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const AirQualityIndexType_1 = require("../../schema-definitions/sequelize-models/AirQualityIndexType");
|
|
4
|
+
const output_gateway_1 = require("@golemio/core/dist/output-gateway");
|
|
5
|
+
class AirQualityIndexTypeModel extends output_gateway_1.SequelizeModel {
|
|
6
|
+
constructor() {
|
|
7
|
+
super("AirQualityIndexTypesModel", "airqualitystations_index_types", AirQualityIndexType_1.AirQualityIndexType.attributeModel);
|
|
8
|
+
this.GetAll = (options) => {
|
|
9
|
+
return this.sequelizeModel.findAll();
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
GetOne(id) {
|
|
13
|
+
throw new Error("Method not implemented.");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.default = AirQualityIndexTypeModel;
|
|
17
|
+
//# sourceMappingURL=AirQualityIndexTypesModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AirQualityIndexTypesModel.js","sourceRoot":"","sources":["../../../src/output-gateway/models/AirQualityIndexTypesModel.ts"],"names":[],"mappings":";;AACA,uGAAgF;AAChF,sEAAmE;AAEnE,MAAqB,wBAAyB,SAAQ,+BAAc;IAChE;QACI,KAAK,CAAC,2BAA2B,EAAE,gCAAgC,EAAE,yCAAmB,CAAC,cAAc,CAAC,CAAC;QAGtG,WAAM,GAAG,CAAC,OAAa,EAAgB,EAAE;YAC5C,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,EAA2B,CAAC;QAClE,CAAC,CAAC;IAJF,CAAC;IAMD,MAAM,CAAC,EAAO;QACV,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;CACJ;AAZD,2CAYC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IGeoJsonAllFilterParameters, SequelizeModel } from "@golemio/core/dist/output-gateway";
|
|
2
|
+
import { IGeoJsonModel } from "@golemio/core/dist/output-gateway/models/interfaces/IGeoJsonModel";
|
|
3
|
+
export default class AirQualityIndexesModel extends SequelizeModel implements IGeoJsonModel {
|
|
4
|
+
constructor();
|
|
5
|
+
GetAll: (options?: IGeoJsonAllFilterParameters | undefined) => Promise<any>;
|
|
6
|
+
GetOne(id: any): Promise<any>;
|
|
7
|
+
IsPrimaryIdNumber(idKey: string): Promise<boolean>;
|
|
8
|
+
PrimaryIdentifierSelection(arg0: string): object;
|
|
9
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const RawQueryProvider_1 = require("./helpers/RawQueryProvider");
|
|
16
|
+
const index_1 = require("../../schema-definitions/index");
|
|
17
|
+
const output_gateway_1 = require("@golemio/core/dist/output-gateway");
|
|
18
|
+
const sequelize_1 = require("@golemio/core/dist/shared/sequelize");
|
|
19
|
+
const OutputDtoMapper_1 = __importDefault(require("./helpers/OutputDtoMapper"));
|
|
20
|
+
const ParamHelper_1 = require("./helpers/ParamHelper");
|
|
21
|
+
class AirQualityIndexesModel extends output_gateway_1.SequelizeModel {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(index_1.AirQualityStations.indexes.name + "BaseModel", index_1.AirQualityStations.indexes.pgTableName, index_1.AirQualityStations.indexes.outputSequelizeAttributes);
|
|
24
|
+
this.GetAll = (options) => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
var _a;
|
|
26
|
+
const result = yield ((_a = this.sequelizeModel.sequelize) === null || _a === void 0 ? void 0 : _a.query((0, RawQueryProvider_1.buildIndexesQuery)(options), {
|
|
27
|
+
type: sequelize_1.QueryTypes.SELECT,
|
|
28
|
+
nest: true,
|
|
29
|
+
raw: true,
|
|
30
|
+
replacements: {
|
|
31
|
+
districts: options === null || options === void 0 ? void 0 : options.districts,
|
|
32
|
+
updatedAt: options === null || options === void 0 ? void 0 : options.updatedSince,
|
|
33
|
+
longitude: options === null || options === void 0 ? void 0 : options.lng,
|
|
34
|
+
latitude: options === null || options === void 0 ? void 0 : options.lat,
|
|
35
|
+
range: options === null || options === void 0 ? void 0 : options.range,
|
|
36
|
+
limit: ParamHelper_1.ParamHelper.getPaginationLimit(options === null || options === void 0 ? void 0 : options.limit),
|
|
37
|
+
offset: Number.isInteger(options === null || options === void 0 ? void 0 : options.offset) ? options === null || options === void 0 ? void 0 : options.offset : 0,
|
|
38
|
+
},
|
|
39
|
+
}));
|
|
40
|
+
return (0, output_gateway_1.buildGeojsonFeatureCollection)(result === null || result === void 0 ? void 0 : result.map((element) => OutputDtoMapper_1.default.mapToFeatureItem(element)));
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
GetOne(id) {
|
|
44
|
+
throw new Error("Method not implemented.");
|
|
45
|
+
}
|
|
46
|
+
//backwards compatibility
|
|
47
|
+
IsPrimaryIdNumber(idKey) {
|
|
48
|
+
return Promise.resolve(false);
|
|
49
|
+
}
|
|
50
|
+
PrimaryIdentifierSelection(arg0) {
|
|
51
|
+
return { station_id: arg0 };
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.default = AirQualityIndexesModel;
|
|
55
|
+
//# sourceMappingURL=AirQualityIndexesModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AirQualityIndexesModel.js","sourceRoot":"","sources":["../../../src/output-gateway/models/AirQualityIndexesModel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,iEAAwE;AACxE,0DAAgD;AAEhD,sEAA+H;AAE/H,mEAAiE;AACjE,gFAAwD;AACxD,uDAAoD;AAEpD,MAAqB,sBAAuB,SAAQ,+BAAc;IAC9D;QACI,KAAK,CACD,0BAAkB,CAAC,O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;IAqBD,MAAM,CAAC,EAAO;QACV,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IAED,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;CACJ;AAxCD,yCAwCC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_1 = require("../../schema-definitions/index");
|
|
4
|
+
const output_gateway_1 = require("@golemio/core/dist/output-gateway");
|
|
5
|
+
class AirQualityMeasurementsModel extends output_gateway_1.SequelizeModel {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(index_1.AirQualityStations.measurements.name + "Model", index_1.AirQualityStations.measurements.pgTableName, index_1.AirQualityStations.measurements.outputSequelizeAttributes);
|
|
8
|
+
}
|
|
9
|
+
GetAll(options) {
|
|
10
|
+
throw new Error("Method not implemented.");
|
|
11
|
+
}
|
|
12
|
+
GetOne(id) {
|
|
13
|
+
throw new Error("Method not implemented.");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.default = AirQualityMeasurementsModel;
|
|
17
|
+
//# sourceMappingURL=AirQualityMeasurementsModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AirQualityMeasurementsModel.js","sourceRoot":"","sources":["../../../src/output-gateway/models/AirQualityMeasurementsModel.ts"],"names":[],"mappings":";;AAAA,0DAAgD;AAChD,sEAAmE;AAEnE,MAAqB,2BAA4B,SAAQ,+BAAc;IACnE;QACI,KAAK,CACD,0BAAkB,CAAC,YAAY,CAAC,IAAI,GAAG,OAAO,EAC9C,0BAAkB,CAAC,YAAY,CAAC,WAAW,EAC3C,0BAAkB,CAAC,YAAY,CAAC,yBAAyB,CAC5D,CAAC;IACN,CAAC;IAED,MAAM,CAAC,OAAa;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IACD,MAAM,CAAC,EAAO;QACV,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;CACJ;AAfD,8CAeC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IGeoJsonAllFilterParameters, SequelizeModel } from "@golemio/core/dist/output-gateway";
|
|
2
|
+
export default class AirQualityStationsModel extends SequelizeModel {
|
|
3
|
+
constructor();
|
|
4
|
+
GetAll: (options?: IGeoJsonAllFilterParameters | undefined) => Promise<any>;
|
|
5
|
+
GetOne(id: any): Promise<any>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const index_1 = require("../../schema-definitions/index");
|
|
13
|
+
const output_gateway_1 = require("@golemio/core/dist/output-gateway");
|
|
14
|
+
class AirQualityStationsModel extends output_gateway_1.SequelizeModel {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(index_1.AirQualityStations.stations.name + "Model", index_1.AirQualityStations.stations.pgTableName, index_1.AirQualityStations.stations.outputSequelizeAttributes);
|
|
17
|
+
this.GetAll = (options) => __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
throw new Error("Method not implemented.");
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
GetOne(id) {
|
|
22
|
+
throw new Error("Method not implemented.");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.default = AirQualityStationsModel;
|
|
26
|
+
//# sourceMappingURL=AirQualityStationsModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AirQualityStationsModel.js","sourceRoot":"","sources":["../../../src/output-gateway/models/AirQualityStationsModel.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,0DAAgD;AAChD,sEAAgG;AAEhG,MAAqB,uBAAwB,SAAQ,+BAAc;IAC/D;QACI,KAAK,CACD,0BAAkB,CAAC,QAAQ,CAAC,IAAI,GAAG,OAAO,EAC1C,0BAAkB,CAAC,QAAQ,CAAC,WAAW,EACvC,0BAAkB,CAAC,QAAQ,CAAC,yBAAyB,CACxD,CAAC;QAGN,WAAM,GAAG,CAAO,OAAqC,EAAgB,EAAE;YACnE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAC/C,CAAC,CAAA,CAAC;IAJF,CAAC;IAMD,MAAM,CAAC,EAAO;QACV,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;CACJ;AAhBD,0CAgBC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import IHistoryFilterParameters from "@golemio/core/dist/output-gateway/routes/interfaces/IHistoryFilterParameters";
|
|
2
|
+
import { WhereOptions } from "@golemio/core/dist/shared/sequelize";
|
|
3
|
+
export default class HistoryModelHelper {
|
|
4
|
+
static filterByMeasuredFrom(options: IHistoryFilterParameters): WhereOptions[];
|
|
5
|
+
static filterByMeasuredTo(options: IHistoryFilterParameters): WhereOptions[];
|
|
6
|
+
static filterByStationId(options: IHistoryFilterParameters | undefined): WhereOptions[];
|
|
7
|
+
}
|