@golemio/energetics 1.3.8-dev.1352571662 → 1.3.8
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/db/example/00_clear_test_data.sql +0 -1
- package/db/example/04_measurements.sql +26 -26
- package/dist/integration-engine/commodity-providers/ioc/Di.js +4 -14
- package/dist/integration-engine/commodity-providers/ioc/Di.js.map +1 -1
- package/dist/integration-engine/commodity-providers/ioc/WorkerContainerToken.d.ts +0 -6
- package/dist/integration-engine/commodity-providers/ioc/WorkerContainerToken.js +0 -6
- package/dist/integration-engine/commodity-providers/ioc/WorkerContainerToken.js.map +1 -1
- package/dist/integration-engine/commodity-providers/transformations/AveMeasurementTransformation.d.ts +1 -0
- package/dist/integration-engine/commodity-providers/transformations/AveMeasurementTransformation.js +4 -1
- package/dist/integration-engine/commodity-providers/transformations/AveMeasurementTransformation.js.map +1 -1
- package/dist/integration-engine/commodity-providers/transformations/CemMeasurementTransformation.d.ts +1 -1
- package/dist/integration-engine/commodity-providers/transformations/CemMeasurementTransformation.js +6 -6
- package/dist/integration-engine/commodity-providers/transformations/CemMeasurementTransformation.js.map +1 -1
- package/dist/integration-engine/commodity-providers/transformations/PreElectroTransformation.js +1 -1
- package/dist/integration-engine/commodity-providers/transformations/PreElectroTransformation.js.map +1 -1
- package/dist/integration-engine/commodity-providers/workers/CommodityWorker.js +0 -2
- package/dist/integration-engine/commodity-providers/workers/CommodityWorker.js.map +1 -1
- package/dist/integration-engine/commodity-providers/workers/interfaces/IPpasMeasurementsParams.d.ts +1 -1
- package/dist/integration-engine/commodity-providers/workers/schema/PpasMeasurementsSchema.d.ts +1 -1
- package/dist/integration-engine/commodity-providers/workers/schema/PpasMeasurementsSchema.js +1 -7
- package/dist/integration-engine/commodity-providers/workers/schema/PpasMeasurementsSchema.js.map +1 -1
- package/dist/integration-engine/commodity-providers/workers/tasks/FetchMeasurementOptionsStaticDataTask.d.ts +1 -3
- package/dist/integration-engine/commodity-providers/workers/tasks/FetchMeasurementOptionsStaticDataTask.js +3 -12
- package/dist/integration-engine/commodity-providers/workers/tasks/FetchMeasurementOptionsStaticDataTask.js.map +1 -1
- package/dist/integration-engine/commodity-providers/workers/tasks/FetchPpasMeasurementsTask.d.ts +13 -22
- package/dist/integration-engine/commodity-providers/workers/tasks/FetchPpasMeasurementsTask.js.map +1 -1
- package/dist/integration-engine/ioc/Di.js.map +1 -1
- package/dist/integration-engine/workers/oict-energetika/OictEnergetikaWorker.js +0 -2
- package/dist/integration-engine/workers/oict-energetika/OictEnergetikaWorker.js.map +1 -1
- package/dist/output-gateway/controllers/v2/BuildingsController.d.ts +3 -6
- package/dist/output-gateway/controllers/v2/BuildingsController.js +13 -26
- package/dist/output-gateway/controllers/v2/BuildingsController.js.map +1 -1
- package/dist/output-gateway/controllers/v2/V2DevicesController.d.ts +3 -5
- package/dist/output-gateway/controllers/v2/V2DevicesController.js +8 -15
- package/dist/output-gateway/controllers/v2/V2DevicesController.js.map +1 -1
- package/dist/output-gateway/controllers/v2/V2MeasurementsController.d.ts +3 -5
- package/dist/output-gateway/controllers/v2/V2MeasurementsController.js +8 -15
- package/dist/output-gateway/controllers/v2/V2MeasurementsController.js.map +1 -1
- package/dist/output-gateway/controllers/v2/V2OrganizationsController.d.ts +4 -6
- package/dist/output-gateway/controllers/v2/V2OrganizationsController.js +10 -17
- package/dist/output-gateway/controllers/v2/V2OrganizationsController.js.map +1 -1
- package/dist/output-gateway/ioc/Di.js +1 -9
- package/dist/output-gateway/ioc/Di.js.map +1 -1
- package/dist/output-gateway/ioc/ModuleContainerToken.d.ts +0 -2
- package/dist/output-gateway/ioc/ModuleContainerToken.js +0 -2
- package/dist/output-gateway/ioc/ModuleContainerToken.js.map +1 -1
- package/dist/output-gateway/models/BuildingsPrimaryModel.js.map +1 -0
- package/dist/output-gateway/models/interfaces/IPrimaryBuildings.js.map +1 -0
- package/dist/output-gateway/repositories/DevicesRepository.d.ts +3 -4
- package/dist/output-gateway/repositories/DevicesRepository.js +5 -19
- package/dist/output-gateway/repositories/DevicesRepository.js.map +1 -1
- package/dist/output-gateway/repositories/MeasurementRepository.d.ts +2 -3
- package/dist/output-gateway/repositories/MeasurementRepository.js +20 -29
- package/dist/output-gateway/repositories/MeasurementRepository.js.map +1 -1
- package/dist/output-gateway/repositories/OrganizationsRepository.d.ts +3 -3
- package/dist/output-gateway/repositories/OrganizationsRepository.js +4 -7
- package/dist/output-gateway/repositories/OrganizationsRepository.js.map +1 -1
- package/dist/output-gateway/repositories/PrimaryBuildingsRepository.d.ts +4 -5
- package/dist/output-gateway/repositories/PrimaryBuildingsRepository.js +5 -20
- package/dist/output-gateway/repositories/PrimaryBuildingsRepository.js.map +1 -1
- package/dist/output-gateway/routers/v2/V2BuildingsRouter.js +2 -2
- package/dist/output-gateway/routers/v2/V2BuildingsRouter.js.map +1 -1
- package/dist/output-gateway/transformations/BuildingTransformationFull.d.ts +1 -1
- package/dist/output-gateway/transformations/BuildingsTransformation.d.ts +1 -1
- package/dist/schema-definitions/models/MeasurementsModel.js +1 -0
- package/dist/schema-definitions/models/MeasurementsModel.js.map +1 -1
- package/dist/schema-definitions/models/constants/MeasurementConstants.js +0 -2
- package/dist/schema-definitions/models/constants/MeasurementConstants.js.map +1 -1
- package/dist/schema-definitions/models/helpers/CommodityProviderTypeEnum.d.ts +0 -3
- package/dist/schema-definitions/models/helpers/CommodityProviderTypeEnum.js +0 -3
- package/dist/schema-definitions/models/helpers/CommodityProviderTypeEnum.js.map +1 -1
- package/docs/implementation_documentation.md +1 -24
- package/docs/openapi-output.yaml +0 -2
- package/package.json +3 -3
- package/db/example/05_access.sql +0 -5
- package/db/migrations/postgresql/20240621083051-access-limitation.js +0 -53
- package/db/migrations/postgresql/20240625134438-fix-pk-measurements.js +0 -53
- package/db/migrations/postgresql/sqls/20240621083051-access-limitation-down.sql +0 -1
- package/db/migrations/postgresql/sqls/20240621083051-access-limitation-up.sql +0 -7
- package/db/migrations/postgresql/sqls/20240625134438-fix-pk-measurements-down.sql +0 -2
- package/db/migrations/postgresql/sqls/20240625134438-fix-pk-measurements-up.sql +0 -2
- package/dist/integration-engine/commodity-providers/datasources/static-data/AccessConfigurationDataSource.d.ts +0 -9
- package/dist/integration-engine/commodity-providers/datasources/static-data/AccessConfigurationDataSource.js +0 -45
- package/dist/integration-engine/commodity-providers/datasources/static-data/AccessConfigurationDataSource.js.map +0 -1
- package/dist/integration-engine/commodity-providers/datasources/static-data/StaticMeterSettingsDataSourceCapitalDs.d.ts +0 -11
- package/dist/integration-engine/commodity-providers/datasources/static-data/StaticMeterSettingsDataSourceCapitalDs.js +0 -50
- package/dist/integration-engine/commodity-providers/datasources/static-data/StaticMeterSettingsDataSourceCapitalDs.js.map +0 -1
- package/dist/integration-engine/commodity-providers/workers/tasks/FetchMeasurementsFromEEProvidersTask.d.ts +0 -11
- package/dist/integration-engine/commodity-providers/workers/tasks/FetchMeasurementsFromEEProvidersTask.js +0 -74
- package/dist/integration-engine/commodity-providers/workers/tasks/FetchMeasurementsFromEEProvidersTask.js.map +0 -1
- package/dist/integration-engine/commodity-providers/workers/tasks/FetchPpasEEMeasurementsTask.d.ts +0 -16
- package/dist/integration-engine/commodity-providers/workers/tasks/FetchPpasEEMeasurementsTask.js +0 -112
- package/dist/integration-engine/commodity-providers/workers/tasks/FetchPpasEEMeasurementsTask.js.map +0 -1
- package/dist/integration-engine/repositories/oict-energetika/AccessLimitationRepository.d.ts +0 -9
- package/dist/integration-engine/repositories/oict-energetika/AccessLimitationRepository.js +0 -78
- package/dist/integration-engine/repositories/oict-energetika/AccessLimitationRepository.js.map +0 -1
- package/dist/integration-engine/tasks/oict-energetika/FetchAccessConfigurationTask.d.ts +0 -9
- package/dist/integration-engine/tasks/oict-energetika/FetchAccessConfigurationTask.js +0 -32
- package/dist/integration-engine/tasks/oict-energetika/FetchAccessConfigurationTask.js.map +0 -1
- package/dist/output-gateway/controllers/v2/AbstractController.d.ts +0 -8
- package/dist/output-gateway/controllers/v2/AbstractController.js +0 -28
- package/dist/output-gateway/controllers/v2/AbstractController.js.map +0 -1
- package/dist/output-gateway/repositories/AccessLimitationRepository.d.ts +0 -11
- package/dist/output-gateway/repositories/AccessLimitationRepository.js +0 -43
- package/dist/output-gateway/repositories/AccessLimitationRepository.js.map +0 -1
- package/dist/schema-definitions/datasources/AccessConfigurationJsonSchema.d.ts +0 -3
- package/dist/schema-definitions/datasources/AccessConfigurationJsonSchema.js +0 -18
- package/dist/schema-definitions/datasources/AccessConfigurationJsonSchema.js.map +0 -1
- package/dist/schema-definitions/models/AccessLimitationModel.d.ts +0 -10
- package/dist/schema-definitions/models/AccessLimitationModel.js +0 -32
- package/dist/schema-definitions/models/AccessLimitationModel.js.map +0 -1
- package/dist/schema-definitions/models/BuildingsPrimaryModel.js.map +0 -1
- package/dist/schema-definitions/models/interfaces/IAccessLimitation.d.ts +0 -4
- package/dist/schema-definitions/models/interfaces/IAccessLimitation.js +0 -3
- package/dist/schema-definitions/models/interfaces/IAccessLimitation.js.map +0 -1
- package/dist/schema-definitions/models/interfaces/IPrimaryBuildings.js.map +0 -1
- /package/dist/{schema-definitions → output-gateway}/models/BuildingsPrimaryModel.d.ts +0 -0
- /package/dist/{schema-definitions → output-gateway}/models/BuildingsPrimaryModel.js +0 -0
- /package/dist/{schema-definitions → output-gateway}/models/interfaces/IPrimaryBuildings.d.ts +0 -0
- /package/dist/{schema-definitions → output-gateway}/models/interfaces/IPrimaryBuildings.js +0 -0
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { AccessLimitationRepository } from "../../repositories/AccessLimitationRepository";
|
|
2
|
-
import { BuildingTransformationFull } from "../../transformations/BuildingTransformationFull";
|
|
3
1
|
import { NextFunction, Request, Response } from "@golemio/core/dist/shared/express";
|
|
4
|
-
|
|
5
|
-
export declare class BuildingsController extends AbstractController {
|
|
6
|
-
private fullDataTransformation;
|
|
2
|
+
export declare class BuildingsController {
|
|
7
3
|
private buildingsRepository;
|
|
8
4
|
private transformation;
|
|
9
|
-
|
|
5
|
+
private fullDataTransformation;
|
|
6
|
+
constructor();
|
|
10
7
|
getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
11
8
|
getOne: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
12
9
|
private getFullData;
|
|
@@ -8,9 +8,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
11
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
12
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
13
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -22,26 +19,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
22
19
|
};
|
|
23
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
21
|
exports.BuildingsController = void 0;
|
|
25
|
-
const ModuleContainerToken_1 = require("../../ioc/ModuleContainerToken");
|
|
26
|
-
const AccessLimitationRepository_1 = require("../../repositories/AccessLimitationRepository");
|
|
27
22
|
const PrimaryBuildingsRepository_1 = require("../../repositories/PrimaryBuildingsRepository");
|
|
28
|
-
const BuildingTransformationFull_1 = require("../../transformations/BuildingTransformationFull");
|
|
29
23
|
const BuildingsTransformation_1 = require("../../transformations/BuildingsTransformation");
|
|
30
|
-
const Utils_1 = require("@golemio/core/dist/output-gateway/Utils");
|
|
31
24
|
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
32
25
|
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
const Utils_1 = require("@golemio/core/dist/output-gateway/Utils");
|
|
27
|
+
const Di_1 = require("../../ioc/Di");
|
|
28
|
+
const ModuleContainerToken_1 = require("../../ioc/ModuleContainerToken");
|
|
29
|
+
let BuildingsController = exports.BuildingsController = class BuildingsController {
|
|
30
|
+
constructor() {
|
|
38
31
|
this.getAll = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
39
32
|
try {
|
|
40
|
-
const allowedOrganizations = yield this.getAllowedOrganizationIds(req);
|
|
41
33
|
const fullParam = (0, Utils_1.parseBooleanQueryParam)(req.query.full);
|
|
42
|
-
const transformedResult = fullParam
|
|
43
|
-
? yield this.getFullData(allowedOrganizations)
|
|
44
|
-
: yield this.getPrimaryData(allowedOrganizations);
|
|
34
|
+
const transformedResult = fullParam ? yield this.getFullData() : yield this.getPrimaryData();
|
|
45
35
|
res.json(transformedResult);
|
|
46
36
|
}
|
|
47
37
|
catch (err) {
|
|
@@ -50,9 +40,8 @@ let BuildingsController = exports.BuildingsController = class BuildingsControlle
|
|
|
50
40
|
});
|
|
51
41
|
this.getOne = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
52
42
|
try {
|
|
53
|
-
const allowedOrganizations = yield this.getAllowedOrganizationIds(req);
|
|
54
43
|
const id = parseInt(req.params.id);
|
|
55
|
-
const result = yield this.buildingsRepository.GetOne(id
|
|
44
|
+
const result = yield this.buildingsRepository.GetOne(id);
|
|
56
45
|
if (result === null) {
|
|
57
46
|
throw new golemio_errors_1.GeneralError("not_found", "V2BuildingsController", undefined, 404);
|
|
58
47
|
}
|
|
@@ -63,25 +52,23 @@ let BuildingsController = exports.BuildingsController = class BuildingsControlle
|
|
|
63
52
|
next(err);
|
|
64
53
|
}
|
|
65
54
|
});
|
|
66
|
-
this.getFullData = (
|
|
67
|
-
const result = yield this.buildingsRepository.GetAllFull(
|
|
55
|
+
this.getFullData = () => __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const result = yield this.buildingsRepository.GetAllFull();
|
|
68
57
|
const transformedResult = this.fullDataTransformation.transformArray(result);
|
|
69
58
|
return transformedResult;
|
|
70
59
|
});
|
|
71
|
-
this.getPrimaryData = (
|
|
72
|
-
const result = yield this.buildingsRepository.GetAll(
|
|
60
|
+
this.getPrimaryData = () => __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
const result = yield this.buildingsRepository.GetAll();
|
|
73
62
|
const transformedResult = this.transformation.transformArray(result);
|
|
74
63
|
return transformedResult;
|
|
75
64
|
});
|
|
76
65
|
this.buildingsRepository = new PrimaryBuildingsRepository_1.PrimaryBuildingsRepository();
|
|
77
66
|
this.transformation = new BuildingsTransformation_1.BuildingsTransformation();
|
|
67
|
+
this.fullDataTransformation = Di_1.OGEnergeticsContainer.resolve(ModuleContainerToken_1.ModuleContainerToken.BuildingTransformationFull);
|
|
78
68
|
}
|
|
79
69
|
};
|
|
80
70
|
exports.BuildingsController = BuildingsController = __decorate([
|
|
81
71
|
(0, tsyringe_1.injectable)(),
|
|
82
|
-
|
|
83
|
-
__param(1, (0, tsyringe_1.inject)(ModuleContainerToken_1.ModuleContainerToken.BuildingTransformationFull)),
|
|
84
|
-
__metadata("design:paramtypes", [AccessLimitationRepository_1.AccessLimitationRepository,
|
|
85
|
-
BuildingTransformationFull_1.BuildingTransformationFull])
|
|
72
|
+
__metadata("design:paramtypes", [])
|
|
86
73
|
], BuildingsController);
|
|
87
74
|
//# sourceMappingURL=BuildingsController.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuildingsController.js","sourceRoot":"","sources":["../../../../src/output-gateway/controllers/v2/BuildingsController.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BuildingsController.js","sourceRoot":"","sources":["../../../../src/output-gateway/controllers/v2/BuildingsController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,8FAAyF;AAEzF,2FAAsF;AAEtF,6EAAwE;AACxE,iEAAgE;AAChE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AAmB,CAAC,UAAU,EAAE,CAAC;YAC3D,MAAM,iBAAiB,GAAG,IAAI,CAAC,sBAAsB,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YAC7E,OAAO,iBAAiB,CAAC;QAC7B,CAAC,CAAA,CAAC;QAEM,mBAAc,GAAG,GAAS,EAAE;YAChC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,CAAC;YACvD,MAAM,iBAAiB,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACrE,OAAO,iBAAiB,CAAC;QAC7B,CAAC,CAAA,CAAC;QAxCE,IAAI,CAAC,mBAAmB,GAAG,IAAI,uDAA0B,EAAE,CAAC;QAC5D,IAAI,CAAC,cAAc,GAAG,IAAI,iDAAuB,EAAE,CAAC;QACpD,IAAI,CAAC,sBAAsB,GAAG,0BAAqB,CAAC,OAAO,CAAC,2CAAoB,CAAC,0BAA0B,CAAC,CAAC;IACjH,CAAC;CAsCJ,CAAA;8BA/CY,mBAAmB;IAD/B,IAAA,qBAAU,GAAE;;GACA,mBAAmB,CA+C/B"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/// <reference types="express" />
|
|
2
|
-
import {
|
|
2
|
+
import { NextFunction, Request, Response } from "@golemio/core/dist/shared/express";
|
|
3
3
|
import { DevicesRepository } from "../../repositories/DevicesRepository";
|
|
4
4
|
import { DeviceDtoTransformation } from "../../transformations/DeviceDtoTransformation";
|
|
5
|
-
|
|
6
|
-
import { AbstractController } from "./AbstractController";
|
|
7
|
-
export declare class V2DevicesController extends AbstractController {
|
|
5
|
+
export declare class V2DevicesController {
|
|
8
6
|
private devicesRepository;
|
|
9
7
|
private transformation;
|
|
10
|
-
constructor(devicesRepository: DevicesRepository, transformation: DeviceDtoTransformation
|
|
8
|
+
constructor(devicesRepository: DevicesRepository, transformation: DeviceDtoTransformation);
|
|
11
9
|
getAll: (req: Request, res: Response, next: NextFunction) => Promise<void | Response<any, Record<string, any>>>;
|
|
12
10
|
getOne: (req: Request, res: Response, next: NextFunction) => Promise<void | Response<any, Record<string, any>>>;
|
|
13
11
|
}
|
|
@@ -22,24 +22,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
22
22
|
};
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
24
|
exports.V2DevicesController = void 0;
|
|
25
|
-
const
|
|
25
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
26
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
26
27
|
const ModuleContainerToken_1 = require("../../ioc/ModuleContainerToken");
|
|
27
|
-
const AccessLimitationRepository_1 = require("../../repositories/AccessLimitationRepository");
|
|
28
28
|
const DevicesRepository_1 = require("../../repositories/DevicesRepository");
|
|
29
29
|
const DeviceDtoTransformation_1 = require("../../transformations/DeviceDtoTransformation");
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
let V2DevicesController = exports.V2DevicesController = class V2DevicesController extends AbstractController_1.AbstractController {
|
|
34
|
-
constructor(devicesRepository, transformation, accessLimitationRepository) {
|
|
35
|
-
super(accessLimitationRepository);
|
|
30
|
+
const parsePaginationParams_1 = require("../helpers/parsePaginationParams");
|
|
31
|
+
let V2DevicesController = exports.V2DevicesController = class V2DevicesController {
|
|
32
|
+
constructor(devicesRepository, transformation) {
|
|
36
33
|
this.devicesRepository = devicesRepository;
|
|
37
34
|
this.transformation = transformation;
|
|
38
35
|
this.getAll = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
39
36
|
try {
|
|
40
|
-
const allowedOrganizations = yield this.getAllowedOrganizationIds(req);
|
|
41
37
|
const params = (0, parsePaginationParams_1.parsePaginationParams)(req);
|
|
42
|
-
const result = yield this.devicesRepository.GetAll(params
|
|
38
|
+
const result = yield this.devicesRepository.GetAll(params);
|
|
43
39
|
return res.json(this.transformation.transformArray(result));
|
|
44
40
|
}
|
|
45
41
|
catch (err) {
|
|
@@ -48,9 +44,8 @@ let V2DevicesController = exports.V2DevicesController = class V2DevicesControlle
|
|
|
48
44
|
});
|
|
49
45
|
this.getOne = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
50
46
|
try {
|
|
51
|
-
const allowedOrganizations = yield this.getAllowedOrganizationIds(req);
|
|
52
47
|
const id = req.params.id;
|
|
53
|
-
const result = yield this.devicesRepository.GetOne(id
|
|
48
|
+
const result = yield this.devicesRepository.GetOne(id);
|
|
54
49
|
if (!result) {
|
|
55
50
|
return next(new golemio_errors_1.GeneralError("not_found", this.constructor.name, `Device with id ${req.params.id} not found`, 404));
|
|
56
51
|
}
|
|
@@ -66,9 +61,7 @@ exports.V2DevicesController = V2DevicesController = __decorate([
|
|
|
66
61
|
(0, tsyringe_1.injectable)(),
|
|
67
62
|
__param(0, (0, tsyringe_1.inject)(ModuleContainerToken_1.ModuleContainerToken.DevicesRepository)),
|
|
68
63
|
__param(1, (0, tsyringe_1.inject)(ModuleContainerToken_1.ModuleContainerToken.DeviceDtoTransformation)),
|
|
69
|
-
__param(2, (0, tsyringe_1.inject)(ModuleContainerToken_1.ModuleContainerToken.AccessLimitationRepository)),
|
|
70
64
|
__metadata("design:paramtypes", [DevicesRepository_1.DevicesRepository,
|
|
71
|
-
DeviceDtoTransformation_1.DeviceDtoTransformation
|
|
72
|
-
AccessLimitationRepository_1.AccessLimitationRepository])
|
|
65
|
+
DeviceDtoTransformation_1.DeviceDtoTransformation])
|
|
73
66
|
], V2DevicesController);
|
|
74
67
|
//# sourceMappingURL=V2DevicesController.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"V2DevicesController.js","sourceRoot":"","sources":["../../../../src/output-gateway/controllers/v2/V2DevicesController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"V2DevicesController.js","sourceRoot":"","sources":["../../../../src/output-gateway/controllers/v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AC,MAAM,CAAC,CAAC,CAAC;aACjE;YAAC,OAAO,GAAG,EAAE;gBACV,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;aACpB;QACL,CAAC,CAAA,CAAC;IA3BC,CAAC;CA4BP,CAAA;8BAjCY,mBAAmB;IAD/B,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,iBAAiB,CAAC,CAAA;IAC9C,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,uBAAuB,CAAC,CAAA;qCADsB,qCAAiB;QAEpE,iDAAuB;GAJ1C,mBAAmB,CAiC/B"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/// <reference types="express" />
|
|
2
|
-
import { AccessLimitationRepository } from "../../repositories/AccessLimitationRepository";
|
|
3
|
-
import { MeasurementRepository } from "../../repositories/MeasurementRepository";
|
|
4
2
|
import { NextFunction, Request, Response } from "@golemio/core/dist/shared/express";
|
|
5
|
-
import {
|
|
6
|
-
export declare class V2MeasurementsController
|
|
3
|
+
import { MeasurementRepository } from "../../repositories/MeasurementRepository";
|
|
4
|
+
export declare class V2MeasurementsController {
|
|
7
5
|
private measurementRepository;
|
|
8
|
-
constructor(measurementRepository: MeasurementRepository
|
|
6
|
+
constructor(measurementRepository: MeasurementRepository);
|
|
9
7
|
getMeasurements: (req: Request, res: Response, next: NextFunction) => Promise<void | Response<any, Record<string, any>>>;
|
|
10
8
|
getMonthlyReadings: (req: Request, res: Response, next: NextFunction) => Promise<void | Response<any, Record<string, any>>>;
|
|
11
9
|
}
|
|
@@ -22,22 +22,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
22
22
|
};
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
24
|
exports.V2MeasurementsController = void 0;
|
|
25
|
-
const
|
|
25
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
26
26
|
const ModuleContainerToken_1 = require("../../ioc/ModuleContainerToken");
|
|
27
|
-
const AccessLimitationRepository_1 = require("../../repositories/AccessLimitationRepository");
|
|
28
27
|
const MeasurementRepository_1 = require("../../repositories/MeasurementRepository");
|
|
28
|
+
const parsePaginationParams_1 = require("../helpers/parsePaginationParams");
|
|
29
29
|
const luxon_1 = require("@golemio/core/dist/shared/luxon");
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
let V2MeasurementsController = exports.V2MeasurementsController = class V2MeasurementsController extends AbstractController_1.AbstractController {
|
|
33
|
-
constructor(measurementRepository, accessLimitationRepository) {
|
|
34
|
-
super(accessLimitationRepository);
|
|
30
|
+
let V2MeasurementsController = exports.V2MeasurementsController = class V2MeasurementsController {
|
|
31
|
+
constructor(measurementRepository) {
|
|
35
32
|
this.measurementRepository = measurementRepository;
|
|
36
33
|
this.getMeasurements = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
37
34
|
try {
|
|
38
|
-
const allowedOrganizations = yield this.getAllowedOrganizationIds(req);
|
|
39
35
|
const params = Object.assign({ variable: req.query.variable, type: req.query.type, addr1: req.query.addr1, addr2: req.query.addr2, dateFrom: req.query.dateFrom, dateTo: req.query.dateTo }, (0, parsePaginationParams_1.parsePaginationParams)(req));
|
|
40
|
-
const result = yield this.measurementRepository.getMeasurements(params
|
|
36
|
+
const result = yield this.measurementRepository.getMeasurements(params);
|
|
41
37
|
return res.json(result);
|
|
42
38
|
}
|
|
43
39
|
catch (err) {
|
|
@@ -46,19 +42,18 @@ let V2MeasurementsController = exports.V2MeasurementsController = class V2Measur
|
|
|
46
42
|
});
|
|
47
43
|
this.getMonthlyReadings = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
48
44
|
try {
|
|
49
|
-
const allowedOrganizations = yield this.getAllowedOrganizationIds(req);
|
|
50
45
|
const month = parseInt(req.query.month);
|
|
51
46
|
const year = parseInt(req.query.year);
|
|
52
47
|
const startDateUtc = luxon_1.DateTime.fromJSDate(new Date(year, month - 1, 1), { zone: "Europe/Prague" });
|
|
53
48
|
const fromDate = startDateUtc.startOf("month").toISO();
|
|
54
49
|
const toDate = startDateUtc.endOf("month").toISO();
|
|
55
50
|
const params = {
|
|
56
|
-
address: `/${req.query.addr1}/${req.query.addr2}`,
|
|
51
|
+
address: `/${req.query.addr1}/${req.query.addr2}/${req.query.variable}`,
|
|
57
52
|
variable: req.query.variable,
|
|
58
53
|
from: fromDate,
|
|
59
54
|
to: toDate,
|
|
60
55
|
};
|
|
61
|
-
const result = yield this.measurementRepository.getMonthlyReadings(params
|
|
56
|
+
const result = yield this.measurementRepository.getMonthlyReadings(params);
|
|
62
57
|
return res.json(result.map((el) => (Object.assign({ time: fromDate }, el))));
|
|
63
58
|
}
|
|
64
59
|
catch (err) {
|
|
@@ -70,8 +65,6 @@ let V2MeasurementsController = exports.V2MeasurementsController = class V2Measur
|
|
|
70
65
|
exports.V2MeasurementsController = V2MeasurementsController = __decorate([
|
|
71
66
|
(0, tsyringe_1.injectable)(),
|
|
72
67
|
__param(0, (0, tsyringe_1.inject)(ModuleContainerToken_1.ModuleContainerToken.MeasurementRepository)),
|
|
73
|
-
|
|
74
|
-
__metadata("design:paramtypes", [MeasurementRepository_1.MeasurementRepository,
|
|
75
|
-
AccessLimitationRepository_1.AccessLimitationRepository])
|
|
68
|
+
__metadata("design:paramtypes", [MeasurementRepository_1.MeasurementRepository])
|
|
76
69
|
], V2MeasurementsController);
|
|
77
70
|
//# sourceMappingURL=V2MeasurementsController.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"V2MeasurementsController.js","sourceRoot":"","sources":["../../../../src/output-gateway/controllers/v2/V2MeasurementsController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"V2MeasurementsController.js","sourceRoot":"","sources":["../../../../src/output-gateway/controllers/v2/V2MeasurementsController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA,iEAAwE;AACxE,yEAAoE;AACpE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,CAAC,CAAC;gBAClG,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC;gBACvD,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC;gBAEnD,MAAM,MAAM,GAAyB;oBACjC,OAAO,EAAE,IAAI,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE;oBACvE,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,QAAkB;oBACtC,IAAI,EAAE,QAAQ;oBACd,EAAE,EAAE,MAAM;iBACb,CAAC;gBAEF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;gBAC3E,OAAO,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,iBAAG,IAAI,EAAE,QAAQ,IAAK,EAAE,EAAG,CAAC,CAAC,CAAC;aACpE;YAAC,OAAO,GAAG,EAAE;gBACV,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;aACpB;QACL,CAAC,CAAA,CAAC;IAzCqH,CAAC;CA0C3H,CAAA;mCA3CY,wBAAwB;IADpC,IAAA,qBAAU,GAAE;IAEI,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,qBAAqB,CAAC,CAAA;qCAAgC,6CAAqB;GAD3G,wBAAwB,CA2CpC"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
/// <reference types="express" />
|
|
2
|
-
import {
|
|
2
|
+
import { NextFunction, Request, Response } from "@golemio/core/dist/shared/express";
|
|
3
3
|
import { OrganizationsRepository } from "../../repositories/OrganizationsRepository";
|
|
4
|
-
import { OrganizationDetailDtoTransformation } from "../../transformations/OrganizationDetailDtoTransformation";
|
|
5
4
|
import { OrganizationDtoTransformation } from "../../transformations/OrganizationDtoTransformation";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
export declare class V2OrganizationsController extends AbstractController {
|
|
5
|
+
import { OrganizationDetailDtoTransformation } from "../../transformations/OrganizationDetailDtoTransformation";
|
|
6
|
+
export declare class V2OrganizationsController {
|
|
9
7
|
private organizationsRepository;
|
|
10
8
|
private transformation;
|
|
11
9
|
private transformationDetail;
|
|
12
|
-
constructor(organizationsRepository: OrganizationsRepository, transformation: OrganizationDtoTransformation, transformationDetail: OrganizationDetailDtoTransformation
|
|
10
|
+
constructor(organizationsRepository: OrganizationsRepository, transformation: OrganizationDtoTransformation, transformationDetail: OrganizationDetailDtoTransformation);
|
|
13
11
|
getAll: (req: Request, res: Response, next: NextFunction) => Promise<void | Response<any, Record<string, any>>>;
|
|
14
12
|
getOne: (req: Request, res: Response, next: NextFunction) => Promise<void | Response<any, Record<string, any>>>;
|
|
15
13
|
}
|
|
@@ -22,33 +22,29 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
22
22
|
};
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
24
|
exports.V2OrganizationsController = void 0;
|
|
25
|
-
const
|
|
25
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
26
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
26
27
|
const ModuleContainerToken_1 = require("../../ioc/ModuleContainerToken");
|
|
27
|
-
const AccessLimitationRepository_1 = require("../../repositories/AccessLimitationRepository");
|
|
28
28
|
const OrganizationsRepository_1 = require("../../repositories/OrganizationsRepository");
|
|
29
|
-
const OrganizationDetailDtoTransformation_1 = require("../../transformations/OrganizationDetailDtoTransformation");
|
|
30
29
|
const OrganizationDtoTransformation_1 = require("../../transformations/OrganizationDtoTransformation");
|
|
30
|
+
const OrganizationDetailDtoTransformation_1 = require("../../transformations/OrganizationDetailDtoTransformation");
|
|
31
|
+
const parsePaginationParams_1 = require("../helpers/parsePaginationParams");
|
|
31
32
|
const Utils_1 = require("@golemio/core/dist/output-gateway/Utils");
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const AbstractController_1 = require("./AbstractController");
|
|
35
|
-
let V2OrganizationsController = exports.V2OrganizationsController = class V2OrganizationsController extends AbstractController_1.AbstractController {
|
|
36
|
-
constructor(organizationsRepository, transformation, transformationDetail, accessLimitationRepository) {
|
|
37
|
-
super(accessLimitationRepository);
|
|
33
|
+
let V2OrganizationsController = exports.V2OrganizationsController = class V2OrganizationsController {
|
|
34
|
+
constructor(organizationsRepository, transformation, transformationDetail) {
|
|
38
35
|
this.organizationsRepository = organizationsRepository;
|
|
39
36
|
this.transformation = transformation;
|
|
40
37
|
this.transformationDetail = transformationDetail;
|
|
41
38
|
this.getAll = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
42
39
|
try {
|
|
43
|
-
const allowedOrganizations = yield this.getAllowedOrganizationIds(req);
|
|
44
40
|
const params = (0, parsePaginationParams_1.parsePaginationParams)(req);
|
|
45
41
|
const full = (0, Utils_1.parseBooleanQueryParam)(req.query.full) || false;
|
|
46
42
|
let result = [];
|
|
47
43
|
if (!full) {
|
|
48
|
-
result = this.transformation.transformArray(yield this.organizationsRepository.GetAllPublic(params
|
|
44
|
+
result = this.transformation.transformArray(yield this.organizationsRepository.GetAllPublic(params));
|
|
49
45
|
}
|
|
50
46
|
else {
|
|
51
|
-
result = this.transformationDetail.transformArray(yield this.organizationsRepository.GetAll(params
|
|
47
|
+
result = this.transformationDetail.transformArray(yield this.organizationsRepository.GetAll(params));
|
|
52
48
|
}
|
|
53
49
|
return res.json(result);
|
|
54
50
|
}
|
|
@@ -58,9 +54,8 @@ let V2OrganizationsController = exports.V2OrganizationsController = class V2Orga
|
|
|
58
54
|
});
|
|
59
55
|
this.getOne = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
60
56
|
try {
|
|
61
|
-
const allowedOrganizations = yield this.getAllowedOrganizationIds(req);
|
|
62
57
|
const id = req.params.id;
|
|
63
|
-
const result = yield this.organizationsRepository.GetOne(id
|
|
58
|
+
const result = yield this.organizationsRepository.GetOne(id);
|
|
64
59
|
if (!result) {
|
|
65
60
|
return next(new golemio_errors_1.GeneralError("not_found", this.constructor.name, `Organization with id ${req.params.id} not found`, 404));
|
|
66
61
|
}
|
|
@@ -77,10 +72,8 @@ exports.V2OrganizationsController = V2OrganizationsController = __decorate([
|
|
|
77
72
|
__param(0, (0, tsyringe_1.inject)(ModuleContainerToken_1.ModuleContainerToken.OrganizationsRepository)),
|
|
78
73
|
__param(1, (0, tsyringe_1.inject)(ModuleContainerToken_1.ModuleContainerToken.OrganizationDtoTransformation)),
|
|
79
74
|
__param(2, (0, tsyringe_1.inject)(ModuleContainerToken_1.ModuleContainerToken.OrganizationDetailDtoTransformation)),
|
|
80
|
-
__param(3, (0, tsyringe_1.inject)(ModuleContainerToken_1.ModuleContainerToken.AccessLimitationRepository)),
|
|
81
75
|
__metadata("design:paramtypes", [OrganizationsRepository_1.OrganizationsRepository,
|
|
82
76
|
OrganizationDtoTransformation_1.OrganizationDtoTransformation,
|
|
83
|
-
OrganizationDetailDtoTransformation_1.OrganizationDetailDtoTransformation
|
|
84
|
-
AccessLimitationRepository_1.AccessLimitationRepository])
|
|
77
|
+
OrganizationDetailDtoTransformation_1.OrganizationDetailDtoTransformation])
|
|
85
78
|
], V2OrganizationsController);
|
|
86
79
|
//# sourceMappingURL=V2OrganizationsController.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"V2OrganizationsController.js","sourceRoot":"","sources":["../../../../src/output-gateway/controllers/v2/V2OrganizationsController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"V2OrganizationsController.js","sourceRoot":"","sources":["../../../../src/output-gateway/controllers/v2/V2OrganizationsController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA,6EAA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C,uBAAuB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;gBAE7D,IAAI,CAAC,MAAM,EAAE;oBACT,OAAO,IAAI,CACP,IAAI,6BAAY,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,wBAAwB,GAAG,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,GAAG,CAAC,CAC/G,CAAC;iBACL;gBAED,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;aACvE;YAAC,OAAO,GAAG,EAAE;gBACV,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;aACpB;QACL,CAAC,CAAA,CAAC;IAnCC,CAAC;CAoCP,CAAA;oCA1CY,yBAAyB;IADrC,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,uBAAuB,CAAC,CAAA;IACpD,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,6BAA6B,CAAC,CAAA;IAC1D,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,mCAAmC,CAAC,CAAA;qCAFsB,iDAAuB;QAC1B,6DAA6B;QAEnF,yEAAmC;GAL5D,yBAAyB,CA0CrC"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OGEnergeticsContainer = void 0;
|
|
4
4
|
const ModuleContainerToken_1 = require("./ModuleContainerToken");
|
|
5
|
-
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
6
5
|
const ioc_1 = require("@golemio/core/dist/output-gateway/ioc");
|
|
7
6
|
const OrganizationsRepository_1 = require("../repositories/OrganizationsRepository");
|
|
8
7
|
const V2OrganizationsController_1 = require("../controllers/v2/V2OrganizationsController");
|
|
@@ -22,9 +21,6 @@ const MeasurementRepository_1 = require("../repositories/MeasurementRepository")
|
|
|
22
21
|
const V2MeasurementsRouter_1 = require("../routers/v2/V2MeasurementsRouter");
|
|
23
22
|
const V2MeasurementsController_1 = require("../controllers/v2/V2MeasurementsController");
|
|
24
23
|
const V2BuildingsRouter_1 = require("../routers/v2/V2BuildingsRouter");
|
|
25
|
-
const AccessLimitationRepository_1 = require("../repositories/AccessLimitationRepository");
|
|
26
|
-
const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
|
|
27
|
-
const BuildingsController_1 = require("../controllers/v2/BuildingsController");
|
|
28
24
|
//#region Initialization
|
|
29
25
|
const energeticsContainer = ioc_1.OutputGatewayContainer.createChildContainer();
|
|
30
26
|
exports.OGEnergeticsContainer = energeticsContainer;
|
|
@@ -43,14 +39,10 @@ energeticsContainer
|
|
|
43
39
|
.registerSingleton(ModuleContainerToken_1.ModuleContainerToken.OrganizationBuildingsRepository, OrganizationBuildingsRepository_1.OrganizationBuildingsRepository)
|
|
44
40
|
.registerSingleton(ModuleContainerToken_1.ModuleContainerToken.OrganizationResponsibleUsersRepository, OrganizationResponsibleUsersRepository_1.OrganizationResponsibleUsersRepository)
|
|
45
41
|
.registerSingleton(ModuleContainerToken_1.ModuleContainerToken.DevicesRepository, DevicesRepository_1.DevicesRepository)
|
|
46
|
-
.registerSingleton(ModuleContainerToken_1.ModuleContainerToken.MeasurementRepository, MeasurementRepository_1.MeasurementRepository)
|
|
47
|
-
.register(ModuleContainerToken_1.ModuleContainerToken.AccessLimitationRepository, {
|
|
48
|
-
useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => new AccessLimitationRepository_1.AccessLimitationRepository(c.resolve(CoreToken_1.CoreToken.PostgresConnector), c.resolve(CoreToken_1.CoreToken.Logger))),
|
|
49
|
-
});
|
|
42
|
+
.registerSingleton(ModuleContainerToken_1.ModuleContainerToken.MeasurementRepository, MeasurementRepository_1.MeasurementRepository);
|
|
50
43
|
//#endregion
|
|
51
44
|
//#region Controllers
|
|
52
45
|
energeticsContainer
|
|
53
|
-
.registerSingleton(ModuleContainerToken_1.ModuleContainerToken.BuildingsController, BuildingsController_1.BuildingsController)
|
|
54
46
|
.registerSingleton(ModuleContainerToken_1.ModuleContainerToken.V2OrganizationsController, V2OrganizationsController_1.V2OrganizationsController)
|
|
55
47
|
.registerSingleton(ModuleContainerToken_1.ModuleContainerToken.V2DevicesController, V2DevicesController_1.V2DevicesController)
|
|
56
48
|
.registerSingleton(ModuleContainerToken_1.ModuleContainerToken.V2MeasurementsController, V2MeasurementsController_1.V2MeasurementsController);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../src/output-gateway/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,iEAAoE;
|
|
1
|
+
{"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../src/output-gateway/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,iEAAoE;AAEpE,+DAA+E;AAC/E,qFAAmF;AACnF,2FAAyF;AACzF,mHAAiH;AACjH,2FAAyF;AACzF,qGAAmG;AACnG,yEAAuE;AACvE,+EAA6E;AAC7E,+EAA6E;AAC7E,mEAAiE;AACjE,oGAAkG;AAClG,gHAA8G;AAC9G,wFAAsF;AACtF,8FAA4F;AAC5F,kEAAgE;AAChE,iFAA+E;AAC/E,6EAA2E;AAC3E,yFAAuF;AACvF,uEAAqE;AAErE,wBAAwB;AACxB,MAAM,mBAAmB,GAAwB,4BAAsB,CAAC,oBAAoB,EAAE,CAAC;AA8C/D,oDAAqB;AA7CrD,YAAY;AAEZ,yBAAyB;AACzB,mBAAmB;KACd,iBAAiB,CAAC,2CAAoB,CAAC,6BAA6B,EAAE,6DAA6B,CAAC;KACpG,iBAAiB,CAAC,2CAAoB,CAAC,mCAAmC,EAAE,yEAAmC,CAAC;KAChH,iBAAiB,CAAC,2CAAoB,CAAC,uBAAuB,EAAE,iDAAuB,CAAC;KACxF,iBAAiB,CAAC,2CAAoB,CAAC,0BAA0B,EAAE,uDAA0B,CAAC,CAAC;AACpG,YAAY;AAEZ,sBAAsB;AACtB,mBAAmB;KACd,iBAAiB,CAA6B,2CAAoB,CAAC,0BAA0B,EAAE,uDAA0B,CAAC;KAC1H,iBAAiB,CAA0B,2CAAoB,CAAC,uBAAuB,EAAE,iDAAuB,CAAC;KACjH,iBAAiB,CACd,2CAAoB,CAAC,+BAA+B,EACpD,iEAA+B,CAClC;KACA,iBAAiB,CACd,2CAAoB,CAAC,sCAAsC,EAC3D,+EAAsC,CACzC;KACA,iBAAiB,CAAoB,2CAAoB,CAAC,iBAAiB,EAAE,qCAAiB,CAAC;KAC/F,iBAAiB,CAAwB,2CAAoB,CAAC,qBAAqB,EAAE,6CAAqB,CAAC,CAAC;AACjH,YAAY;AAEZ,qBAAqB;AACrB,mBAAmB;KACd,iBAAiB,CAA4B,2CAAoB,CAAC,yBAAyB,EAAE,qDAAyB,CAAC;KACvH,iBAAiB,CAAsB,2CAAoB,CAAC,mBAAmB,EAAE,yCAAmB,CAAC;KACrG,iBAAiB,CAA2B,2CAAoB,CAAC,wBAAwB,EAAE,mDAAwB,CAAC,CAAC;AAC1H,YAAY;AAEZ,iBAAiB;AACjB,mBAAmB;KACd,iBAAiB,CAAoB,2CAAoB,CAAC,iBAAiB,EAAE,qCAAiB,CAAC;KAC/F,iBAAiB,CAAwB,2CAAoB,CAAC,qBAAqB,EAAE,6CAAqB,CAAC;KAC3G,iBAAiB,CAAkB,2CAAoB,CAAC,eAAe,EAAE,iCAAe,CAAC;KACzF,iBAAiB,CAAuB,2CAAoB,CAAC,oBAAoB,EAAE,2CAAoB,CAAC,CAAC;AAC9G,YAAY;AAEZ,iBAAiB;AACjB,mBAAmB,CAAC,iBAAiB,CAAmB,2CAAoB,CAAC,gBAAgB,EAAE,mCAAgB,CAAC,CAAC"}
|
|
@@ -11,9 +11,7 @@ declare const ModuleContainerToken: {
|
|
|
11
11
|
OrganizationResponsibleUsersRepository: symbol;
|
|
12
12
|
DevicesRepository: symbol;
|
|
13
13
|
MeasurementRepository: symbol;
|
|
14
|
-
AccessLimitationRepository: symbol;
|
|
15
14
|
/** controllers */
|
|
16
|
-
BuildingsController: symbol;
|
|
17
15
|
V2OrganizationsController: symbol;
|
|
18
16
|
V2DevicesController: symbol;
|
|
19
17
|
V2MeasurementsController: symbol;
|
|
@@ -14,9 +14,7 @@ const ModuleContainerToken = {
|
|
|
14
14
|
OrganizationResponsibleUsersRepository: Symbol("OrganizationResponsibleUsersRepository"),
|
|
15
15
|
DevicesRepository: Symbol("DevicesRepository"),
|
|
16
16
|
MeasurementRepository: Symbol("MeasurementRepository"),
|
|
17
|
-
AccessLimitationRepository: Symbol(),
|
|
18
17
|
/** controllers */
|
|
19
|
-
BuildingsController: Symbol("BuildingController"),
|
|
20
18
|
V2OrganizationsController: Symbol("V2OrganizationsController"),
|
|
21
19
|
V2DevicesController: Symbol("V2DevicesController"),
|
|
22
20
|
V2MeasurementsController: Symbol("V2MeasurementsController"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleContainerToken.js","sourceRoot":"","sources":["../../../src/output-gateway/ioc/ModuleContainerToken.ts"],"names":[],"mappings":";;;AAAA,MAAM,oBAAoB,GAAG;IACzB,sBAAsB;IACtB,6BAA6B,EAAE,MAAM,CAAC,+BAA+B,CAAC;IACtE,mCAAmC,EAAE,MAAM,CAAC,qCAAqC,CAAC;IAClF,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,0BAA0B,EAAE,MAAM,CAAC,4BAA4B,CAAC;IAChE,mBAAmB;IACnB,0BAA0B,EAAE,MAAM,CAAC,4BAA4B,CAAC;IAChE,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,+BAA+B,EAAE,MAAM,CAAC,iCAAiC,CAAC;IAC1E,sCAAsC,EAAE,MAAM,CAAC,wCAAwC,CAAC;IACxF,iBAAiB,EAAE,MAAM,CAAC,mBAAmB,CAAC;IAC9C,qBAAqB,EAAE,MAAM,CAAC,uBAAuB,CAAC;IACtD,
|
|
1
|
+
{"version":3,"file":"ModuleContainerToken.js","sourceRoot":"","sources":["../../../src/output-gateway/ioc/ModuleContainerToken.ts"],"names":[],"mappings":";;;AAAA,MAAM,oBAAoB,GAAG;IACzB,sBAAsB;IACtB,6BAA6B,EAAE,MAAM,CAAC,+BAA+B,CAAC;IACtE,mCAAmC,EAAE,MAAM,CAAC,qCAAqC,CAAC;IAClF,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,0BAA0B,EAAE,MAAM,CAAC,4BAA4B,CAAC;IAChE,mBAAmB;IACnB,0BAA0B,EAAE,MAAM,CAAC,4BAA4B,CAAC;IAChE,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,+BAA+B,EAAE,MAAM,CAAC,iCAAiC,CAAC;IAC1E,sCAAsC,EAAE,MAAM,CAAC,wCAAwC,CAAC;IACxF,iBAAiB,EAAE,MAAM,CAAC,mBAAmB,CAAC;IAC9C,qBAAqB,EAAE,MAAM,CAAC,uBAAuB,CAAC;IACtD,kBAAkB;IAClB,yBAAyB,EAAE,MAAM,CAAC,2BAA2B,CAAC;IAC9D,mBAAmB,EAAE,MAAM,CAAC,qBAAqB,CAAC;IAClD,wBAAwB,EAAE,MAAM,CAAC,0BAA0B,CAAC;IAC5D,cAAc;IACd,iBAAiB,EAAE,MAAM,CAAC,mBAAmB,CAAC;IAC9C,qBAAqB,EAAE,MAAM,CAAC,uBAAuB,CAAC;IACtD,eAAe,EAAE,MAAM,CAAC,iBAAiB,CAAC;IAC1C,oBAAoB,EAAE,MAAM,CAAC,sBAAsB,CAAC;IACpD,cAAc;IACd,gBAAgB,EAAE,MAAM,CAAC,0BAA0B,CAAC;CACvD,CAAC;AAEO,oDAAoB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BuildingsPrimaryModel.js","sourceRoot":"","sources":["../../../src/output-gateway/models/BuildingsPrimaryModel.ts"],"names":[],"mappings":";;;AACA,mEAAwF;AAGxF,MAAa,qBAAsB,S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;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IPrimaryBuildings.js","sourceRoot":"","sources":["../../../../src/output-gateway/models/interfaces/IPrimaryBuildings.ts"],"names":[],"mappings":""}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import { SequelizeModel } from "@golemio/core/dist/output-gateway";
|
|
1
2
|
import { IPaginationParams } from "../controllers/interfaces/IPaginationParams";
|
|
2
3
|
import { IDevicesModel } from "../../schema-definitions/models/interfaces";
|
|
3
|
-
import { SequelizeModel } from "@golemio/core/dist/output-gateway";
|
|
4
4
|
export declare class DevicesRepository extends SequelizeModel {
|
|
5
5
|
constructor();
|
|
6
|
-
GetAll(params: IPaginationParams
|
|
7
|
-
GetOne(id: string
|
|
8
|
-
private getWhereAccessLimitation;
|
|
6
|
+
GetAll(params: IPaginationParams): Promise<IDevicesModel[]>;
|
|
7
|
+
GetOne(id: string): Promise<IDevicesModel | null>;
|
|
9
8
|
}
|
|
@@ -20,29 +20,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.DevicesRepository = void 0;
|
|
22
22
|
const _sch_1 = require("../../schema-definitions");
|
|
23
|
-
const constants_1 = require("../../schema-definitions/constants");
|
|
24
|
-
const models_1 = require("../../schema-definitions/models");
|
|
25
23
|
const output_gateway_1 = require("@golemio/core/dist/output-gateway");
|
|
26
|
-
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
27
|
-
const sequelize_1 = require("@golemio/core/dist/shared/sequelize");
|
|
28
24
|
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
25
|
+
const models_1 = require("../../schema-definitions/models");
|
|
26
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
29
27
|
let DevicesRepository = exports.DevicesRepository = class DevicesRepository extends output_gateway_1.SequelizeModel {
|
|
30
28
|
constructor() {
|
|
31
29
|
super("DevicesRepository", models_1.DevicesModel.TABLE_NAME, models_1.DevicesModel.attributeModel, {
|
|
32
30
|
schema: _sch_1.EnergeticsSchema.pgSchema,
|
|
33
31
|
});
|
|
34
|
-
this.getWhereAccessLimitation = (allowedOrganizations) => {
|
|
35
|
-
return {
|
|
36
|
-
[sequelize_1.Op.in]: (0, sequelize_1.literal)(`(select distinct building_id from ${constants_1.PG_SCHEMA}.organizations_buildings
|
|
37
|
-
where organization_id = any('{${allowedOrganizations.join(",")}}'::integer[]))`),
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
32
|
}
|
|
41
|
-
GetAll(params
|
|
33
|
+
GetAll(params) {
|
|
42
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
35
|
try {
|
|
44
36
|
return yield this.sequelizeModel.findAll({
|
|
45
|
-
where: allowedOrganizations === null ? {} : { building_id: this.getWhereAccessLimitation(allowedOrganizations) },
|
|
46
37
|
order: [["id", "ASC"]],
|
|
47
38
|
limit: params.limit,
|
|
48
39
|
offset: params.offset,
|
|
@@ -53,16 +44,11 @@ where organization_id = any('{${allowedOrganizations.join(",")}}'::integer[]))`)
|
|
|
53
44
|
}
|
|
54
45
|
});
|
|
55
46
|
}
|
|
56
|
-
GetOne(id
|
|
47
|
+
GetOne(id) {
|
|
57
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
49
|
try {
|
|
59
50
|
return yield this.sequelizeModel.findOne({
|
|
60
|
-
where: {
|
|
61
|
-
[sequelize_1.Op.and]: [
|
|
62
|
-
{ id: id },
|
|
63
|
-
allowedOrganizations === null ? {} : { building_id: this.getWhereAccessLimitation(allowedOrganizations) },
|
|
64
|
-
],
|
|
65
|
-
},
|
|
51
|
+
where: { id },
|
|
66
52
|
});
|
|
67
53
|
}
|
|
68
54
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevicesRepository.js","sourceRoot":"","sources":["../../../src/output-gateway/repositories/DevicesRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"DevicesRepository.js","sourceRoot":"","sources":["../../../src/output-gateway/repositories/DevicesRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,mDAAwC;AACxC,sEAAmE;AACnE,iEAAgE;AAChE,4DAA2C;AAE3C,6EAAwE;AAIjE,IAAM,iBAAiB,+BAAvB,MAAM,iBAAkB,SAAQ,+BAAc;IACjD;QACI,KAAK,CAAC,mBAAmB,EAAE,qBAAY,CAAC,UAAU,EAAE,qBAAY,CAAC,cAAc,EAAE;YAC7E,MAAM,EAAE,uBAAgB,CAAC,QAAQ;SACpC,CAAC,CAAC;IACP,CAAC;IAEY,MAAM,CAAC,MAAyB;;YACzC,IAAI;gBACA,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;oBACrC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;oBACtB,KAAK,EAAE,MAAM,CAAC,KAAK;oBACnB,MAAM,EAAE,MAAM,CAAC,MAAM;iBACxB,CAAC,CAAC;aACN;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,6BAAY,CAAC,yBAAyB,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;aAC1E;QACL,CAAC;KAAA;IAEY,MAAM,CAAC,EAAU;;YAC1B,IAAI;gBACA,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;oBACrC,KAAK,EAAE,EAAE,EAAE,EAAE;iBAChB,CAAC,CAAC;aACN;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,6BAAY,CAAC,yBAAyB,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;aAC1E;QACL,CAAC;KAAA;CACJ,CAAA;4BA5BY,iBAAiB;IAD7B,IAAA,qBAAU,GAAE;;GACA,iBAAiB,CA4B7B"}
|
|
@@ -3,9 +3,8 @@ import { IMeasurements, IMeasurementsMonthly } from "../controllers/interfaces/I
|
|
|
3
3
|
import { IMeasurementResponse } from "../routers/interfaces/IMeasurementResponse";
|
|
4
4
|
export declare class MeasurementRepository extends SequelizeModel {
|
|
5
5
|
constructor();
|
|
6
|
-
getMeasurements(options: IMeasurements
|
|
7
|
-
getMonthlyReadings(options: IMeasurementsMonthly
|
|
6
|
+
getMeasurements(options: IMeasurements): Promise<IMeasurementResponse[]>;
|
|
7
|
+
getMonthlyReadings(options: IMeasurementsMonthly): Promise<Array<Omit<IMeasurementResponse, "time">>>;
|
|
8
8
|
GetAll(): Promise<never>;
|
|
9
9
|
GetOne(): Promise<never>;
|
|
10
|
-
private getWhereAccessLimitation;
|
|
11
10
|
}
|