@golemio/energetics 1.3.5-dev.1300843460 → 1.3.5
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 -6
- package/db/migrations/postgresql/.config.json +1 -1
- package/dist/integration-engine/repositories/oict-energetika/BuildingsRepository.d.ts +4 -0
- package/dist/integration-engine/repositories/oict-energetika/BuildingsRepository.js +19 -0
- package/dist/integration-engine/repositories/oict-energetika/BuildingsRepository.js.map +1 -0
- package/dist/integration-engine/repositories/oict-energetika/DevicesRepository.d.ts +4 -0
- package/dist/integration-engine/repositories/oict-energetika/DevicesRepository.js +19 -0
- package/dist/integration-engine/repositories/oict-energetika/DevicesRepository.js.map +1 -0
- package/dist/integration-engine/tasks/oict-energetika/FetchBuildingsTask.d.ts +9 -0
- package/dist/integration-engine/tasks/oict-energetika/FetchBuildingsTask.js +44 -0
- package/dist/integration-engine/tasks/oict-energetika/FetchBuildingsTask.js.map +1 -0
- package/dist/integration-engine/tasks/oict-energetika/FetchDataTask.js +2 -0
- package/dist/integration-engine/tasks/oict-energetika/FetchDataTask.js.map +1 -1
- package/dist/integration-engine/tasks/oict-energetika/FetchDevicesTask.d.ts +9 -0
- package/dist/integration-engine/tasks/oict-energetika/FetchDevicesTask.js +44 -0
- package/dist/integration-engine/tasks/oict-energetika/FetchDevicesTask.js.map +1 -0
- package/dist/integration-engine/transformations/oict-energetika/BuildingsTransformation.d.ts +7 -0
- package/dist/integration-engine/transformations/oict-energetika/BuildingsTransformation.js +166 -0
- package/dist/integration-engine/transformations/oict-energetika/BuildingsTransformation.js.map +1 -0
- package/dist/integration-engine/transformations/oict-energetika/DevicesTransformation.d.ts +7 -0
- package/dist/integration-engine/transformations/oict-energetika/DevicesTransformation.js +41 -0
- package/dist/integration-engine/transformations/oict-energetika/DevicesTransformation.js.map +1 -0
- package/dist/integration-engine/workers/oict-energetika/OictEnergetikaWorker.js +4 -0
- package/dist/integration-engine/workers/oict-energetika/OictEnergetikaWorker.js.map +1 -1
- package/docs/implementation_documentation.md +41 -41
- package/package.json +2 -4
- package/db/example/01_buildings.sql +0 -206
- package/db/example/02_organizations.sql +0 -24
- package/db/example/03_devices.sql +0 -24
- package/db/migrations/postgresql/20240514074033-buildings.js +0 -53
- package/db/migrations/postgresql/20240514111900-organizations.js +0 -53
- package/db/migrations/postgresql/sqls/20240514074033-buildings-down.sql +0 -2
- package/db/migrations/postgresql/sqls/20240514074033-buildings-up.sql +0 -138
- package/db/migrations/postgresql/sqls/20240514111900-organizations-down.sql +0 -3
- package/db/migrations/postgresql/sqls/20240514111900-organizations-up.sql +0 -37
- package/dist/output-gateway/constants/Links.d.ts +0 -3
- package/dist/output-gateway/constants/Links.js +0 -7
- package/dist/output-gateway/constants/Links.js.map +0 -1
- package/dist/output-gateway/constants/RouteVersion.d.ts +0 -3
- package/dist/output-gateway/constants/RouteVersion.js +0 -8
- package/dist/output-gateway/constants/RouteVersion.js.map +0 -1
- package/dist/output-gateway/controllers/v2/BuildingsController.d.ts +0 -11
- package/dist/output-gateway/controllers/v2/BuildingsController.js +0 -74
- package/dist/output-gateway/controllers/v2/BuildingsController.js.map +0 -1
- package/dist/output-gateway/controllers/v2/V2DevicesController.d.ts +0 -11
- package/dist/output-gateway/controllers/v2/V2DevicesController.js +0 -67
- package/dist/output-gateway/controllers/v2/V2DevicesController.js.map +0 -1
- package/dist/output-gateway/controllers/v2/V2OrganizationsController.d.ts +0 -13
- package/dist/output-gateway/controllers/v2/V2OrganizationsController.js +0 -79
- package/dist/output-gateway/controllers/v2/V2OrganizationsController.js.map +0 -1
- package/dist/output-gateway/helpers/CreateLinkHelper.d.ts +0 -6
- package/dist/output-gateway/helpers/CreateLinkHelper.js +0 -32
- package/dist/output-gateway/helpers/CreateLinkHelper.js.map +0 -1
- package/dist/output-gateway/index.d.ts +0 -1
- package/dist/output-gateway/index.js +0 -10
- package/dist/output-gateway/index.js.map +0 -1
- package/dist/output-gateway/ioc/Di.d.ts +0 -3
- package/dist/output-gateway/ioc/Di.js +0 -51
- package/dist/output-gateway/ioc/Di.js.map +0 -1
- package/dist/output-gateway/ioc/ModuleContainerToken.d.ts +0 -22
- package/dist/output-gateway/ioc/ModuleContainerToken.js +0 -26
- package/dist/output-gateway/ioc/ModuleContainerToken.js.map +0 -1
- package/dist/output-gateway/models/BuildingsPrimaryModel.d.ts +0 -17
- package/dist/output-gateway/models/BuildingsPrimaryModel.js +0 -49
- package/dist/output-gateway/models/BuildingsPrimaryModel.js.map +0 -1
- package/dist/output-gateway/models/BuildingsSecondaryModel.d.ts +0 -124
- package/dist/output-gateway/models/BuildingsSecondaryModel.js +0 -338
- package/dist/output-gateway/models/BuildingsSecondaryModel.js.map +0 -1
- package/dist/output-gateway/models/interfaces/IBuildingsTransformationOutput.d.ts +0 -6
- package/dist/output-gateway/models/interfaces/IBuildingsTransformationOutput.js +0 -2
- package/dist/output-gateway/models/interfaces/IBuildingsTransformationOutput.js.map +0 -1
- package/dist/output-gateway/models/interfaces/IFullTransformationSchemaItem.d.ts +0 -156
- package/dist/output-gateway/models/interfaces/IFullTransformationSchemaItem.js +0 -3
- package/dist/output-gateway/models/interfaces/IFullTransformationSchemaItem.js.map +0 -1
- package/dist/output-gateway/models/interfaces/IPrimaryBuildings.d.ts +0 -10
- package/dist/output-gateway/models/interfaces/IPrimaryBuildings.js +0 -3
- package/dist/output-gateway/models/interfaces/IPrimaryBuildings.js.map +0 -1
- package/dist/output-gateway/models/interfaces/ISecondaryBuildings.d.ts +0 -114
- package/dist/output-gateway/models/interfaces/ISecondaryBuildings.js +0 -3
- package/dist/output-gateway/models/interfaces/ISecondaryBuildings.js.map +0 -1
- package/dist/output-gateway/models/interfaces/ISecondaryBuildingsOutput.d.ts +0 -117
- package/dist/output-gateway/models/interfaces/ISecondaryBuildingsOutput.js +0 -3
- package/dist/output-gateway/models/interfaces/ISecondaryBuildingsOutput.js.map +0 -1
- package/dist/output-gateway/repositories/DevicesRepository.d.ts +0 -8
- package/dist/output-gateway/repositories/DevicesRepository.js +0 -64
- package/dist/output-gateway/repositories/DevicesRepository.js.map +0 -1
- package/dist/output-gateway/repositories/OrganizationBuildingsRepository.d.ts +0 -6
- package/dist/output-gateway/repositories/OrganizationBuildingsRepository.js +0 -47
- package/dist/output-gateway/repositories/OrganizationBuildingsRepository.js.map +0 -1
- package/dist/output-gateway/repositories/OrganizationResponsibleUsersRepository.d.ts +0 -6
- package/dist/output-gateway/repositories/OrganizationResponsibleUsersRepository.js +0 -47
- package/dist/output-gateway/repositories/OrganizationResponsibleUsersRepository.js.map +0 -1
- package/dist/output-gateway/repositories/OrganizationsRepository.d.ts +0 -17
- package/dist/output-gateway/repositories/OrganizationsRepository.js +0 -133
- package/dist/output-gateway/repositories/OrganizationsRepository.js.map +0 -1
- package/dist/output-gateway/repositories/PrimaryBuildingsRepository.d.ts +0 -15
- package/dist/output-gateway/repositories/PrimaryBuildingsRepository.js +0 -86
- package/dist/output-gateway/repositories/PrimaryBuildingsRepository.js.map +0 -1
- package/dist/output-gateway/repositories/SecondaryBuildingsRepository.d.ts +0 -6
- package/dist/output-gateway/repositories/SecondaryBuildingsRepository.js +0 -33
- package/dist/output-gateway/repositories/SecondaryBuildingsRepository.js.map +0 -1
- package/dist/output-gateway/repositories/helpers/OrganizationsAssociations.d.ts +0 -9
- package/dist/output-gateway/repositories/helpers/OrganizationsAssociations.js +0 -47
- package/dist/output-gateway/repositories/helpers/OrganizationsAssociations.js.map +0 -1
- package/dist/output-gateway/repositories/interfaces/IOrganizationBuildingDto.d.ts +0 -5
- package/dist/output-gateway/repositories/interfaces/IOrganizationBuildingDto.js +0 -3
- package/dist/output-gateway/repositories/interfaces/IOrganizationBuildingDto.js.map +0 -1
- package/dist/output-gateway/repositories/interfaces/IOrganizationDetailDto.d.ts +0 -18
- package/dist/output-gateway/repositories/interfaces/IOrganizationDetailDto.js +0 -3
- package/dist/output-gateway/repositories/interfaces/IOrganizationDetailDto.js.map +0 -1
- package/dist/output-gateway/repositories/interfaces/IOrganizationDto.d.ts +0 -4
- package/dist/output-gateway/repositories/interfaces/IOrganizationDto.js +0 -3
- package/dist/output-gateway/repositories/interfaces/IOrganizationDto.js.map +0 -1
- package/dist/output-gateway/repositories/interfaces/IOrganizationResponsibleUserDto.d.ts +0 -8
- package/dist/output-gateway/repositories/interfaces/IOrganizationResponsibleUserDto.js +0 -3
- package/dist/output-gateway/repositories/interfaces/IOrganizationResponsibleUserDto.js.map +0 -1
- package/dist/output-gateway/routers/helpers/parseParams.d.ts +0 -4
- package/dist/output-gateway/routers/helpers/parseParams.js +0 -17
- package/dist/output-gateway/routers/helpers/parseParams.js.map +0 -1
- package/dist/output-gateway/routers/interfaces/IDeviceResponse.d.ts +0 -6
- package/dist/output-gateway/routers/interfaces/IDeviceResponse.js +0 -3
- package/dist/output-gateway/routers/interfaces/IDeviceResponse.js.map +0 -1
- package/dist/output-gateway/routers/interfaces/IOrganizationDetailResponse.d.ts +0 -34
- package/dist/output-gateway/routers/interfaces/IOrganizationDetailResponse.js +0 -3
- package/dist/output-gateway/routers/interfaces/IOrganizationDetailResponse.js.map +0 -1
- package/dist/output-gateway/routers/interfaces/IOrganizationResponse.d.ts +0 -4
- package/dist/output-gateway/routers/interfaces/IOrganizationResponse.js +0 -3
- package/dist/output-gateway/routers/interfaces/IOrganizationResponse.js.map +0 -1
- package/dist/output-gateway/routers/interfaces/IPaginationParams.d.ts +0 -4
- package/dist/output-gateway/routers/interfaces/IPaginationParams.js +0 -3
- package/dist/output-gateway/routers/interfaces/IPaginationParams.js.map +0 -1
- package/dist/output-gateway/routers/v2/BuildingsRouter.d.ts +0 -10
- package/dist/output-gateway/routers/v2/BuildingsRouter.js +0 -26
- package/dist/output-gateway/routers/v2/BuildingsRouter.js.map +0 -1
- package/dist/output-gateway/routers/v2/V2DevicesRouter.d.ts +0 -7
- package/dist/output-gateway/routers/v2/V2DevicesRouter.js +0 -41
- package/dist/output-gateway/routers/v2/V2DevicesRouter.js.map +0 -1
- package/dist/output-gateway/routers/v2/V2OrganizationsRouter.d.ts +0 -7
- package/dist/output-gateway/routers/v2/V2OrganizationsRouter.js +0 -41
- package/dist/output-gateway/routers/v2/V2OrganizationsRouter.js.map +0 -1
- package/dist/output-gateway/transformations/BuildingTransformationFull.d.ts +0 -14
- package/dist/output-gateway/transformations/BuildingTransformationFull.js +0 -215
- package/dist/output-gateway/transformations/BuildingTransformationFull.js.map +0 -1
- package/dist/output-gateway/transformations/BuildingsTransformation.d.ts +0 -8
- package/dist/output-gateway/transformations/BuildingsTransformation.js +0 -38
- package/dist/output-gateway/transformations/BuildingsTransformation.js.map +0 -1
- package/dist/output-gateway/transformations/DeviceDtoTransformation.d.ts +0 -8
- package/dist/output-gateway/transformations/DeviceDtoTransformation.js +0 -43
- package/dist/output-gateway/transformations/DeviceDtoTransformation.js.map +0 -1
- package/dist/output-gateway/transformations/OrganizationDetailDtoTransformation.d.ts +0 -9
- package/dist/output-gateway/transformations/OrganizationDetailDtoTransformation.js +0 -64
- package/dist/output-gateway/transformations/OrganizationDetailDtoTransformation.js.map +0 -1
- package/dist/output-gateway/transformations/OrganizationDtoTransformation.d.ts +0 -9
- package/dist/output-gateway/transformations/OrganizationDtoTransformation.js +0 -36
- package/dist/output-gateway/transformations/OrganizationDtoTransformation.js.map +0 -1
- package/dist/schema-definitions/models/OrganizationBuildingModel.d.ts +0 -10
- package/dist/schema-definitions/models/OrganizationBuildingModel.js +0 -33
- package/dist/schema-definitions/models/OrganizationBuildingModel.js.map +0 -1
- package/dist/schema-definitions/models/OrganizationResponsibleUsersModel.d.ts +0 -16
- package/dist/schema-definitions/models/OrganizationResponsibleUsersModel.js +0 -44
- package/dist/schema-definitions/models/OrganizationResponsibleUsersModel.js.map +0 -1
- package/dist/schema-definitions/models/OrganizationsModel.d.ts +0 -21
- package/dist/schema-definitions/models/OrganizationsModel.js +0 -59
- package/dist/schema-definitions/models/OrganizationsModel.js.map +0 -1
- package/dist/schema-definitions/models/interfaces/IOrganizationBuildingsModel.d.ts +0 -4
- package/dist/schema-definitions/models/interfaces/IOrganizationBuildingsModel.js +0 -3
- package/dist/schema-definitions/models/interfaces/IOrganizationBuildingsModel.js.map +0 -1
- package/dist/schema-definitions/models/interfaces/IOrganizationResponsibleUsersModel.d.ts +0 -10
- package/dist/schema-definitions/models/interfaces/IOrganizationResponsibleUsersModel.js +0 -3
- package/dist/schema-definitions/models/interfaces/IOrganizationResponsibleUsersModel.js.map +0 -1
- package/dist/schema-definitions/models/interfaces/IOrganizationsModel.d.ts +0 -15
- package/dist/schema-definitions/models/interfaces/IOrganizationsModel.js +0 -3
- package/dist/schema-definitions/models/interfaces/IOrganizationsModel.js.map +0 -1
- package/docs/openapi-output.yaml +0 -834
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.OrganizationsRepository = void 0;
|
|
25
|
-
const ModuleContainerToken_1 = require("../ioc/ModuleContainerToken");
|
|
26
|
-
const _sch_1 = require("../../schema-definitions");
|
|
27
|
-
const output_gateway_1 = require("@golemio/core/dist/output-gateway");
|
|
28
|
-
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
29
|
-
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
30
|
-
const OrganizationsModel_1 = require("../../schema-definitions/models/OrganizationsModel");
|
|
31
|
-
const OrganizationResponsibleUsersRepository_1 = require("./OrganizationResponsibleUsersRepository");
|
|
32
|
-
const PrimaryBuildingsRepository_1 = require("./PrimaryBuildingsRepository");
|
|
33
|
-
const OrganizationsAssociations_1 = require("./helpers/OrganizationsAssociations");
|
|
34
|
-
const OrganizationBuildingsRepository_1 = require("./OrganizationBuildingsRepository");
|
|
35
|
-
let OrganizationsRepository = exports.OrganizationsRepository = class OrganizationsRepository extends output_gateway_1.SequelizeModel {
|
|
36
|
-
constructor(userRepository, organizationBuildingsRepository, buildingsRepository) {
|
|
37
|
-
super("OrganizationsRepository", OrganizationsModel_1.OrganizationsModel.TABLE_NAME, OrganizationsModel_1.OrganizationsModel.attributeModel, {
|
|
38
|
-
schema: _sch_1.EnergeticsSchema.pgSchema,
|
|
39
|
-
});
|
|
40
|
-
this.userRepository = userRepository;
|
|
41
|
-
this.organizationBuildingsRepository = organizationBuildingsRepository;
|
|
42
|
-
this.buildingsRepository = buildingsRepository;
|
|
43
|
-
this.associate();
|
|
44
|
-
}
|
|
45
|
-
associate() {
|
|
46
|
-
OrganizationsAssociations_1.OrganizationsAssociations.associateResponsibleUsers(this.sequelizeModel, this.userRepository.sequelizeModel);
|
|
47
|
-
OrganizationsAssociations_1.OrganizationsAssociations.associateBuildings(this.sequelizeModel, this.buildingsRepository.sequelizeModel, this.organizationBuildingsRepository.sequelizeModel);
|
|
48
|
-
}
|
|
49
|
-
GetAllPublic(params) {
|
|
50
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
try {
|
|
52
|
-
return yield this.sequelizeModel.findAll({
|
|
53
|
-
attributes: ["id", "name"],
|
|
54
|
-
order: [["id", "ASC"]],
|
|
55
|
-
limit: params.limit,
|
|
56
|
-
offset: params.offset,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
catch (err) {
|
|
60
|
-
throw new golemio_errors_1.GeneralError("Database error - GetAll", this.name, err, 500);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
GetAll(params) {
|
|
65
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
try {
|
|
67
|
-
return yield this.sequelizeModel.findAll({
|
|
68
|
-
include: [
|
|
69
|
-
{
|
|
70
|
-
model: this.userRepository.sequelizeModel,
|
|
71
|
-
as: "responsible_user",
|
|
72
|
-
attributes: { exclude: ["id", "organization_id"] },
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
model: this.buildingsRepository.sequelizeModel,
|
|
76
|
-
as: "buildings",
|
|
77
|
-
attributes: ["id", "building_name", "building_address_code"],
|
|
78
|
-
through: { attributes: [] },
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
order: [
|
|
82
|
-
["id", "ASC"],
|
|
83
|
-
[{ model: this.userRepository.sequelizeModel, as: "responsible_user" }, "id", "ASC"],
|
|
84
|
-
[{ model: this.buildingsRepository.sequelizeModel, as: "buildings" }, "id", "ASC"],
|
|
85
|
-
],
|
|
86
|
-
limit: params.limit,
|
|
87
|
-
offset: params.offset,
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
catch (err) {
|
|
91
|
-
throw new golemio_errors_1.GeneralError("Database error - GetAllDetail", this.name, err, 500);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
GetOne(id) {
|
|
96
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
-
try {
|
|
98
|
-
return yield this.sequelizeModel.findOne({
|
|
99
|
-
include: [
|
|
100
|
-
{
|
|
101
|
-
model: this.userRepository.sequelizeModel,
|
|
102
|
-
as: "responsible_user",
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
model: this.buildingsRepository.sequelizeModel,
|
|
106
|
-
as: "buildings",
|
|
107
|
-
attributes: ["id", "building_name", "building_address_code"],
|
|
108
|
-
through: { attributes: [] },
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
where: { id },
|
|
112
|
-
order: [
|
|
113
|
-
[{ model: this.userRepository.sequelizeModel, as: "responsible_user" }, "id", "ASC"],
|
|
114
|
-
[{ model: this.buildingsRepository.sequelizeModel, as: "buildings" }, "id", "ASC"],
|
|
115
|
-
],
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
catch (err) {
|
|
119
|
-
throw new golemio_errors_1.GeneralError("Database error - GetOne", this.name, err, 500);
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
exports.OrganizationsRepository = OrganizationsRepository = __decorate([
|
|
125
|
-
(0, tsyringe_1.injectable)(),
|
|
126
|
-
__param(0, (0, tsyringe_1.inject)(ModuleContainerToken_1.ModuleContainerToken.OrganizationResponsibleUsersRepository)),
|
|
127
|
-
__param(1, (0, tsyringe_1.inject)(ModuleContainerToken_1.ModuleContainerToken.OrganizationBuildingsRepository)),
|
|
128
|
-
__param(2, (0, tsyringe_1.inject)(ModuleContainerToken_1.ModuleContainerToken.PrimaryBuildingsRepository)),
|
|
129
|
-
__metadata("design:paramtypes", [OrganizationResponsibleUsersRepository_1.OrganizationResponsibleUsersRepository,
|
|
130
|
-
OrganizationBuildingsRepository_1.OrganizationBuildingsRepository,
|
|
131
|
-
PrimaryBuildingsRepository_1.PrimaryBuildingsRepository])
|
|
132
|
-
], OrganizationsRepository);
|
|
133
|
-
//# sourceMappingURL=OrganizationsRepository.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OrganizationsRepository.js","sourceRoot":"","sources":["../../../src/output-gateway/repositories/OrganizationsRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAoE;AACpE,mDAAwC;AACxC,sEAAmE;AACnE,6EAAwE;AACxE,iEAAwE;AACxE,2FAAoE;AAEpE,qGAAiH;AAGjH,6EAAyF;AACzF,mFAA+F;AAC/F,uFAAmG;AAG5F,IAAM,uBAAuB,qCAA7B,MAAM,uBAAwB,SAAQ,+BAAc;IACvD,YAEY,cAAsD,EAEtD,+BAAgE,EACP,mBAA+C;QAEhH,KAAK,CAAC,yBAAyB,EAAE,uCAAkB,CAAC,UAAU,EAAE,uCAAkB,CAAC,cAAc,EAAE;YAC/F,MAAM,EAAE,uBAAgB,CAAC,QAAQ;SACpC,CAAC,CAAC;QAPK,mBAAc,GAAd,cAAc,CAAwC;QAEtD,oCAA+B,GAA/B,+BAA+B,CAAiC;QACP,wBAAmB,GAAnB,mBAAmB,CAA4B;QAMhH,IAAI,CAAC,SAAS,EAAE,CAAC;IACrB,CAAC;IAEM,SAAS;QACZ,qDAAyB,CAAC,yBAAyB,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAC7G,qDAAyB,CAAC,kBAAkB,CACxC,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,mBAAmB,CAAC,cAAc,EACvC,IAAI,CAAC,+BAA+B,CAAC,cAAc,CACtD,CAAC;IACN,CAAC;IA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EAAC,2CAAoB,CAAC,sCAAsC,CAAC,CAAA;IAEnE,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,+BAA+B,CAAC,CAAA;IAE5D,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,0BAA0B,CAAC,CAAA;qCAHhC,+EAAsC;QAErB,iEAA+B;QACc,uDAA0B;GAN3G,uBAAuB,CA2FnC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { IBuildingsPrimary } from "../models/interfaces/IPrimaryBuildings";
|
|
2
|
-
import { ISecondaryBuildingsOutput } from "../models/interfaces/ISecondaryBuildingsOutput";
|
|
3
|
-
import { SequelizeModel } from "@golemio/core/dist/output-gateway";
|
|
4
|
-
export declare class PrimaryBuildingsRepository extends SequelizeModel {
|
|
5
|
-
private secondaryBuildingRepository;
|
|
6
|
-
constructor();
|
|
7
|
-
associate: () => void;
|
|
8
|
-
GetAll(): Promise<IBuildingsPrimary[]>;
|
|
9
|
-
GetAllFull(): Promise<Array<IBuildingsPrimary & {
|
|
10
|
-
secondary: ISecondaryBuildingsOutput;
|
|
11
|
-
}>>;
|
|
12
|
-
GetOne(id: number): Promise<(IBuildingsPrimary & {
|
|
13
|
-
secondary: ISecondaryBuildingsOutput;
|
|
14
|
-
}) | null>;
|
|
15
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.PrimaryBuildingsRepository = void 0;
|
|
22
|
-
const BuildingsPrimaryModel_1 = require("../models/BuildingsPrimaryModel");
|
|
23
|
-
const output_gateway_1 = require("@golemio/core/dist/output-gateway");
|
|
24
|
-
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
25
|
-
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
26
|
-
const SecondaryBuildingsRepository_1 = require("./SecondaryBuildingsRepository");
|
|
27
|
-
let PrimaryBuildingsRepository = exports.PrimaryBuildingsRepository = class PrimaryBuildingsRepository extends output_gateway_1.SequelizeModel {
|
|
28
|
-
constructor() {
|
|
29
|
-
super(BuildingsPrimaryModel_1.BuildingsPrimaryModel.modelName, BuildingsPrimaryModel_1.BuildingsPrimaryModel.tableName, BuildingsPrimaryModel_1.BuildingsPrimaryModel.attributeModel, {
|
|
30
|
-
schema: "energetics",
|
|
31
|
-
});
|
|
32
|
-
this.associate = () => {
|
|
33
|
-
this.sequelizeModel.hasOne(this.secondaryBuildingRepository.sequelizeModel, {
|
|
34
|
-
as: "secondary",
|
|
35
|
-
foreignKey: "id",
|
|
36
|
-
sourceKey: "id",
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
this.secondaryBuildingRepository = new SecondaryBuildingsRepository_1.SecondaryBuildingsRepository();
|
|
40
|
-
this.associate();
|
|
41
|
-
}
|
|
42
|
-
GetAll() {
|
|
43
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
try {
|
|
45
|
-
return this.sequelizeModel.findAll({
|
|
46
|
-
order: [["id", "DESC"]],
|
|
47
|
-
raw: true,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
catch (err) {
|
|
51
|
-
throw new golemio_errors_1.GeneralError("Database error ~ GetAll BuildingsRepository", this.name, err, 500);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
GetAllFull() {
|
|
56
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
try {
|
|
58
|
-
return this.sequelizeModel.findAll({
|
|
59
|
-
include: [{ as: "secondary", model: this.secondaryBuildingRepository.sequelizeModel }],
|
|
60
|
-
order: [["id", "DESC"]],
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
catch (err) {
|
|
64
|
-
throw new golemio_errors_1.GeneralError("Database error ~ GetAll BuildingsRepository", this.name, err, 500);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
GetOne(id) {
|
|
69
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
try {
|
|
71
|
-
return yield this.sequelizeModel.findOne({
|
|
72
|
-
include: [{ as: "secondary", model: this.secondaryBuildingRepository.sequelizeModel }],
|
|
73
|
-
where: { id: id },
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
catch (err) {
|
|
77
|
-
throw new golemio_errors_1.GeneralError("Database error ~ GetOne BuildingsRepository", this.name, err, 500);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
exports.PrimaryBuildingsRepository = PrimaryBuildingsRepository = __decorate([
|
|
83
|
-
(0, tsyringe_1.injectable)(),
|
|
84
|
-
__metadata("design:paramtypes", [])
|
|
85
|
-
], PrimaryBuildingsRepository);
|
|
86
|
-
//# sourceMappingURL=PrimaryBuildingsRepository.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PrimaryBuildingsRepository.js","sourceRoot":"","sources":["../../../src/output-gateway/repositories/PrimaryBuildingsRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,2EAAyE;AAGzE,sEAAmE;AACnE,6EAAwE;AACxE,iEAAgE;AAChE,iFAA8E;AAGvE,IAAM,0BAA0B,wCAAhC,MAAM,0BAA2B,SAAQ,+BAAc;IAE1D;QACI,KAAK,CAAC,6CAAqB,CAAC,SAAS,EAAE,6CAAqB,CAAC,SAAS,EAAE,6CAAqB,CAAC,cAAc,EAAE;YAC1G,MAAM,EAAE,YAAY;SACvB,CAAC,CAAC;QAKA,cAAS,GAAG,GAAG,EAAE;YACpB,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,cAAc,EAAE;gBACxE,EAAE,EAAE,WAAW;gBACf,UAAU,EAAE,IAAI;gBAChB,SAAS,EAAE,IAAI;aAClB,CAAC,CAAC;QACP,CAAC,CAAC;QAVE,IAAI,CAAC,2BAA2B,GAAG,IAAI,2DAA4B,EAAE,CAAC;QACtE,IAAI,CAAC,SAAS,EAAE,CAAC;IACrB,CAAC;IAUY,MAAM;;YACf,IAAI;gBACA,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAwB;oBACtD,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;oBACvB,GAAG,EAAE,IAAI;iBACZ,CAAC,CAAC;aACN;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,6BAAY,CAAC,6CAA6C,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;aAC9F;QACL,CAAC;KAAA;IAEY,UAAU;;YACnB,IAAI;gBACA,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAmE;oBACjG,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,2BAA2B,CAAC,cAAc,EAAE,CAAC;oBACtF,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;iBAC1B,CAAC,CAAC;aACN;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,6BAAY,CAAC,6CAA6C,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;aAC9F;QACL,CAAC;KAAA;IAEY,MAAM,CAAC,EAAU;;YAC1B,IAAI;gBACA,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAmE;oBACvG,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,2BAA2B,CAAC,cAAc,EAAE,CAAC;oBACtF,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;iBACpB,CAAC,CAAC;aACN;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,6BAAY,CAAC,6CAA6C,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;aAC9F;QACL,CAAC;KAAA;CACJ,CAAA;qCAlDY,0BAA0B;IADtC,IAAA,qBAAU,GAAE;;GACA,0BAA0B,CAkDtC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.SecondaryBuildingsRepository = void 0;
|
|
13
|
-
const BuildingsSecondaryModel_1 = require("../models/BuildingsSecondaryModel");
|
|
14
|
-
const output_gateway_1 = require("@golemio/core/dist/output-gateway");
|
|
15
|
-
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
16
|
-
let SecondaryBuildingsRepository = exports.SecondaryBuildingsRepository = class SecondaryBuildingsRepository extends output_gateway_1.SequelizeModel {
|
|
17
|
-
constructor() {
|
|
18
|
-
super(BuildingsSecondaryModel_1.BuildingsSecondaryModel.modelName, BuildingsSecondaryModel_1.BuildingsSecondaryModel.tableName, BuildingsSecondaryModel_1.BuildingsSecondaryModel.attributeModel, {
|
|
19
|
-
schema: "energetics",
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
GetAll() {
|
|
23
|
-
throw new Error("Not implemented");
|
|
24
|
-
}
|
|
25
|
-
GetOne() {
|
|
26
|
-
throw new Error("Not implemented");
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
exports.SecondaryBuildingsRepository = SecondaryBuildingsRepository = __decorate([
|
|
30
|
-
(0, tsyringe_1.injectable)(),
|
|
31
|
-
__metadata("design:paramtypes", [])
|
|
32
|
-
], SecondaryBuildingsRepository);
|
|
33
|
-
//# sourceMappingURL=SecondaryBuildingsRepository.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SecondaryBuildingsRepository.js","sourceRoot":"","sources":["../../../src/output-gateway/repositories/SecondaryBuildingsRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+EAA6E;AAC7E,sEAAmE;AACnE,iEAAgE;AAGzD,IAAM,4BAA4B,0CAAlC,MAAM,4BAA6B,SAAQ,+BAAc;IAC5D;QACI,KAAK,CAAC,iDAAuB,CAAC,SAAS,EAAE,iDAAuB,CAAC,SAAS,EAAE,iDAAuB,CAAC,cAAc,EAAE;YAChH,MAAM,EAAE,YAAY;SACvB,CAAC,CAAC;IACP,CAAC;IAED,MAAM;QACF,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;IAED,MAAM;QACF,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;CACJ,CAAA;uCAdY,4BAA4B;IADxC,IAAA,qBAAU,GAAE;;GACA,4BAA4B,CAcxC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ModelStatic } from "@golemio/core/dist/shared/sequelize";
|
|
2
|
-
import { OrganizationsModel } from "../../../schema-definitions/models/OrganizationsModel";
|
|
3
|
-
import { OrganizationResponsibleUsersModel } from "../../../schema-definitions/models/OrganizationResponsibleUsersModel";
|
|
4
|
-
import { OrganizationBuildingModel } from "../../../schema-definitions/models/OrganizationBuildingModel";
|
|
5
|
-
import { BuildingsModel } from "../../../schema-definitions/models";
|
|
6
|
-
export declare class OrganizationsAssociations {
|
|
7
|
-
static associateResponsibleUsers(primaryTable: ModelStatic<OrganizationsModel>, secondaryTable: ModelStatic<OrganizationResponsibleUsersModel>): void;
|
|
8
|
-
static associateBuildings(primaryTable: ModelStatic<OrganizationsModel>, secondaryTable: ModelStatic<BuildingsModel>, relationTable: ModelStatic<OrganizationBuildingModel>): void;
|
|
9
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OrganizationsAssociations = void 0;
|
|
4
|
-
class OrganizationsAssociations {
|
|
5
|
-
static associateResponsibleUsers(primaryTable, secondaryTable) {
|
|
6
|
-
primaryTable.hasMany(secondaryTable, {
|
|
7
|
-
foreignKey: "organization_id",
|
|
8
|
-
sourceKey: "id",
|
|
9
|
-
as: "responsible_user",
|
|
10
|
-
});
|
|
11
|
-
secondaryTable.belongsTo(primaryTable, {
|
|
12
|
-
foreignKey: "organization_id",
|
|
13
|
-
targetKey: "id",
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
static associateBuildings(primaryTable, secondaryTable, relationTable) {
|
|
17
|
-
primaryTable.belongsToMany(secondaryTable, {
|
|
18
|
-
through: relationTable,
|
|
19
|
-
foreignKey: "organization_id",
|
|
20
|
-
otherKey: "building_id",
|
|
21
|
-
as: "buildings",
|
|
22
|
-
});
|
|
23
|
-
secondaryTable.belongsToMany(primaryTable, {
|
|
24
|
-
through: relationTable,
|
|
25
|
-
foreignKey: "building_id",
|
|
26
|
-
otherKey: "organization_id",
|
|
27
|
-
});
|
|
28
|
-
relationTable.belongsTo(primaryTable, {
|
|
29
|
-
targetKey: "id",
|
|
30
|
-
foreignKey: "organization_id",
|
|
31
|
-
});
|
|
32
|
-
relationTable.belongsTo(secondaryTable, {
|
|
33
|
-
targetKey: "id",
|
|
34
|
-
foreignKey: "building_id",
|
|
35
|
-
});
|
|
36
|
-
primaryTable.hasMany(relationTable, {
|
|
37
|
-
sourceKey: "id",
|
|
38
|
-
foreignKey: "organization_id",
|
|
39
|
-
});
|
|
40
|
-
secondaryTable.hasMany(relationTable, {
|
|
41
|
-
sourceKey: "id",
|
|
42
|
-
foreignKey: "building_id",
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.OrganizationsAssociations = OrganizationsAssociations;
|
|
47
|
-
//# sourceMappingURL=OrganizationsAssociations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OrganizationsAssociations.js","sourceRoot":"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|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IOrganizationBuildingDto.js","sourceRoot":"","sources":["../../../../src/output-gateway/repositories/interfaces/IOrganizationBuildingDto.ts"],"names":[],"mappings":""}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { IOrganizationDto } from "./IOrganizationDto";
|
|
2
|
-
import { IOrganizationBuildingDto } from "./IOrganizationBuildingDto";
|
|
3
|
-
import { IOrganizationResponsibleUserDto } from "./IOrganizationResponsibleUserDto";
|
|
4
|
-
export interface IOrganizationDetailDto extends IOrganizationDto {
|
|
5
|
-
label: string | null;
|
|
6
|
-
address_street: string | null;
|
|
7
|
-
address_house_number: string | null;
|
|
8
|
-
address_city: string | null;
|
|
9
|
-
address_country: string | null;
|
|
10
|
-
address_mail: string | null;
|
|
11
|
-
address_phone: string | null;
|
|
12
|
-
address_web_address: string | null;
|
|
13
|
-
category: string | null;
|
|
14
|
-
created_by_id: number | null;
|
|
15
|
-
grafana_url: string | null;
|
|
16
|
-
responsible_user: IOrganizationResponsibleUserDto[];
|
|
17
|
-
buildings: IOrganizationBuildingDto[];
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IOrganizationDetailDto.js","sourceRoot":"","sources":["../../../../src/output-gateway/repositories/interfaces/IOrganizationDetailDto.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IOrganizationDto.js","sourceRoot":"","sources":["../../../../src/output-gateway/repositories/interfaces/IOrganizationDto.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IOrganizationResponsibleUserDto.js","sourceRoot":"","sources":["../../../../src/output-gateway/repositories/interfaces/IOrganizationResponsibleUserDto.ts"],"names":[],"mappings":""}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseParams = void 0;
|
|
4
|
-
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
5
|
-
function parseParams(req) {
|
|
6
|
-
try {
|
|
7
|
-
return {
|
|
8
|
-
limit: req.query.limit ? parseInt(req.query.limit) : undefined,
|
|
9
|
-
offset: req.query.offset ? parseInt(req.query.offset) : undefined,
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
catch (err) {
|
|
13
|
-
throw new golemio_errors_1.GeneralError("Param parsing error", "V3ParkingController", err, 500);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.parseParams = parseParams;
|
|
17
|
-
//# sourceMappingURL=parseParams.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseParams.js","sourceRoot":"","sources":["../../../../src/output-gateway/routers/helpers/parseParams.ts"],"names":[],"mappings":";;;AACA,6EAAwE;AAGxE,SAAgB,WAAW,CAAC,GAAY;IACpC,IAAI;QACA,OAAO;YACH,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,KAAe,CAAC,CAAC,CAAC,CAAC,SAAS;YACxE,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,MAAgB,CAAC,CAAC,CAAC,CAAC,SAAS;SAC9E,CAAC;KACL;IAAC,OAAO,GAAG,EAAE;QACV,MAAM,IAAI,6BAAY,CAAC,qBAAqB,EAAE,qBAAqB,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;KAClF;AACL,CAAC;AATD,kCASC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { IDevicesModel } from "../../../schema-definitions/models/interfaces";
|
|
2
|
-
export interface IDeviceResponse extends Omit<IDevicesModel, "location_number" | "replaced_meter_id" | "meter_index"> {
|
|
3
|
-
location_number: string | null;
|
|
4
|
-
replaced_meter_id: string | null;
|
|
5
|
-
meter_index: number | null;
|
|
6
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IDeviceResponse.js","sourceRoot":"","sources":["../../../../src/output-gateway/routers/interfaces/IDeviceResponse.ts"],"names":[],"mappings":""}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { IOrganizationResponse } from "./IOrganizationResponse";
|
|
2
|
-
interface IResponsibleUserResponse {
|
|
3
|
-
name: string | null;
|
|
4
|
-
last_name: string | null;
|
|
5
|
-
position: string | null;
|
|
6
|
-
phone: string | null;
|
|
7
|
-
mail: string | null;
|
|
8
|
-
company: string | null;
|
|
9
|
-
}
|
|
10
|
-
interface IBuildingResponse {
|
|
11
|
-
id: number;
|
|
12
|
-
name: string | null;
|
|
13
|
-
building_address_code: string | null;
|
|
14
|
-
link: string;
|
|
15
|
-
}
|
|
16
|
-
export interface IOrganizationDetailResponse extends IOrganizationResponse {
|
|
17
|
-
label: string | null;
|
|
18
|
-
category: string | null;
|
|
19
|
-
created_by_id: string | null;
|
|
20
|
-
grafana_url: string | null;
|
|
21
|
-
address: {
|
|
22
|
-
street: string | null;
|
|
23
|
-
house_number: string | null;
|
|
24
|
-
city: string | null;
|
|
25
|
-
country: string | null;
|
|
26
|
-
mail: string | null;
|
|
27
|
-
phone: string | null;
|
|
28
|
-
web_address: string | null;
|
|
29
|
-
};
|
|
30
|
-
responsible_user: IResponsibleUserResponse[];
|
|
31
|
-
buildings: IBuildingResponse[];
|
|
32
|
-
link: string;
|
|
33
|
-
}
|
|
34
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IOrganizationDetailResponse.js","sourceRoot":"","sources":["../../../../src/output-gateway/routers/interfaces/IOrganizationDetailResponse.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IOrganizationResponse.js","sourceRoot":"","sources":["../../../../src/output-gateway/routers/interfaces/IOrganizationResponse.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IPaginationParams.js","sourceRoot":"","sources":["../../../../src/output-gateway/routers/interfaces/IPaginationParams.ts"],"names":[],"mappings":""}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { AbstractRouter } from "@golemio/core/dist/helpers/routing/AbstractRouter";
|
|
2
|
-
export declare class BuildingsRouter extends AbstractRouter {
|
|
3
|
-
private controller;
|
|
4
|
-
private cacheHeaderMiddleware;
|
|
5
|
-
private maxAge;
|
|
6
|
-
constructor();
|
|
7
|
-
protected initRoutes(): void;
|
|
8
|
-
}
|
|
9
|
-
declare const v2BuildingsRouter: AbstractRouter;
|
|
10
|
-
export { v2BuildingsRouter };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.v2BuildingsRouter = exports.BuildingsRouter = void 0;
|
|
4
|
-
const BuildingsController_1 = require("../../controllers/v2/BuildingsController");
|
|
5
|
-
const Di_1 = require("../../ioc/Di");
|
|
6
|
-
const AbstractRouter_1 = require("@golemio/core/dist/helpers/routing/AbstractRouter");
|
|
7
|
-
const Validation_1 = require("@golemio/core/dist/output-gateway/Validation");
|
|
8
|
-
const ioc_1 = require("@golemio/core/dist/output-gateway/ioc");
|
|
9
|
-
const express_validator_1 = require("@golemio/core/dist/shared/express-validator");
|
|
10
|
-
class BuildingsRouter extends AbstractRouter_1.AbstractRouter {
|
|
11
|
-
constructor() {
|
|
12
|
-
super("v2", "buildings");
|
|
13
|
-
this.maxAge = 6 * 60 * 60; // 6 hours
|
|
14
|
-
this.controller = new BuildingsController_1.BuildingsController();
|
|
15
|
-
this.cacheHeaderMiddleware = Di_1.OGEnergeticsContainer.resolve(ioc_1.ContainerToken.CacheHeaderMiddleware);
|
|
16
|
-
this.initRoutes();
|
|
17
|
-
}
|
|
18
|
-
initRoutes() {
|
|
19
|
-
this.router.get("/", this.cacheHeaderMiddleware.getMiddleware(this.maxAge), this.controller.getAll);
|
|
20
|
-
this.router.get("/:id", this.cacheHeaderMiddleware.getMiddleware(this.maxAge), (0, express_validator_1.param)("id").exists().isNumeric().not().isArray(), Validation_1.checkErrors, this.controller.getOne);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
exports.BuildingsRouter = BuildingsRouter;
|
|
24
|
-
const v2BuildingsRouter = new BuildingsRouter();
|
|
25
|
-
exports.v2BuildingsRouter = v2BuildingsRouter;
|
|
26
|
-
//# sourceMappingURL=BuildingsRouter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BuildingsRouter.js","sourceRoot":"","sources":["../../../../src/output-gateway/routers/v2/BuildingsRouter.ts"],"names":[],"mappings":";;;AAAA,kFAA6E;AAC7E,qCAAmD;AACnD,sFAAmF;AAEnF,6EAA2E;AAC3E,+DAAuE;AACvE,mFAAoE;AAEpE,MAAa,eAAgB,SAAQ,+BAAc;IAK/C;QACI,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAHrB,WAAM,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,UAAU;QAIpC,IAAI,CAAC,UAAU,GAAG,IAAI,yCAAmB,EAAE,CAAC;QAC5C,IAAI,CAAC,qBAAqB,GAAG,0BAAqB,CAAC,OAAO,CAAwB,oBAAc,CAAC,qBAAqB,CAAC,CAAC;QACxH,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;IAES,UAAU;QAChB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,qBAAqB,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACpG,IAAI,CAAC,MAAM,CAAC,GAAG,CACX,MAAM,EACN,IAAI,CAAC,qBAAqB,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,EACrD,IAAA,yBAAK,EAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,EAChD,wBAAW,EACX,IAAI,CAAC,UAAU,CAAC,MAAM,CACzB,CAAC;IACN,CAAC;CACJ;AAtBD,0CAsBC;AAED,MAAM,iBAAiB,GAAmB,IAAI,eAAe,EAAE,CAAC;AAEvD,8CAAiB"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { AbstractRouter } from "@golemio/core/dist/helpers/routing/AbstractRouter";
|
|
2
|
-
import { V2DevicesController } from "../../controllers/v2/V2DevicesController";
|
|
3
|
-
export declare class V2DevicesRouter extends AbstractRouter {
|
|
4
|
-
private controller;
|
|
5
|
-
constructor(controller: V2DevicesController);
|
|
6
|
-
protected initRoutes(): void;
|
|
7
|
-
}
|