@tamu-dor/famis-db 2.0.3 → 2.0.4
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/index.js +48 -0
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1165,6 +1165,7 @@ class FAMISDb {
|
|
|
1165
1165
|
'cores.id',
|
|
1166
1166
|
'core_accounts.account',
|
|
1167
1167
|
'core_accounts.effective',
|
|
1168
|
+
'core_accounts.active',
|
|
1168
1169
|
'cores.facility',
|
|
1169
1170
|
'cores.contact',
|
|
1170
1171
|
'cores.contactEmail',
|
|
@@ -1426,6 +1427,53 @@ class FAMISDb {
|
|
|
1426
1427
|
return retVal;
|
|
1427
1428
|
}
|
|
1428
1429
|
|
|
1430
|
+
/**
|
|
1431
|
+
*
|
|
1432
|
+
* Get all active accounts
|
|
1433
|
+
* @returns {Promise<array>} core objects
|
|
1434
|
+
* @memberof FAMISDb
|
|
1435
|
+
*/
|
|
1436
|
+
async getActiveAccounts() {
|
|
1437
|
+
let records;
|
|
1438
|
+
let retVal = [];
|
|
1439
|
+
try {
|
|
1440
|
+
const accounts = this.db('core_accounts')
|
|
1441
|
+
.select(
|
|
1442
|
+
'core_accounts.coreId',
|
|
1443
|
+
'core_accounts.account',
|
|
1444
|
+
'core_accounts.effective',
|
|
1445
|
+
)
|
|
1446
|
+
.where({active: true})
|
|
1447
|
+
.as("core_accounts");
|
|
1448
|
+
records = await this.db('cores')
|
|
1449
|
+
.select(
|
|
1450
|
+
'cores.id',
|
|
1451
|
+
'core_accounts.account',
|
|
1452
|
+
'core_accounts.active',
|
|
1453
|
+
'cores.facility',
|
|
1454
|
+
'cores.contact',
|
|
1455
|
+
'cores.contactEmail',
|
|
1456
|
+
'cores.systemId',
|
|
1457
|
+
'cores.enabled',
|
|
1458
|
+
'cores.deleted',
|
|
1459
|
+
'cores.coreEmail',
|
|
1460
|
+
'cores.corePhone',
|
|
1461
|
+
'cores.coreAddress',
|
|
1462
|
+
'cores.from_email',
|
|
1463
|
+
'cores.invoice_email'
|
|
1464
|
+
)
|
|
1465
|
+
.join(accounts, 'cores.id', '=', 'core_accounts.coreId')
|
|
1466
|
+
.where('enabled', '1')
|
|
1467
|
+
.orderBy('cores.id', 'desc');
|
|
1468
|
+
if (records.length) {
|
|
1469
|
+
retVal = records;
|
|
1470
|
+
}
|
|
1471
|
+
} catch (e) {
|
|
1472
|
+
throw e;
|
|
1473
|
+
}
|
|
1474
|
+
return retVal;
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1429
1477
|
/**
|
|
1430
1478
|
*
|
|
1431
1479
|
* Get a system part's users by system ID
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamu-dor/famis-db",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "DB library for FAMIS database",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@paralleldrive/cuid2": "^2.2.2",
|
|
20
20
|
"awaity": "^1.0.0",
|
|
21
21
|
"knex": "^3.1.0",
|
|
22
|
-
"pg": "^8.
|
|
22
|
+
"pg": "^8.12.0",
|
|
23
23
|
"rev-hash": "^3.0.0"
|
|
24
24
|
}
|
|
25
25
|
}
|