dt-common-device 13.8.8 → 13.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/db/db.js +28 -28
- package/package.json +1 -1
package/dist/db/db.js
CHANGED
|
@@ -11,45 +11,45 @@ exports.getWebhookPostgresClient = getWebhookPostgresClient;
|
|
|
11
11
|
const pg_1 = require("pg");
|
|
12
12
|
const config_1 = require("../config/config");
|
|
13
13
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
14
|
+
let adminPool = null;
|
|
15
|
+
let accessPool = null;
|
|
16
|
+
let pmsPool = null;
|
|
17
|
+
let webhookPool = null;
|
|
14
18
|
function getPostgresClient() {
|
|
15
19
|
const URI = (0, config_1.getAdminPostgresDbUri)();
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return pool;
|
|
20
|
+
adminPool ?? (adminPool = new pg_1.Pool({
|
|
21
|
+
connectionString: URI,
|
|
22
|
+
connectionTimeoutMillis: 5000,
|
|
23
|
+
idleTimeoutMillis: 30000,
|
|
24
|
+
}));
|
|
25
|
+
return adminPool;
|
|
23
26
|
}
|
|
24
27
|
function getAccessPostgresClient() {
|
|
25
28
|
const URI = (0, config_1.getAccessPostgresDbUri)();
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return pool;
|
|
29
|
+
accessPool ?? (accessPool = new pg_1.Pool({
|
|
30
|
+
connectionString: URI,
|
|
31
|
+
connectionTimeoutMillis: 5000,
|
|
32
|
+
idleTimeoutMillis: 30000,
|
|
33
|
+
}));
|
|
34
|
+
return accessPool;
|
|
33
35
|
}
|
|
34
36
|
function getPmsPostgresClient() {
|
|
35
37
|
const URI = (0, config_1.getPmsPostgresDbUri)();
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return pool;
|
|
38
|
+
pmsPool ?? (pmsPool = new pg_1.Pool({
|
|
39
|
+
connectionString: URI,
|
|
40
|
+
connectionTimeoutMillis: 5000,
|
|
41
|
+
idleTimeoutMillis: 30000,
|
|
42
|
+
}));
|
|
43
|
+
return pmsPool;
|
|
43
44
|
}
|
|
44
45
|
function getWebhookPostgresClient() {
|
|
45
46
|
const URI = (0, config_1.getWebhookPostgresDbUri)();
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return pool;
|
|
47
|
+
webhookPool ?? (webhookPool = new pg_1.Pool({
|
|
48
|
+
connectionString: URI,
|
|
49
|
+
connectionTimeoutMillis: 5000,
|
|
50
|
+
idleTimeoutMillis: 30000,
|
|
51
|
+
}));
|
|
52
|
+
return webhookPool;
|
|
53
53
|
}
|
|
54
54
|
const connectDatabase = async () => {
|
|
55
55
|
try {
|