dt-common-device 13.0.0 → 13.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -255,7 +255,8 @@ let AdminRepository = (() => {
|
|
|
255
255
|
WHERE "id" = $1
|
|
256
256
|
`;
|
|
257
257
|
}
|
|
258
|
-
const
|
|
258
|
+
const params = propertyId ? [accessGroupId, propertyId] : [accessGroupId];
|
|
259
|
+
const result = await this.postgres.query(query, params);
|
|
259
260
|
if (result.rows.length > 0) {
|
|
260
261
|
return result.rows[0];
|
|
261
262
|
}
|
|
@@ -281,7 +282,8 @@ let AdminRepository = (() => {
|
|
|
281
282
|
else {
|
|
282
283
|
query = `SELECT * FROM dt_zones WHERE "id" = $1`;
|
|
283
284
|
}
|
|
284
|
-
const
|
|
285
|
+
const params = propertyId ? [zoneId, propertyId] : [zoneId];
|
|
286
|
+
const zone = await this.postgres.query(query, params);
|
|
285
287
|
if (zone.rows.length > 0) {
|
|
286
288
|
const zoneData = zone.rows[0];
|
|
287
289
|
const zoneType = await this.postgres.query(`SELECT * FROM "dt_zoneTypes" WHERE "id" = $1`, [zoneData.zoneTypeId]);
|
|
@@ -1,44 +1,97 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
4
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
5
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
6
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
7
|
+
var _, done = false;
|
|
8
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
+
var context = {};
|
|
10
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
+
if (kind === "accessor") {
|
|
15
|
+
if (result === void 0) continue;
|
|
16
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
+
}
|
|
21
|
+
else if (_ = accept(result)) {
|
|
22
|
+
if (kind === "field") initializers.unshift(_);
|
|
23
|
+
else descriptor[key] = _;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
+
done = true;
|
|
28
|
+
};
|
|
29
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
+
var useValue = arguments.length > 2;
|
|
31
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
+
}
|
|
34
|
+
return useValue ? value : void 0;
|
|
35
|
+
};
|
|
36
|
+
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
37
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
38
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
39
|
+
};
|
|
2
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
41
|
exports.LocalConnectionService = void 0;
|
|
4
42
|
const typedi_1 = require("typedi");
|
|
5
43
|
const Connection_repository_1 = require("./Connection.repository");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
!data.connectionProvider) {
|
|
15
|
-
throw new Error("Missing required fields");
|
|
16
|
-
}
|
|
17
|
-
return await this.connectionRepository.createConnection(data);
|
|
18
|
-
}
|
|
19
|
-
async getConnection(connectionId) {
|
|
20
|
-
if (!connectionId) {
|
|
21
|
-
throw new Error("Connection ID is required");
|
|
44
|
+
let LocalConnectionService = (() => {
|
|
45
|
+
let _classDecorators = [(0, typedi_1.Service)()];
|
|
46
|
+
let _classDescriptor;
|
|
47
|
+
let _classExtraInitializers = [];
|
|
48
|
+
let _classThis;
|
|
49
|
+
var LocalConnectionService = _classThis = class {
|
|
50
|
+
constructor() {
|
|
51
|
+
this.connectionRepository = typedi_1.Container.get(Connection_repository_1.ConnectionRepository);
|
|
22
52
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
53
|
+
async createConnection(data) {
|
|
54
|
+
if (!data.connectionName ||
|
|
55
|
+
!data.connectionRefId ||
|
|
56
|
+
!data.propertyId ||
|
|
57
|
+
!data.connectionProvider) {
|
|
58
|
+
throw new Error("Missing required fields");
|
|
59
|
+
}
|
|
60
|
+
return await this.connectionRepository.createConnection(data);
|
|
28
61
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
62
|
+
async getConnection(connectionId) {
|
|
63
|
+
if (!connectionId) {
|
|
64
|
+
throw new Error("Connection ID is required");
|
|
65
|
+
}
|
|
66
|
+
return await this.connectionRepository.getConnectionById(connectionId);
|
|
34
67
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
68
|
+
async getConnectionsByPropertyId(propertyId) {
|
|
69
|
+
if (!propertyId) {
|
|
70
|
+
throw new Error("Property ID is required");
|
|
71
|
+
}
|
|
72
|
+
return await this.connectionRepository.getConnectionsByPropertyId(propertyId);
|
|
40
73
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
74
|
+
async queryConnections(query) {
|
|
75
|
+
if (!query || Object.keys(query).length === 0) {
|
|
76
|
+
throw new Error("Query is required");
|
|
77
|
+
}
|
|
78
|
+
return await this.connectionRepository.queryConnections(query);
|
|
79
|
+
}
|
|
80
|
+
async updateConnection(connectionId, data) {
|
|
81
|
+
if (!connectionId) {
|
|
82
|
+
throw new Error("Connection ID is required");
|
|
83
|
+
}
|
|
84
|
+
return await this.connectionRepository.updateConnection(connectionId, data);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
__setFunctionName(_classThis, "LocalConnectionService");
|
|
88
|
+
(() => {
|
|
89
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
90
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
91
|
+
LocalConnectionService = _classThis = _classDescriptor.value;
|
|
92
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
93
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
94
|
+
})();
|
|
95
|
+
return LocalConnectionService = _classThis;
|
|
96
|
+
})();
|
|
44
97
|
exports.LocalConnectionService = LocalConnectionService;
|