@aneuhold/be-ts-db-lib 1.0.35 → 1.0.37
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/lib/repositories/common/ApiKeyRepository.d.ts.map +1 -1
- package/lib/repositories/common/UserRepository.d.ts.map +1 -1
- package/lib/repositories/dashboard/DashboardNonogramKatanaItemRepository.d.ts +1 -1
- package/lib/repositories/dashboard/DashboardNonogramKatanaItemRepository.d.ts.map +1 -1
- package/lib/repositories/dashboard/DashboardNonogramKatanaUpgradeRepository.d.ts.map +1 -1
- package/lib/repositories/dashboard/DashboardTaskRepository.d.ts +1 -1
- package/lib/repositories/dashboard/DashboardTaskRepository.d.ts.map +1 -1
- package/lib/repositories/dashboard/DashboardUserConfigRepository.d.ts +1 -1
- package/lib/repositories/dashboard/DashboardUserConfigRepository.d.ts.map +1 -1
- package/lib/scripts/migrate.js +1 -1
- package/lib/scripts/migrateDry.js +1 -1
- package/lib/scripts/validateSchema.js +1 -1
- package/lib/scripts/validateSchemaDryRun.js +1 -1
- package/lib/services/MigrationService.js +1 -1
- package/lib/util/DocumentDb.d.ts.map +1 -1
- package/lib/util/DocumentDb.js +1 -1
- package/lib/validators/BaseValidator.d.ts.map +1 -1
- package/lib/validators/BaseValidator.js +1 -1
- package/lib/validators/common/ApiKeyValidator.d.ts.map +1 -1
- package/lib/validators/common/ApiKeyValidator.js +4 -3
- package/lib/validators/common/UserValidator.d.ts.map +1 -1
- package/lib/validators/common/UserValidator.js +2 -2
- package/lib/validators/dashboard/NonogramKatanaItemValidator.d.ts.map +1 -1
- package/lib/validators/dashboard/NonogramKatanaItemValidator.js +4 -3
- package/lib/validators/dashboard/NonogramKatanaUpgradeValidator.d.ts.map +1 -1
- package/lib/validators/dashboard/NonogramKatanaUpgradeValidator.js +4 -3
- package/lib/validators/dashboard/TaskValidator.js +3 -4
- package/lib/validators/dashboard/UserConfigValidator.js +4 -5
- package/package.json +8 -11
- package/lib/repositories/dashboard/UserConfigRepository.d.ts +0 -18
- package/lib/repositories/dashboard/UserConfigRepository.d.ts.map +0 -1
- package/lib/repositories/dashboard/UserConfigRepository.js +0 -37
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiKeyRepository.d.ts","sourceRoot":"","sources":["../../../src/repositories/common/ApiKeyRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAEvE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,cAAc,CAAC,MAAM,CAAC;IAClE,OAAO,CAAC,MAAM,CAAC,eAAe,CAAa;IAE3C,OAAO,CAAC,MAAM,CAAC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"ApiKeyRepository.d.ts","sourceRoot":"","sources":["../../../src/repositories/common/ApiKeyRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAEvE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,cAAc,CAAC,MAAM,CAAC;IAClE,OAAO,CAAC,MAAM,CAAC,eAAe,CAAa;IAE3C,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAA+B;IAE/D,MAAM,CAAC,uBAAuB,IAAI,aAAa,CAAC,IAAI,CAAC;IA0BrD,OAAO;IAIP,SAAS,CAAC,gBAAgB,IAAI,IAAI;IAElC;;OAEG;WACW,OAAO;CAMtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserRepository.d.ts","sourceRoot":"","sources":["../../../src/repositories/common/UserRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAQ/C;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,cAAc,CAAC,IAAI,CAAC;IAC9D,OAAO,CAAC,MAAM,CAAC,eAAe,CAAW;IAEzC,OAAO,CAAC,MAAM,CAAC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"UserRepository.d.ts","sourceRoot":"","sources":["../../../src/repositories/common/UserRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAQ/C;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,cAAc,CAAC,IAAI,CAAC;IAC9D,OAAO,CAAC,MAAM,CAAC,eAAe,CAAW;IAEzC,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAA6B;IAE7D,OAAO;IAIP,SAAS,CAAC,gBAAgB,IAAI,IAAI;IAclC;;OAEG;IACH,MAAM,CAAC,OAAO;IAOR,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAW/D,gBAAgB,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAOhE"}
|
|
@@ -6,7 +6,7 @@ import { RepoListeners } from '../../services/RepoSubscriptionService';
|
|
|
6
6
|
* The repository that contains {@link NonogramKatanaItem} documents.
|
|
7
7
|
*/
|
|
8
8
|
export default class DashboardNonogramKatanaItemRepository extends DashboardBaseRepository<NonogramKatanaItem> {
|
|
9
|
-
private static singletonInstance
|
|
9
|
+
private static singletonInstance?;
|
|
10
10
|
private constructor();
|
|
11
11
|
static getListenersForUserRepo(): RepoListeners<User>;
|
|
12
12
|
protected setupSubscribers(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardNonogramKatanaItemRepository.d.ts","sourceRoot":"","sources":["../../../src/repositories/dashboard/DashboardNonogramKatanaItemRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAGvE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,qCAAsC,SAAQ,uBAAuB,CAAC,kBAAkB,CAAC;IAC5G,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAwC;
|
|
1
|
+
{"version":3,"file":"DashboardNonogramKatanaItemRepository.d.ts","sourceRoot":"","sources":["../../../src/repositories/dashboard/DashboardNonogramKatanaItemRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAGvE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,qCAAsC,SAAQ,uBAAuB,CAAC,kBAAkB,CAAC;IAC5G,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAwC;IAEzE,OAAO;IAQP,MAAM,CAAC,uBAAuB,IAAI,aAAa,CAAC,IAAI,CAAC;IAgBrD,SAAS,CAAC,gBAAgB,IAAI,IAAI;IAElC;;OAEG;WACW,OAAO;IAQrB;;;;OAIG;IACG,aAAa,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;CAQrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardNonogramKatanaUpgradeRepository.d.ts","sourceRoot":"","sources":["../../../src/repositories/dashboard/DashboardNonogramKatanaUpgradeRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAGvE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,wCAAyC,SAAQ,uBAAuB,CAAC,qBAAqB,CAAC;IAClH,OAAO,CAAC,MAAM,CAAC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"DashboardNonogramKatanaUpgradeRepository.d.ts","sourceRoot":"","sources":["../../../src/repositories/dashboard/DashboardNonogramKatanaUpgradeRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAGvE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,wCAAyC,SAAQ,uBAAuB,CAAC,qBAAqB,CAAC;IAClH,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAElB;IAEd,OAAO;IAQP,MAAM,CAAC,uBAAuB,IAAI,aAAa,CAAC,IAAI,CAAC;IAgBrD,SAAS,CAAC,gBAAgB,IAAI,IAAI;IAElC;;OAEG;WACW,OAAO;IAQrB;;;;OAIG;IACG,aAAa,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;CAQxE"}
|
|
@@ -7,7 +7,7 @@ import { RepoListeners } from '../../services/RepoSubscriptionService';
|
|
|
7
7
|
* The repository that contains {@link DashboardTask} documents.
|
|
8
8
|
*/
|
|
9
9
|
export default class DashboardTaskRepository extends DashboardBaseRepository<DashboardTask> {
|
|
10
|
-
private static singletonInstance
|
|
10
|
+
private static singletonInstance?;
|
|
11
11
|
private constructor();
|
|
12
12
|
/**
|
|
13
13
|
* Doesn't handle removing sharedWith references, as that should be handled
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardTaskRepository.d.ts","sourceRoot":"","sources":["../../../src/repositories/dashboard/DashboardTaskRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAEb,IAAI,EACL,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAIvE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,uBAAuB,CAAC,aAAa,CAAC;IACzF,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAA0B;
|
|
1
|
+
{"version":3,"file":"DashboardTaskRepository.d.ts","sourceRoot":"","sources":["../../../src/repositories/dashboard/DashboardTaskRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAEb,IAAI,EACL,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAIvE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,uBAAuB,CAAC,aAAa,CAAC;IACzF,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAA0B;IAE3D,OAAO;IAaP;;;OAGG;IACH,MAAM,CAAC,uBAAuB,IAAI,aAAa,CAAC,IAAI,CAAC;IAgBrD,SAAS,CAAC,gBAAgB,IAAI,IAAI;IAElC;;OAEG;WACW,OAAO;IAOrB;;;;;OAKG;IACG,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;IAMpD;;;;OAIG;IACG,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC;IAM3D;;;;;;OAMG;IACG,aAAa,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAyB/D;;;OAGG;YACW,qBAAqB;CAepC"}
|
|
@@ -7,7 +7,7 @@ import { RepoListeners } from '../../services/RepoSubscriptionService';
|
|
|
7
7
|
* The repository that contains {@link DashboardUserConfig} documents.
|
|
8
8
|
*/
|
|
9
9
|
export default class DashboardUserConfigRepository extends DashboardBaseRepository<DashboardUserConfig> {
|
|
10
|
-
private static singletonInstance
|
|
10
|
+
private static singletonInstance?;
|
|
11
11
|
private constructor();
|
|
12
12
|
static getListenersForUserRepo(): RepoListeners<User>;
|
|
13
13
|
protected setupSubscribers(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardUserConfigRepository.d.ts","sourceRoot":"","sources":["../../../src/repositories/dashboard/DashboardUserConfigRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAEL,eAAe,EAEf,YAAY,EACb,MAAM,SAAS,CAAC;AACjB,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAGhE,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAEvE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,6BAA8B,SAAQ,uBAAuB,CAAC,mBAAmB,CAAC;IACrG,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAgC;
|
|
1
|
+
{"version":3,"file":"DashboardUserConfigRepository.d.ts","sourceRoot":"","sources":["../../../src/repositories/dashboard/DashboardUserConfigRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAEL,eAAe,EAEf,YAAY,EACb,MAAM,SAAS,CAAC;AACjB,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAGhE,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAEvE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,6BAA8B,SAAQ,uBAAuB,CAAC,mBAAmB,CAAC;IACrG,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAgC;IAEjE,OAAO;IAQP,MAAM,CAAC,uBAAuB,IAAI,aAAa,CAAC,IAAI,CAAC;IAoCrD,SAAS,CAAC,gBAAgB,IAAI,IAAI;IAElC;;OAEG;WACW,OAAO;IAQrB;;;;;OAKG;IACG,SAAS,CACb,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAatC;;;;;;OAMG;IACG,UAAU,CACd,OAAO,EAAE,mBAAmB,EAAE,GAC7B,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAYjC;;;;;OAKG;IACG,MAAM,CACV,UAAU,EAAE,OAAO,CAAC,mBAAmB,CAAC,GACvC,OAAO,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;IAYvC,UAAU,CACd,WAAW,EAAE,OAAO,CAAC,mBAAmB,CAAC,EAAE,GAC1C,OAAO,CAAC,eAAe,CAAC;IAkB3B;;;OAGG;IACG,UAAU,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAMvE;;;;;;;;;OASG;YACW,2BAA2B;CAmD1C"}
|
package/lib/scripts/migrate.js
CHANGED
|
@@ -4,4 +4,4 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const MigrationService_1 = __importDefault(require("../services/MigrationService"));
|
|
7
|
-
MigrationService_1.default.migrateDb().then(() => process.exit(0));
|
|
7
|
+
void MigrationService_1.default.migrateDb().then(() => process.exit(0));
|
|
@@ -4,4 +4,4 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const MigrationService_1 = __importDefault(require("../services/MigrationService"));
|
|
7
|
-
MigrationService_1.default.migrateDb(true).then(() => process.exit(0));
|
|
7
|
+
void MigrationService_1.default.migrateDb(true).then(() => process.exit(0));
|
|
@@ -4,6 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const DbSchemaUpdater_1 = __importDefault(require("../util/DbSchemaUpdater"));
|
|
7
|
-
DbSchemaUpdater_1.default.updateSchemaForAllRepos().then(() => {
|
|
7
|
+
void DbSchemaUpdater_1.default.updateSchemaForAllRepos().then(() => {
|
|
8
8
|
process.exit(0);
|
|
9
9
|
});
|
|
@@ -4,6 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const DbSchemaUpdater_1 = __importDefault(require("../util/DbSchemaUpdater"));
|
|
7
|
-
DbSchemaUpdater_1.default.updateSchemaForAllRepos(true).then(() => {
|
|
7
|
+
void DbSchemaUpdater_1.default.updateSchemaForAllRepos(true).then(() => {
|
|
8
8
|
process.exit(0);
|
|
9
9
|
});
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
6
|
+
/* eslint-disable */
|
|
7
7
|
// @ts-nocheck
|
|
8
8
|
const core_ts_lib_1 = require("@aneuhold/core-ts-lib");
|
|
9
9
|
const UserRepository_1 = __importDefault(require("../repositories/common/UserRepository"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentDb.d.ts","sourceRoot":"","sources":["../../src/util/DocumentDb.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAmB,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAEhC,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B,OAAO,CAAC,MAAM,CAAC,OAAO,CAAa;IAEnC,OAAO,CAAC,MAAM,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"DocumentDb.d.ts","sourceRoot":"","sources":["../../src/util/DocumentDb.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAmB,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAEhC,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B,OAAO,CAAC,MAAM,CAAC,OAAO,CAAa;IAEnC,OAAO,CAAC,MAAM,CAAC,WAAW,CAA0B;IAEpD,OAAO,CAAC,MAAM,CAAC,EAAE,CAAiB;mBAEb,SAAS;WAiBjB,aAAa,CAAC,QAAQ,SAAS,QAAQ,EAClD,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;WAQnB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;CAKhD"}
|
package/lib/util/DocumentDb.js
CHANGED
|
@@ -24,7 +24,7 @@ class DocumentDb {
|
|
|
24
24
|
}
|
|
25
25
|
static async getCollection(collectionName) {
|
|
26
26
|
const client = await this.getClient();
|
|
27
|
-
if (!
|
|
27
|
+
if (!DocumentDb.db) {
|
|
28
28
|
DocumentDb.db = client.db(DocumentDb.DB_NAME);
|
|
29
29
|
}
|
|
30
30
|
return DocumentDb.db.collection(collectionName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseValidator.d.ts","sourceRoot":"","sources":["../../src/validators/BaseValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE3E,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAEhC,oBAAY,iBAAiB;IAC3B,KAAK,IAAA;IACL,qBAAqB,IAAA;IACrB,uBAAuB,IAAA;CACxB;AAED,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,UAAU,CAAC,SAAS,SAAS,YAAY;IACrE;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAE5D;;;;OAIG;IACH,QAAQ,CAAC,oBAAoB,CAC3B,aAAa,EAAE,OAAO,CAAC,SAAS,CAAC,GAChC,OAAO,CAAC,IAAI,CAAC;IAEhB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,sBAAsB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAE/D;;;;;;OAMG;cACa,kCAAkC,CAAC,KAAK,EAAE;QACxD,MAAM,EAAE,OAAO,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QAC1B,YAAY,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,CAAC;QAC1C,iBAAiB,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAChD,gBAAgB,EAAE,CAAC,cAAc,EAAE,QAAQ,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QAChE,cAAc,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KAC9D;
|
|
1
|
+
{"version":3,"file":"BaseValidator.d.ts","sourceRoot":"","sources":["../../src/validators/BaseValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE3E,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAEhC,oBAAY,iBAAiB;IAC3B,KAAK,IAAA;IACL,qBAAqB,IAAA;IACrB,uBAAuB,IAAA;CACxB;AAED,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,UAAU,CAAC,SAAS,SAAS,YAAY;IACrE;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAE5D;;;;OAIG;IACH,QAAQ,CAAC,oBAAoB,CAC3B,aAAa,EAAE,OAAO,CAAC,SAAS,CAAC,GAChC,OAAO,CAAC,IAAI,CAAC;IAEhB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,sBAAsB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAE/D;;;;;;OAMG;cACa,kCAAkC,CAAC,KAAK,EAAE;QACxD,MAAM,EAAE,OAAO,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QAC1B,YAAY,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,CAAC;QAC1C,iBAAiB,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAChD,gBAAgB,EAAE,CAAC,cAAc,EAAE,QAAQ,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QAChE,cAAc,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KAC9D;IA0ED;;OAEG;IACH,SAAS,CAAC,0BAA0B,CAClC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,EACtB,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC;CAIzB"}
|
|
@@ -35,7 +35,7 @@ class IValidator {
|
|
|
35
35
|
docsToValidate.forEach((doc) => {
|
|
36
36
|
const { updatedDoc, errors } = documentValidator(doc);
|
|
37
37
|
if (errors.length !== 0) {
|
|
38
|
-
core_ts_lib_1.Logger.error(`${docName} with ID: ${doc._id} is invalid. Errors:`);
|
|
38
|
+
core_ts_lib_1.Logger.error(`${docName} with ID: ${doc._id.toString()} is invalid. Errors:`);
|
|
39
39
|
numInvalidDocs += 1;
|
|
40
40
|
errors.forEach((error) => {
|
|
41
41
|
core_ts_lib_1.Logger.error(error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiKeyValidator.d.ts","sourceRoot":"","sources":["../../../src/validators/common/ApiKeyValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAKlD,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAG1C,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,UAAU,CAAC,MAAM,CAAC;IACvD,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"ApiKeyValidator.d.ts","sourceRoot":"","sources":["../../../src/validators/common/ApiKeyValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAKlD,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAG1C,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,UAAU,CAAC,MAAM,CAAC;IACvD,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBnD,oBAAoB,CAAC,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAQnE,sBAAsB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CA2B7D"}
|
|
@@ -14,16 +14,17 @@ class ApiKeyValidator extends BaseValidator_1.default {
|
|
|
14
14
|
const userRepo = UserRepository_1.default.getRepo();
|
|
15
15
|
const userInDb = await userRepo.get({ _id: newApiKey.userId });
|
|
16
16
|
if (!userInDb) {
|
|
17
|
-
core_ts_lib_1.ErrorUtils.throwError(`User with ID: ${newApiKey.userId} does not exist in the database.`, newApiKey);
|
|
17
|
+
core_ts_lib_1.ErrorUtils.throwError(`User with ID: ${newApiKey.userId.toString()} does not exist in the database.`, newApiKey);
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
// Check if the user already has an API key
|
|
21
21
|
const apiKeyRepo = ApiKeyRepository_1.default.getRepo();
|
|
22
22
|
const apiKeyInDb = await apiKeyRepo.get({ userId: newApiKey.userId });
|
|
23
23
|
if (apiKeyInDb) {
|
|
24
|
-
core_ts_lib_1.ErrorUtils.throwError(`User with ID: ${newApiKey.userId} already has an API key.`, newApiKey);
|
|
24
|
+
core_ts_lib_1.ErrorUtils.throwError(`User with ID: ${newApiKey.userId.toString()} already has an API key.`, newApiKey);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
27
28
|
async validateUpdateObject(updatedApiKey) {
|
|
28
29
|
// Throw, because API keys should not be updated. Only created and deleted.
|
|
29
30
|
core_ts_lib_1.ErrorUtils.throwError(`API keys should not be updated at this time. Only created and deleted.`, updatedApiKey);
|
|
@@ -38,7 +39,7 @@ class ApiKeyValidator extends BaseValidator_1.default {
|
|
|
38
39
|
allDocs: allApiKeys,
|
|
39
40
|
shouldDelete: (apiKey) => {
|
|
40
41
|
if (!allUserIds[apiKey.userId.toString()]) {
|
|
41
|
-
core_ts_lib_1.Logger.error(`API Key with ID: ${apiKey._id} has no valid associated user.`);
|
|
42
|
+
core_ts_lib_1.Logger.error(`API Key with ID: ${apiKey._id.toString()} has no valid associated user.`);
|
|
42
43
|
return true;
|
|
43
44
|
}
|
|
44
45
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserValidator.d.ts","sourceRoot":"","sources":["../../../src/validators/common/UserValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAgB,MAAM,0BAA0B,CAAC;AAG9D,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAI1C,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU,CAAC,IAAI,CAAC;IACnD,iBAAiB,CAAC,OAAO,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAM/C,oBAAoB,CAAC,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"UserValidator.d.ts","sourceRoot":"","sources":["../../../src/validators/common/UserValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAgB,MAAM,0BAA0B,CAAC;AAG9D,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAI1C,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU,CAAC,IAAI,CAAC;IACnD,iBAAiB,CAAC,OAAO,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAM/C,oBAAoB,CAAC,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IA6BhE,sBAAsB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IA2B5D;;OAEG;YACW,qBAAqB;CAWpC"}
|
|
@@ -23,7 +23,7 @@ class UserValidator extends BaseValidator_1.default {
|
|
|
23
23
|
const userRepo = UserRepository_1.default.getRepo();
|
|
24
24
|
const userInDb = await userRepo.get({ _id: userToUpdate._id });
|
|
25
25
|
if (!userInDb) {
|
|
26
|
-
core_ts_lib_1.ErrorUtils.throwError(`${core_ts_db_lib_1.User.name} with ID: ${userToUpdate._id} does not exist in the database.`, userToUpdate);
|
|
26
|
+
core_ts_lib_1.ErrorUtils.throwError(`${core_ts_db_lib_1.User.name} with ID: ${userToUpdate._id?.toString()} does not exist in the database.`, userToUpdate);
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
// Check if the username is being updated and, if it is, if it already
|
|
@@ -41,7 +41,7 @@ class UserValidator extends BaseValidator_1.default {
|
|
|
41
41
|
allDocs: allUsers,
|
|
42
42
|
shouldDelete: (user) => {
|
|
43
43
|
if (user.userName.startsWith(testsUtil_1.TEST_USER_NAME_PREFIX)) {
|
|
44
|
-
core_ts_lib_1.Logger.error(`User with ID: ${user._id} is a test user and should be deleted`);
|
|
44
|
+
core_ts_lib_1.Logger.error(`User with ID: ${user._id.toString()} is a test user and should be deleted`);
|
|
45
45
|
return true;
|
|
46
46
|
}
|
|
47
47
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NonogramKatanaItemValidator.d.ts","sourceRoot":"","sources":["../../../src/validators/dashboard/NonogramKatanaItemValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAI1C,MAAM,CAAC,OAAO,OAAO,oCAAqC,SAAQ,UAAU,CAAC,kBAAkB,CAAC;IACxF,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"NonogramKatanaItemValidator.d.ts","sourceRoot":"","sources":["../../../src/validators/dashboard/NonogramKatanaItemValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAI1C,MAAM,CAAC,OAAO,OAAO,oCAAqC,SAAQ,UAAU,CAAC,kBAAkB,CAAC;IACxF,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB7D,oBAAoB,CACxB,WAAW,EAAE,OAAO,CAAC,kBAAkB,CAAC,GACvC,OAAO,CAAC,IAAI,CAAC;IAUV,sBAAsB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CA8B7D"}
|
|
@@ -17,14 +17,15 @@ class DashboardNonogramKatanaItemValidator extends BaseValidator_1.default {
|
|
|
17
17
|
itemName: newItem.itemName
|
|
18
18
|
});
|
|
19
19
|
if (existingItem) {
|
|
20
|
-
core_ts_lib_1.ErrorUtils.throwError(`Nonogram Katana item already exists for user: ${newItem.userId}`, newItem);
|
|
20
|
+
core_ts_lib_1.ErrorUtils.throwError(`Nonogram Katana item already exists for user: ${newItem.userId.toString()}`, newItem);
|
|
21
21
|
}
|
|
22
22
|
const userRepo = UserRepository_1.default.getRepo();
|
|
23
23
|
const user = await userRepo.get({ _id: newItem.userId });
|
|
24
24
|
if (!user) {
|
|
25
|
-
core_ts_lib_1.ErrorUtils.throwError(`User does not exist: ${newItem.userId}`, newItem);
|
|
25
|
+
core_ts_lib_1.ErrorUtils.throwError(`User does not exist: ${newItem.userId.toString()}`, newItem);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
28
29
|
async validateUpdateObject(updatedItem) {
|
|
29
30
|
// Check if an id is defined
|
|
30
31
|
if (!updatedItem._id) {
|
|
@@ -41,7 +42,7 @@ class DashboardNonogramKatanaItemValidator extends BaseValidator_1.default {
|
|
|
41
42
|
allDocs: allItems,
|
|
42
43
|
shouldDelete: (item) => {
|
|
43
44
|
if (!allUserIds[item.userId.toString()]) {
|
|
44
|
-
core_ts_lib_1.Logger.error(`Nonogram Katana Item with ID: ${item._id} has no valid associated user.`);
|
|
45
|
+
core_ts_lib_1.Logger.error(`Nonogram Katana Item with ID: ${item._id.toString()} has no valid associated user.`);
|
|
45
46
|
return true;
|
|
46
47
|
}
|
|
47
48
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NonogramKatanaUpgradeValidator.d.ts","sourceRoot":"","sources":["../../../src/validators/dashboard/NonogramKatanaUpgradeValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAEtB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAI1C,MAAM,CAAC,OAAO,OAAO,uCAAwC,SAAQ,UAAU,CAAC,qBAAqB,CAAC;IAC9F,iBAAiB,CAAC,UAAU,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"NonogramKatanaUpgradeValidator.d.ts","sourceRoot":"","sources":["../../../src/validators/dashboard/NonogramKatanaUpgradeValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAEtB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAI1C,MAAM,CAAC,OAAO,OAAO,uCAAwC,SAAQ,UAAU,CAAC,qBAAqB,CAAC;IAC9F,iBAAiB,CAAC,UAAU,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBnE,oBAAoB,CACxB,cAAc,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAC7C,OAAO,CAAC,IAAI,CAAC;IAUV,sBAAsB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CA8B7D"}
|
|
@@ -17,14 +17,15 @@ class DashboardNonogramKatanaUpgradeValidator extends BaseValidator_1.default {
|
|
|
17
17
|
upgradeName: newUpgrade.upgradeName
|
|
18
18
|
});
|
|
19
19
|
if (existingItem) {
|
|
20
|
-
core_ts_lib_1.ErrorUtils.throwError(`Nonogram Katana upgrade already exists for user: ${newUpgrade.userId}`, newUpgrade);
|
|
20
|
+
core_ts_lib_1.ErrorUtils.throwError(`Nonogram Katana upgrade already exists for user: ${newUpgrade.userId.toString()}`, newUpgrade);
|
|
21
21
|
}
|
|
22
22
|
const userRepo = UserRepository_1.default.getRepo();
|
|
23
23
|
const user = await userRepo.get({ _id: newUpgrade.userId });
|
|
24
24
|
if (!user) {
|
|
25
|
-
core_ts_lib_1.ErrorUtils.throwError(`User does not exist: ${newUpgrade.userId}`, newUpgrade);
|
|
25
|
+
core_ts_lib_1.ErrorUtils.throwError(`User does not exist: ${newUpgrade.userId.toString()}`, newUpgrade);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
28
29
|
async validateUpdateObject(updatedUpgrade) {
|
|
29
30
|
// Check if an id is defined
|
|
30
31
|
if (!updatedUpgrade._id) {
|
|
@@ -41,7 +42,7 @@ class DashboardNonogramKatanaUpgradeValidator extends BaseValidator_1.default {
|
|
|
41
42
|
allDocs: allUpgrades,
|
|
42
43
|
shouldDelete: (upgrade) => {
|
|
43
44
|
if (!allUserIds[upgrade.userId.toString()]) {
|
|
44
|
-
core_ts_lib_1.Logger.error(`Nonogram Katana Upgrade with ID: ${upgrade._id} has no valid associated user.`);
|
|
45
|
+
core_ts_lib_1.Logger.error(`Nonogram Katana Upgrade with ID: ${upgrade._id.toString()} has no valid associated user.`);
|
|
45
46
|
return true;
|
|
46
47
|
}
|
|
47
48
|
return false;
|
|
@@ -35,7 +35,7 @@ class DashboardTaskValidator extends BaseValidator_1.default {
|
|
|
35
35
|
_id: updatedTask.parentTaskId
|
|
36
36
|
});
|
|
37
37
|
if (!parentTask) {
|
|
38
|
-
errors.push(`Parent task with ID: ${updatedTask.parentTaskId} does not exist.`);
|
|
38
|
+
errors.push(`Parent task with ID: ${updatedTask.parentTaskId.toString()} does not exist.`);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
if (errors.length > 0) {
|
|
@@ -52,7 +52,7 @@ class DashboardTaskValidator extends BaseValidator_1.default {
|
|
|
52
52
|
allDocs: allTasks,
|
|
53
53
|
shouldDelete: (task) => {
|
|
54
54
|
if (!allUserIds[task.userId.toString()]) {
|
|
55
|
-
core_ts_lib_1.Logger.error(`Dashboard Task with ID: ${task._id} has no valid associated owner (user).`);
|
|
55
|
+
core_ts_lib_1.Logger.error(`Dashboard Task with ID: ${task._id.toString()} has no valid associated owner (user).`);
|
|
56
56
|
return true;
|
|
57
57
|
}
|
|
58
58
|
return false;
|
|
@@ -62,8 +62,7 @@ class DashboardTaskValidator extends BaseValidator_1.default {
|
|
|
62
62
|
const sharedWithUserIds = [...task.sharedWith];
|
|
63
63
|
sharedWithUserIds.forEach((userId) => {
|
|
64
64
|
if (!allUserIds[userId.toString()]) {
|
|
65
|
-
errors.push(`User with ID: ${userId} does not exist in sharedWith property of task with ID: ${task._id}.`);
|
|
66
|
-
// eslint-disable-next-line no-param-reassign
|
|
65
|
+
errors.push(`User with ID: ${userId.toString()} does not exist in sharedWith property of task with ID: ${task._id.toString()}.`);
|
|
67
66
|
task.sharedWith = task.sharedWith.filter((id) => id.toString() !== userId.toString());
|
|
68
67
|
}
|
|
69
68
|
});
|
|
@@ -16,12 +16,12 @@ class DashboardUserConfigValidator extends BaseValidator_1.default {
|
|
|
16
16
|
userId: newUserConfig.userId
|
|
17
17
|
});
|
|
18
18
|
if (existingConfig) {
|
|
19
|
-
core_ts_lib_1.ErrorUtils.throwError(`Config already exists for user: ${newUserConfig.userId}`, newUserConfig);
|
|
19
|
+
core_ts_lib_1.ErrorUtils.throwError(`Config already exists for user: ${newUserConfig.userId.toString()}`, newUserConfig);
|
|
20
20
|
}
|
|
21
21
|
const userRepo = UserRepository_1.default.getRepo();
|
|
22
22
|
const user = await userRepo.get({ _id: newUserConfig.userId });
|
|
23
23
|
if (!user) {
|
|
24
|
-
core_ts_lib_1.ErrorUtils.throwError(`User does not exist: ${newUserConfig.userId}`, newUserConfig);
|
|
24
|
+
core_ts_lib_1.ErrorUtils.throwError(`User does not exist: ${newUserConfig.userId.toString()}`, newUserConfig);
|
|
25
25
|
}
|
|
26
26
|
if (newUserConfig.collaborators.length > 0) {
|
|
27
27
|
const collaborators = await userRepo.getList(newUserConfig.collaborators);
|
|
@@ -54,7 +54,7 @@ class DashboardUserConfigValidator extends BaseValidator_1.default {
|
|
|
54
54
|
allDocs: allUserConfigs,
|
|
55
55
|
shouldDelete: (userConfig) => {
|
|
56
56
|
if (!allUserIds[userConfig.userId.toString()]) {
|
|
57
|
-
core_ts_lib_1.Logger.error(`Dashboard User Config with ID: ${userConfig._id} has no valid associated user.`);
|
|
57
|
+
core_ts_lib_1.Logger.error(`Dashboard User Config with ID: ${userConfig._id.toString()} has no valid associated user.`);
|
|
58
58
|
return true;
|
|
59
59
|
}
|
|
60
60
|
return false;
|
|
@@ -64,8 +64,7 @@ class DashboardUserConfigValidator extends BaseValidator_1.default {
|
|
|
64
64
|
const collaboratorIds = [...userConfig.collaborators];
|
|
65
65
|
collaboratorIds.forEach((userId) => {
|
|
66
66
|
if (!allUserIds[userId.toString()]) {
|
|
67
|
-
errors.push(`User with ID: ${userId} does not exist in collaborators property of Dashboard User Config with ID: ${userConfig._id}.`);
|
|
68
|
-
// eslint-disable-next-line no-param-reassign
|
|
67
|
+
errors.push(`User with ID: ${userId.toString()} does not exist in collaborators property of Dashboard User Config with ID: ${userConfig._id.toString()}.`);
|
|
69
68
|
updatedDoc.collaborators = updatedDoc.collaborators.filter((id) => id.toString() !== userId.toString());
|
|
70
69
|
}
|
|
71
70
|
});
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aneuhold/be-ts-db-lib",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.37",
|
|
4
4
|
"description": "A backend database library meant to actually interact with various databases in personal projects",
|
|
5
5
|
"author": "Anton G Neuhold Jr <agneuhold@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "lib/index.js",
|
|
8
8
|
"types": "lib/index.d.ts",
|
|
9
|
+
"packageManager": "yarn@4.2.2",
|
|
9
10
|
"repository": {
|
|
10
11
|
"type": "git",
|
|
11
12
|
"url": "git+https://github.com/aneuhold/be-ts-db-lib.git"
|
|
@@ -22,7 +23,7 @@
|
|
|
22
23
|
"Node.js"
|
|
23
24
|
],
|
|
24
25
|
"scripts": {
|
|
25
|
-
"pushpub": "
|
|
26
|
+
"pushpub": "yarn build && npm version patch && git push",
|
|
26
27
|
"build": "tsc",
|
|
27
28
|
"watch": "tsc -w",
|
|
28
29
|
"link:local": "cd lib && yarn link",
|
|
@@ -37,26 +38,22 @@
|
|
|
37
38
|
"validate": "ts-node ./src/scripts/validateSchema.ts",
|
|
38
39
|
"validate:dry": "ts-node ./src/scripts/validateSchemaDryRun.ts",
|
|
39
40
|
"migrate": "ts-node ./src/scripts/migrate.ts",
|
|
40
|
-
"migrate:dry": "ts-node ./src/scripts/migrateDry.ts"
|
|
41
|
+
"migrate:dry": "ts-node ./src/scripts/migrateDry.ts",
|
|
42
|
+
"lint": "eslint"
|
|
41
43
|
},
|
|
42
44
|
"dependencies": {
|
|
43
45
|
"@aneuhold/be-ts-lib": "^1.0.6",
|
|
44
|
-
"@aneuhold/core-ts-db-lib": "^1.0.
|
|
46
|
+
"@aneuhold/core-ts-db-lib": "^1.0.58",
|
|
45
47
|
"@aneuhold/core-ts-lib": "^1.1.11",
|
|
46
48
|
"bson": "^6.2.0",
|
|
47
49
|
"mongodb": "^6.3.0"
|
|
48
50
|
},
|
|
49
51
|
"devDependencies": {
|
|
52
|
+
"@aneuhold/eslint-config": "^1.0.6",
|
|
50
53
|
"@types/jest": "^29.5.8",
|
|
51
54
|
"@types/node": "^20.10.4",
|
|
52
55
|
"@types/node-fetch": "^2.6.9",
|
|
53
|
-
"
|
|
54
|
-
"@typescript-eslint/parser": "^6.14.0",
|
|
55
|
-
"eslint": "^8.35.0",
|
|
56
|
-
"eslint-config-airbnb-base": "^15.0.0",
|
|
57
|
-
"eslint-config-prettier": "^9.1.0",
|
|
58
|
-
"eslint-plugin-import": "^2.22.1",
|
|
59
|
-
"eslint-plugin-prettier": "^5.0.1",
|
|
56
|
+
"eslint": "^9",
|
|
60
57
|
"jest": "^29.7.0",
|
|
61
58
|
"prettier": "^3.1.1",
|
|
62
59
|
"ts-jest": "^29.1.1",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { DashboardUserConfig } from '@aneuhold/core-ts-db-lib';
|
|
2
|
-
import { ObjectId } from 'bson';
|
|
3
|
-
import { DeleteResult } from 'mongodb';
|
|
4
|
-
import DashboardBaseRepository from './DashboardBaseRepository';
|
|
5
|
-
/**
|
|
6
|
-
* The repository that contains {@link DashboardUserConfig} documents.
|
|
7
|
-
*/
|
|
8
|
-
export default class DashboardUserConfigRepository extends DashboardBaseRepository<DashboardUserConfig> {
|
|
9
|
-
private static singletonInstance;
|
|
10
|
-
private constructor();
|
|
11
|
-
/**
|
|
12
|
-
* Gets the singleton instance of the {@link DashboardUserConfigRepository}.
|
|
13
|
-
*/
|
|
14
|
-
static getRepo(): DashboardUserConfigRepository;
|
|
15
|
-
deleteByUserId(userId: ObjectId): Promise<DeleteResult>;
|
|
16
|
-
deleteByUserIds(userIds: ObjectId[]): Promise<DeleteResult>;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=UserConfigRepository.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UserConfigRepository.d.ts","sourceRoot":"","sources":["../../../src/repositories/dashboard/UserConfigRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAIhE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,6BAA8B,SAAQ,uBAAuB,CAAC,mBAAmB,CAAC;IACrG,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAgC;IAEhE,OAAO;IAQP;;OAEG;WACW,OAAO;IAQf,cAAc,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;IAKvD,eAAe,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC;CAIlE"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const core_ts_db_lib_1 = require("@aneuhold/core-ts-db-lib");
|
|
7
|
-
const DashboardBaseRepository_1 = __importDefault(require("./DashboardBaseRepository"));
|
|
8
|
-
const UserConfigValidator_1 = __importDefault(require("../../validators/dashboard/UserConfigValidator"));
|
|
9
|
-
const DocumentCleaner_1 = __importDefault(require("../../util/DocumentCleaner"));
|
|
10
|
-
/**
|
|
11
|
-
* The repository that contains {@link DashboardUserConfig} documents.
|
|
12
|
-
*/
|
|
13
|
-
class DashboardUserConfigRepository extends DashboardBaseRepository_1.default {
|
|
14
|
-
static singletonInstance;
|
|
15
|
-
constructor() {
|
|
16
|
-
super(core_ts_db_lib_1.DashboardUserConfig.docType, new UserConfigValidator_1.default(), DocumentCleaner_1.default.userId);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Gets the singleton instance of the {@link DashboardUserConfigRepository}.
|
|
20
|
-
*/
|
|
21
|
-
static getRepo() {
|
|
22
|
-
if (!DashboardUserConfigRepository.singletonInstance) {
|
|
23
|
-
DashboardUserConfigRepository.singletonInstance =
|
|
24
|
-
new DashboardUserConfigRepository();
|
|
25
|
-
}
|
|
26
|
-
return DashboardUserConfigRepository.singletonInstance;
|
|
27
|
-
}
|
|
28
|
-
async deleteByUserId(userId) {
|
|
29
|
-
const collection = await this.getCollection();
|
|
30
|
-
return collection.deleteOne({ userId });
|
|
31
|
-
}
|
|
32
|
-
async deleteByUserIds(userIds) {
|
|
33
|
-
const collection = await this.getCollection();
|
|
34
|
-
return collection.deleteMany({ userId: { $in: userIds } });
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
exports.default = DashboardUserConfigRepository;
|