@aneuhold/be-ts-db-lib 2.0.85 → 3.0.1
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/CHANGELOG.md +21 -0
- package/lib/repositories/BaseRepository.d.ts +10 -11
- package/lib/repositories/BaseRepository.d.ts.map +1 -1
- package/lib/repositories/BaseRepository.js +6 -7
- package/lib/repositories/BaseRepository.js.map +1 -1
- package/lib/repositories/BaseRepository.ts +13 -14
- package/lib/repositories/common/UserRepository.d.ts +2 -2
- package/lib/repositories/common/UserRepository.d.ts.map +1 -1
- package/lib/repositories/common/UserRepository.js +0 -1
- package/lib/repositories/common/UserRepository.js.map +1 -1
- package/lib/repositories/common/UserRepository.ts +2 -2
- package/lib/repositories/dashboard/DashboardNonogramKatanaItemRepository.d.ts +2 -2
- package/lib/repositories/dashboard/DashboardNonogramKatanaItemRepository.d.ts.map +1 -1
- package/lib/repositories/dashboard/DashboardNonogramKatanaItemRepository.js +7 -4
- package/lib/repositories/dashboard/DashboardNonogramKatanaItemRepository.js.map +1 -1
- package/lib/repositories/dashboard/DashboardNonogramKatanaItemRepository.ts +11 -5
- package/lib/repositories/dashboard/DashboardNonogramKatanaUpgradeRepository.d.ts +2 -2
- package/lib/repositories/dashboard/DashboardNonogramKatanaUpgradeRepository.d.ts.map +1 -1
- package/lib/repositories/dashboard/DashboardNonogramKatanaUpgradeRepository.js +7 -4
- package/lib/repositories/dashboard/DashboardNonogramKatanaUpgradeRepository.js.map +1 -1
- package/lib/repositories/dashboard/DashboardNonogramKatanaUpgradeRepository.ts +12 -6
- package/lib/repositories/dashboard/DashboardTaskRepository.d.ts +4 -4
- package/lib/repositories/dashboard/DashboardTaskRepository.d.ts.map +1 -1
- package/lib/repositories/dashboard/DashboardTaskRepository.js +6 -6
- package/lib/repositories/dashboard/DashboardTaskRepository.js.map +1 -1
- package/lib/repositories/dashboard/DashboardTaskRepository.ts +12 -11
- package/lib/repositories/dashboard/DashboardUserConfigRepository.d.ts +2 -2
- package/lib/repositories/dashboard/DashboardUserConfigRepository.d.ts.map +1 -1
- package/lib/repositories/dashboard/DashboardUserConfigRepository.js +10 -12
- package/lib/repositories/dashboard/DashboardUserConfigRepository.js.map +1 -1
- package/lib/repositories/dashboard/DashboardUserConfigRepository.ts +20 -18
- package/lib/services/DemoAccountsService/DashboardDemoAccountsService.d.ts +2 -2
- package/lib/services/DemoAccountsService/DashboardDemoAccountsService.d.ts.map +1 -1
- package/lib/services/DemoAccountsService/DashboardDemoAccountsService.js +2 -3
- package/lib/services/DemoAccountsService/DashboardDemoAccountsService.js.map +1 -1
- package/lib/services/DemoAccountsService/DashboardDemoAccountsService.ts +13 -13
- package/lib/services/DemoAccountsService/DemoAccountsService.d.ts +2 -2
- package/lib/services/DemoAccountsService/DemoAccountsService.d.ts.map +1 -1
- package/lib/services/DemoAccountsService/DemoAccountsService.js +0 -1
- package/lib/services/DemoAccountsService/DemoAccountsService.js.map +1 -1
- package/lib/services/DemoAccountsService/DemoAccountsService.ts +2 -5
- package/lib/services/MigrationService.d.ts.map +1 -1
- package/lib/services/MigrationService.js +330 -19
- package/lib/services/MigrationService.js.map +1 -1
- package/lib/services/MigrationService.ts +420 -19
- package/lib/services/RepoSubscriptionService.d.ts +3 -3
- package/lib/services/RepoSubscriptionService.d.ts.map +1 -1
- package/lib/services/RepoSubscriptionService.js +0 -1
- package/lib/services/RepoSubscriptionService.js.map +1 -1
- package/lib/services/RepoSubscriptionService.ts +3 -3
- package/lib/validators/BaseValidator.d.ts +2 -2
- package/lib/validators/BaseValidator.d.ts.map +1 -1
- package/lib/validators/BaseValidator.js +1 -2
- package/lib/validators/BaseValidator.js.map +1 -1
- package/lib/validators/BaseValidator.ts +4 -4
- package/lib/validators/common/ApiKeyValidator.d.ts.map +1 -1
- package/lib/validators/common/ApiKeyValidator.js +6 -7
- package/lib/validators/common/ApiKeyValidator.js.map +1 -1
- package/lib/validators/common/ApiKeyValidator.ts +8 -15
- package/lib/validators/common/UserValidator.d.ts.map +1 -1
- package/lib/validators/common/UserValidator.js +2 -3
- package/lib/validators/common/UserValidator.js.map +1 -1
- package/lib/validators/common/UserValidator.ts +4 -6
- package/lib/validators/dashboard/NonogramKatanaItemValidator.js +4 -5
- package/lib/validators/dashboard/NonogramKatanaItemValidator.js.map +1 -1
- package/lib/validators/dashboard/NonogramKatanaItemValidator.ts +6 -6
- package/lib/validators/dashboard/NonogramKatanaUpgradeValidator.js +4 -5
- package/lib/validators/dashboard/NonogramKatanaUpgradeValidator.js.map +1 -1
- package/lib/validators/dashboard/NonogramKatanaUpgradeValidator.ts +6 -6
- package/lib/validators/dashboard/TaskValidator.js +8 -9
- package/lib/validators/dashboard/TaskValidator.js.map +1 -1
- package/lib/validators/dashboard/TaskValidator.ts +10 -10
- package/lib/validators/dashboard/UserConfigValidator.d.ts.map +1 -1
- package/lib/validators/dashboard/UserConfigValidator.js +9 -10
- package/lib/validators/dashboard/UserConfigValidator.js.map +1 -1
- package/lib/validators/dashboard/UserConfigValidator.ts +11 -16
- package/package.json +12 -8
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## 🔖 [3.0.1] (2025-11-25)
|
|
9
|
+
|
|
10
|
+
### 🏗️ Changed
|
|
11
|
+
|
|
12
|
+
- All dashboard repositories now require `docType` in delete and update queries for stricter document targeting.
|
|
13
|
+
- Improved internal filtering in `getAllForUser` and similar methods to use repository-level collection access and default filters.
|
|
14
|
+
- Refactored `DashboardUserConfigRepository` to ensure collaborator and userId references always include `docType`.
|
|
15
|
+
- Updated migration logic in `MigrationService` for more robust and complete UUID migration, including all dashboard-related document types.
|
|
16
|
+
- Added `uuid` as a dependency in `package.json`.
|
|
17
|
+
|
|
18
|
+
## 🔖 [3.0.0] (2025-11-23)
|
|
19
|
+
|
|
20
|
+
### 🏗️ Changed
|
|
21
|
+
|
|
22
|
+
_Breaking Change:_ Migrated all document, repository, and validator code from using `ObjectId` (from `bson`) to native `UUID` (from `crypto`), including all type signatures, constructors, and internal logic.
|
|
23
|
+
_Breaking Change:_ Updated all references, tests, and utility functions to use `UUID` instead of `ObjectId`.
|
|
24
|
+
Added migration utilities and scripts to support conversion of existing data from `ObjectId` to `UUID v7`.
|
|
25
|
+
Updated dependencies: now requires `@aneuhold/core-ts-db-lib@^3.0.0`, `@aneuhold/core-ts-lib@^2.3.11`, and `@aneuhold/be-ts-lib@^3.0.0`.
|
|
26
|
+
|
|
8
27
|
## 🔖 [2.0.85] (2025-11-09)
|
|
9
28
|
|
|
10
29
|
### 🏗️ Changed
|
|
@@ -85,6 +104,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
85
104
|
|
|
86
105
|
<!-- Link References -->
|
|
87
106
|
|
|
107
|
+
[3.0.1]: https://github.com/aneuhold/ts-libs/compare/be-ts-db-lib-v3.0.0...be-ts-db-lib-v3.0.1
|
|
108
|
+
[3.0.0]: https://github.com/aneuhold/ts-libs/compare/be-ts-db-lib-v2.0.85...be-ts-db-lib-v3.0.0
|
|
88
109
|
[2.0.85]: https://github.com/aneuhold/ts-libs/compare/be-ts-db-lib-v2.0.84...be-ts-db-lib-v2.0.85
|
|
89
110
|
[2.0.84]: https://github.com/aneuhold/ts-libs/compare/be-ts-db-lib-v2.0.83...be-ts-db-lib-v2.0.84
|
|
90
111
|
[2.0.83]: https://github.com/aneuhold/ts-libs/compare/be-ts-db-lib-v2.0.82...be-ts-db-lib-v2.0.83
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { BaseDocument } from '@aneuhold/core-ts-db-lib';
|
|
2
|
-
import type {
|
|
3
|
-
import { ObjectId } from 'bson';
|
|
2
|
+
import type { UUID } from 'crypto';
|
|
4
3
|
import type { BulkWriteResult, Collection, DeleteResult, Filter, UpdateResult } from 'mongodb';
|
|
5
4
|
import type { RepoListeners, RepoSubscribers } from '../services/RepoSubscriptionService.js';
|
|
6
5
|
import IValidator from '../validators/BaseValidator.js';
|
|
7
6
|
/**
|
|
8
7
|
* Base repository class for handling common database operations.
|
|
9
8
|
*
|
|
9
|
+
* Implementation note: I have tried to do the types correctly here, but kept struggling with
|
|
10
|
+
* MongoDB's types around Filter<T> and _id fields.
|
|
11
|
+
*
|
|
10
12
|
* @template TBasetype - The type of the documents in the collection.
|
|
11
13
|
*/
|
|
12
14
|
export default abstract class BaseRepository<TBasetype extends BaseDocument> {
|
|
@@ -80,21 +82,21 @@ export default abstract class BaseRepository<TBasetype extends BaseDocument> {
|
|
|
80
82
|
* @param docIds - The IDs of the documents to retrieve.
|
|
81
83
|
* @returns An array of matching documents.
|
|
82
84
|
*/
|
|
83
|
-
getList(docIds:
|
|
85
|
+
getList(docIds: UUID[]): Promise<TBasetype[]>;
|
|
84
86
|
/**
|
|
85
87
|
* Deletes a document by its ID.
|
|
86
88
|
*
|
|
87
89
|
* @param docId - The ID of the document to delete.
|
|
88
90
|
* @returns The result of the delete operation.
|
|
89
91
|
*/
|
|
90
|
-
delete(docId:
|
|
92
|
+
delete(docId: UUID): Promise<DeleteResult>;
|
|
91
93
|
/**
|
|
92
94
|
* Deletes multiple documents by their IDs.
|
|
93
95
|
*
|
|
94
96
|
* @param docIds - The IDs of the documents to delete.
|
|
95
97
|
* @returns The result of the delete operation.
|
|
96
98
|
*/
|
|
97
|
-
deleteList(docIds:
|
|
99
|
+
deleteList(docIds: UUID[]): Promise<DeleteResult>;
|
|
98
100
|
/**
|
|
99
101
|
* This should not be used except for testing purposes
|
|
100
102
|
*
|
|
@@ -122,21 +124,18 @@ export default abstract class BaseRepository<TBasetype extends BaseDocument> {
|
|
|
122
124
|
/**
|
|
123
125
|
* Gets the filter with the default filter applied if there is one.
|
|
124
126
|
*
|
|
125
|
-
* This is purposefully changing the type because of some weird restrictions
|
|
126
|
-
* with the `mongodb` package types.
|
|
127
|
-
*
|
|
128
127
|
* @param filter - The filter to apply.
|
|
129
128
|
* @returns The filter with the default filter applied.
|
|
130
129
|
*/
|
|
131
|
-
protected getFilterWithDefault(filter?: Filter<
|
|
130
|
+
protected getFilterWithDefault(filter?: Filter<TBasetype>): Filter<TBasetype>;
|
|
132
131
|
/**
|
|
133
|
-
* Checks if two arrays of {@link
|
|
132
|
+
* Checks if two arrays of {@link UUID} are equal.
|
|
134
133
|
*
|
|
135
134
|
* @param array1 - The first array.
|
|
136
135
|
* @param array2 - The second array.
|
|
137
136
|
* @returns True if the arrays are equal, false otherwise.
|
|
138
137
|
*/
|
|
139
|
-
protected
|
|
138
|
+
protected uuidArraysAreEqual(array1: UUID[], array2: UUID[]): boolean;
|
|
140
139
|
/**
|
|
141
140
|
* Cleans the update object by removing the `_id` field and running the
|
|
142
141
|
* default update cleaner if there is one.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseRepository.d.ts","sourceRoot":"","sources":["../../src/repositories/BaseRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"BaseRepository.d.ts","sourceRoot":"","sources":["../../src/repositories/BaseRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAEV,eAAe,EACf,UAAU,EACV,YAAY,EACZ,MAAM,EAEN,YAAY,EACb,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AAI7F,OAAO,UAAU,MAAM,gCAAgC,CAAC;AAExD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,cAAc,CAAC,SAAS,S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AAO,CAAC,SAAS,EAAE,CAAC;IAQnD;;;;;OAKG;IACG,MAAM,CAAC,KAAK,EAAE,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC;IAMhD;;;;;OAKG;IACG,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC;IASvD;;;;OAIG;IACG,SAAS,IAAI,OAAO,CAAC,YAAY,CAAC;IAKxC;;;;;;;OAOG;IACG,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC;IAenE;;;;;;;OAOG;IACG,UAAU,CAAC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC;IAoBlF;;;;;OAKG;IACH,SAAS,CAAC,oBAAoB,CAAC,MAAM,GAAE,MAAM,CAAC,SAAS,CAAM,GAAG,MAAM,CAAC,SAAS,CAAC;IAOjF;;;;;;OAMG;IACH,SAAS,CAAC,kBAAkB,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO;IAOrE;;;;;;;;OAQG;IACH,OAAO,CAAC,iBAAiB;CAK1B"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BaseDocument } from '@aneuhold/core-ts-db-lib';
|
|
2
|
-
import { ObjectId } from 'bson';
|
|
3
2
|
import RepoSubscriptionService from '../services/RepoSubscriptionService.js';
|
|
4
3
|
import DocumentCleaner from '../util/DocumentCleaner.js';
|
|
5
4
|
import DocumentDb from '../util/DocumentDb.js';
|
|
@@ -7,6 +6,9 @@ import IValidator from '../validators/BaseValidator.js';
|
|
|
7
6
|
/**
|
|
8
7
|
* Base repository class for handling common database operations.
|
|
9
8
|
*
|
|
9
|
+
* Implementation note: I have tried to do the types correctly here, but kept struggling with
|
|
10
|
+
* MongoDB's types around Filter<T> and _id fields.
|
|
11
|
+
*
|
|
10
12
|
* @template TBasetype - The type of the documents in the collection.
|
|
11
13
|
*/
|
|
12
14
|
export default class BaseRepository {
|
|
@@ -128,7 +130,7 @@ export default class BaseRepository {
|
|
|
128
130
|
async getAllIdsAsHash() {
|
|
129
131
|
const allDocs = await this.getAll();
|
|
130
132
|
return allDocs.reduce((acc, doc) => {
|
|
131
|
-
acc[doc._id
|
|
133
|
+
acc[doc._id] = true;
|
|
132
134
|
return acc;
|
|
133
135
|
}, {});
|
|
134
136
|
}
|
|
@@ -225,9 +227,6 @@ export default class BaseRepository {
|
|
|
225
227
|
/**
|
|
226
228
|
* Gets the filter with the default filter applied if there is one.
|
|
227
229
|
*
|
|
228
|
-
* This is purposefully changing the type because of some weird restrictions
|
|
229
|
-
* with the `mongodb` package types.
|
|
230
|
-
*
|
|
231
230
|
* @param filter - The filter to apply.
|
|
232
231
|
* @returns The filter with the default filter applied.
|
|
233
232
|
*/
|
|
@@ -238,13 +237,13 @@ export default class BaseRepository {
|
|
|
238
237
|
return { ...filter, ...this.defaultFilter };
|
|
239
238
|
}
|
|
240
239
|
/**
|
|
241
|
-
* Checks if two arrays of {@link
|
|
240
|
+
* Checks if two arrays of {@link UUID} are equal.
|
|
242
241
|
*
|
|
243
242
|
* @param array1 - The first array.
|
|
244
243
|
* @param array2 - The second array.
|
|
245
244
|
* @returns True if the arrays are equal, false otherwise.
|
|
246
245
|
*/
|
|
247
|
-
|
|
246
|
+
uuidArraysAreEqual(array1, array2) {
|
|
248
247
|
if (array1.length !== array2.length) {
|
|
249
248
|
return false;
|
|
250
249
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseRepository.js","sourceRoot":"","sources":["../../src/repositories/BaseRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseRepository.js","sourceRoot":"","sources":["../../src/repositories/BaseRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,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AAC,UAAU,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAE5F,OAAO,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;IAED;;;;;OAKG;IACO,oBAAoB,CAAC,SAA4B,EAAE;QAC3D,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YACxB,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,OAAO,EAAE,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;IAC9C,CAAC;IAED;;;;;;OAMG;IACO,kBAAkB,CAAC,MAAc,EAAE,MAAc;QACzD,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC;YACpC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IACnD,CAAC;IAED;;;;;;;;OAQG;IACK,iBAAiB,CAAC,UAA8B;QACtD,OAAO,IAAI,CAAC,oBAAoB;YAC9B,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,eAAe,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;YAC3D,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC;CACF"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BaseDocument } from '@aneuhold/core-ts-db-lib';
|
|
2
|
-
import type {
|
|
3
|
-
import { ObjectId } from 'bson';
|
|
2
|
+
import type { UUID } from 'crypto';
|
|
4
3
|
import type {
|
|
5
4
|
AnyBulkWriteOperation,
|
|
6
5
|
BulkWriteResult,
|
|
@@ -19,6 +18,9 @@ import IValidator from '../validators/BaseValidator.js';
|
|
|
19
18
|
/**
|
|
20
19
|
* Base repository class for handling common database operations.
|
|
21
20
|
*
|
|
21
|
+
* Implementation note: I have tried to do the types correctly here, but kept struggling with
|
|
22
|
+
* MongoDB's types around Filter<T> and _id fields.
|
|
23
|
+
*
|
|
22
24
|
* @template TBasetype - The type of the documents in the collection.
|
|
23
25
|
*/
|
|
24
26
|
export default abstract class BaseRepository<TBasetype extends BaseDocument> {
|
|
@@ -130,7 +132,7 @@ export default abstract class BaseRepository<TBasetype extends BaseDocument> {
|
|
|
130
132
|
*/
|
|
131
133
|
async get(filter: Partial<TBasetype>): Promise<TBasetype | null> {
|
|
132
134
|
const collection = await this.getCollection();
|
|
133
|
-
const result = await collection.findOne(this.getFilterWithDefault(filter));
|
|
135
|
+
const result = await collection.findOne(this.getFilterWithDefault(filter as Filter<TBasetype>));
|
|
134
136
|
return result as TBasetype | null;
|
|
135
137
|
}
|
|
136
138
|
|
|
@@ -154,7 +156,7 @@ export default abstract class BaseRepository<TBasetype extends BaseDocument> {
|
|
|
154
156
|
async getAllIdsAsHash(): Promise<{ [id: string]: boolean }> {
|
|
155
157
|
const allDocs = await this.getAll();
|
|
156
158
|
return allDocs.reduce<{ [id: string]: boolean }>((acc, doc) => {
|
|
157
|
-
acc[doc._id
|
|
159
|
+
acc[doc._id] = true;
|
|
158
160
|
return acc;
|
|
159
161
|
}, {});
|
|
160
162
|
}
|
|
@@ -165,10 +167,10 @@ export default abstract class BaseRepository<TBasetype extends BaseDocument> {
|
|
|
165
167
|
* @param docIds - The IDs of the documents to retrieve.
|
|
166
168
|
* @returns An array of matching documents.
|
|
167
169
|
*/
|
|
168
|
-
async getList(docIds:
|
|
170
|
+
async getList(docIds: UUID[]): Promise<TBasetype[]> {
|
|
169
171
|
const collection = await this.getCollection();
|
|
170
172
|
const result = await collection
|
|
171
|
-
.find(this.getFilterWithDefault({ _id: { $in: docIds } }))
|
|
173
|
+
.find(this.getFilterWithDefault({ _id: { $in: docIds } } as Filter<TBasetype>))
|
|
172
174
|
.toArray();
|
|
173
175
|
return result as TBasetype[];
|
|
174
176
|
}
|
|
@@ -179,7 +181,7 @@ export default abstract class BaseRepository<TBasetype extends BaseDocument> {
|
|
|
179
181
|
* @param docId - The ID of the document to delete.
|
|
180
182
|
* @returns The result of the delete operation.
|
|
181
183
|
*/
|
|
182
|
-
async delete(docId:
|
|
184
|
+
async delete(docId: UUID): Promise<DeleteResult> {
|
|
183
185
|
const collection = await this.getCollection();
|
|
184
186
|
await Promise.all(this.subscribers.deleteOne.map((subscriber) => subscriber(docId)));
|
|
185
187
|
return collection.deleteOne({ _id: docId } as Filter<TBasetype>);
|
|
@@ -191,7 +193,7 @@ export default abstract class BaseRepository<TBasetype extends BaseDocument> {
|
|
|
191
193
|
* @param docIds - The IDs of the documents to delete.
|
|
192
194
|
* @returns The result of the delete operation.
|
|
193
195
|
*/
|
|
194
|
-
async deleteList(docIds:
|
|
196
|
+
async deleteList(docIds: UUID[]): Promise<DeleteResult> {
|
|
195
197
|
const collection = await this.getCollection();
|
|
196
198
|
const deleteResult = collection.deleteMany({
|
|
197
199
|
_id: { $in: docIds }
|
|
@@ -264,13 +266,10 @@ export default abstract class BaseRepository<TBasetype extends BaseDocument> {
|
|
|
264
266
|
/**
|
|
265
267
|
* Gets the filter with the default filter applied if there is one.
|
|
266
268
|
*
|
|
267
|
-
* This is purposefully changing the type because of some weird restrictions
|
|
268
|
-
* with the `mongodb` package types.
|
|
269
|
-
*
|
|
270
269
|
* @param filter - The filter to apply.
|
|
271
270
|
* @returns The filter with the default filter applied.
|
|
272
271
|
*/
|
|
273
|
-
protected getFilterWithDefault(filter: Filter<
|
|
272
|
+
protected getFilterWithDefault(filter: Filter<TBasetype> = {}): Filter<TBasetype> {
|
|
274
273
|
if (!this.defaultFilter) {
|
|
275
274
|
return filter;
|
|
276
275
|
}
|
|
@@ -278,13 +277,13 @@ export default abstract class BaseRepository<TBasetype extends BaseDocument> {
|
|
|
278
277
|
}
|
|
279
278
|
|
|
280
279
|
/**
|
|
281
|
-
* Checks if two arrays of {@link
|
|
280
|
+
* Checks if two arrays of {@link UUID} are equal.
|
|
282
281
|
*
|
|
283
282
|
* @param array1 - The first array.
|
|
284
283
|
* @param array2 - The second array.
|
|
285
284
|
* @returns True if the arrays are equal, false otherwise.
|
|
286
285
|
*/
|
|
287
|
-
protected
|
|
286
|
+
protected uuidArraysAreEqual(array1: UUID[], array2: UUID[]): boolean {
|
|
288
287
|
if (array1.length !== array2.length) {
|
|
289
288
|
return false;
|
|
290
289
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { UserCTO } from '@aneuhold/core-ts-db-lib';
|
|
2
2
|
import { User } from '@aneuhold/core-ts-db-lib';
|
|
3
|
-
import {
|
|
3
|
+
import type { UUID } from 'crypto';
|
|
4
4
|
import BaseRepository from '../BaseRepository.js';
|
|
5
5
|
/**
|
|
6
6
|
* The repository that contains {@link User} documents.
|
|
@@ -15,6 +15,6 @@ export default class UserRepository extends BaseRepository<User> {
|
|
|
15
15
|
*/
|
|
16
16
|
static getRepo(): UserRepository;
|
|
17
17
|
getUserCTOByUsername(userName: string): Promise<UserCTO | null>;
|
|
18
|
-
getUserCTOsByIds(userIds:
|
|
18
|
+
getUserCTOsByIds(userIds: UUID[]): Promise<UserCTO[]>;
|
|
19
19
|
}
|
|
20
20
|
//# sourceMappingURL=UserRepository.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserRepository.d.ts","sourceRoot":"","sources":["../../../src/repositories/common/UserRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"UserRepository.d.ts","sourceRoot":"","sources":["../../../src/repositories/common/UserRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEnC,OAAO,cAAc,MAAM,sBAAsB,CAAC;AAOlD;;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;IAQlC;;OAEG;IACH,MAAM,CAAC,OAAO,IAAI,cAAc;IAO1B,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAW/D,gBAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAO5D"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { User } from '@aneuhold/core-ts-db-lib';
|
|
2
|
-
import { ObjectId } from 'bson';
|
|
3
2
|
import UserValidator from '../../validators/common/UserValidator.js';
|
|
4
3
|
import BaseRepository from '../BaseRepository.js';
|
|
5
4
|
import DashboardNonogramKatanaItemRepository from '../dashboard/DashboardNonogramKatanaItemRepository.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserRepository.js","sourceRoot":"","sources":["../../../src/repositories/common/UserRepository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"UserRepository.js","sourceRoot":"","sources":["../../../src/repositories/common/UserRepository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEhD,OAAO,aAAa,MAAM,0CAA0C,CAAC;AACrE,OAAO,cAAc,MAAM,sBAAsB,CAAC;AAClD,OAAO,qCAAqC,MAAM,uDAAuD,CAAC;AAC1G,OAAO,wCAAw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QACJ,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,OAAe;QACpC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC1B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAC,CAAC,CAAC;IACN,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { UserCTO } from '@aneuhold/core-ts-db-lib';
|
|
2
2
|
import { User } from '@aneuhold/core-ts-db-lib';
|
|
3
|
-
import {
|
|
3
|
+
import type { UUID } from 'crypto';
|
|
4
4
|
import UserValidator from '../../validators/common/UserValidator.js';
|
|
5
5
|
import BaseRepository from '../BaseRepository.js';
|
|
6
6
|
import DashboardNonogramKatanaItemRepository from '../dashboard/DashboardNonogramKatanaItemRepository.js';
|
|
@@ -50,7 +50,7 @@ export default class UserRepository extends BaseRepository<User> {
|
|
|
50
50
|
return null;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
async getUserCTOsByIds(userIds:
|
|
53
|
+
async getUserCTOsByIds(userIds: UUID[]): Promise<UserCTO[]> {
|
|
54
54
|
const users = await this.getList(userIds);
|
|
55
55
|
return users.map((user) => ({
|
|
56
56
|
userName: user.userName,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NonogramKatanaItem, User } from '@aneuhold/core-ts-db-lib';
|
|
2
|
-
import {
|
|
2
|
+
import type { UUID } from 'crypto';
|
|
3
3
|
import type { RepoListeners } from '../../services/RepoSubscriptionService.js';
|
|
4
4
|
import DashboardBaseRepository from './DashboardBaseRepository.js';
|
|
5
5
|
/**
|
|
@@ -19,6 +19,6 @@ export default class DashboardNonogramKatanaItemRepository extends DashboardBase
|
|
|
19
19
|
*
|
|
20
20
|
* @param userId The ID of the user to get items for.
|
|
21
21
|
*/
|
|
22
|
-
getAllForUser(userId:
|
|
22
|
+
getAllForUser(userId: UUID): Promise<NonogramKatanaItem[]>;
|
|
23
23
|
}
|
|
24
24
|
//# sourceMappingURL=DashboardNonogramKatanaItemRepository.d.ts.map
|
|
@@ -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,
|
|
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,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAG/E,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAEnE;;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;IAsBrD,SAAS,CAAC,gBAAgB,IAAI,IAAI;IAElC;;OAEG;WACW,OAAO,IAAI,qCAAqC;IAQ9D;;;;OAIG;IACG,aAAa,CAAC,MAAM,EAAE,IAAI,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;CAQjE"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { NonogramKatanaItem, User } from '@aneuhold/core-ts-db-lib';
|
|
2
|
-
import { ObjectId } from 'bson';
|
|
3
2
|
import CleanDocument from '../../util/DocumentCleaner.js';
|
|
4
3
|
import DashboardNonogramKatanaItemValidator from '../../validators/dashboard/NonogramKatanaItemValidator.js';
|
|
5
4
|
import DashboardBaseRepository from './DashboardBaseRepository.js';
|
|
@@ -15,11 +14,15 @@ export default class DashboardNonogramKatanaItemRepository extends DashboardBase
|
|
|
15
14
|
const nonogramKatanaRepo = DashboardNonogramKatanaItemRepository.getRepo();
|
|
16
15
|
return {
|
|
17
16
|
deleteOne: async (userId) => {
|
|
18
|
-
await (await nonogramKatanaRepo.getCollection()).deleteMany({
|
|
17
|
+
await (await nonogramKatanaRepo.getCollection()).deleteMany({
|
|
18
|
+
userId,
|
|
19
|
+
docType: NonogramKatanaItem.docType
|
|
20
|
+
});
|
|
19
21
|
},
|
|
20
22
|
deleteList: async (userIds) => {
|
|
21
23
|
await (await nonogramKatanaRepo.getCollection()).deleteMany({
|
|
22
|
-
userId: { $in: userIds }
|
|
24
|
+
userId: { $in: userIds },
|
|
25
|
+
docType: NonogramKatanaItem.docType
|
|
23
26
|
});
|
|
24
27
|
}
|
|
25
28
|
};
|
|
@@ -41,7 +44,7 @@ export default class DashboardNonogramKatanaItemRepository extends DashboardBase
|
|
|
41
44
|
* @param userId The ID of the user to get items for.
|
|
42
45
|
*/
|
|
43
46
|
async getAllForUser(userId) {
|
|
44
|
-
const collection = await
|
|
47
|
+
const collection = await DashboardNonogramKatanaItemRepository.getRepo().getCollection();
|
|
45
48
|
const filter = {
|
|
46
49
|
$and: [this.getFilterWithDefault(), { userId }]
|
|
47
50
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardNonogramKatanaItemRepository.js","sourceRoot":"","sources":["../../../src/repositories/dashboard/DashboardNonogramKatanaItemRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"DashboardNonogramKatanaItemRepository.js","sourceRoot":"","sources":["../../../src/repositories/dashboard/DashboardNonogramKatanaItemRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGpE,OAAO,aAAa,MAAM,+BAA+B,CAAC;AAC1D,OAAO,oCAAoC,MAAM,2DAA2D,CAAC;AAC7G,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAEnE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,qCAAsC,SAAQ,uBAA2C;IACpG,MAAM,CAAC,iBAAiB,CAAyC;IAEzE;QACE,KAAK,CACH,kBAAkB,CAAC,OAAO,EAC1B,IAAI,oCAAoC,EAAE,EAC1C,aAAa,CAAC,MAAM,CACrB,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,uBAAuB;QAC5B,MAAM,kBAAkB,GAAG,qCAAqC,CAAC,OAAO,EAAE,CAAC;QAC3E,OAAO;YACL,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;gBAC1B,MAAM,CACJ,MAAM,kBAAkB,CAAC,aAAa,EAAE,CACzC,CAAC,UAAU,CAAC;oBACX,MAAM;oBACN,OAAO,EAAE,kBAAkB,CAAC,OAAO;iBACpC,CAAC,CAAC;YACL,CAAC;YACD,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;gBAC5B,MAAM,CACJ,MAAM,kBAAkB,CAAC,aAAa,EAAE,CACzC,CAAC,UAAU,CAAC;oBACX,MAAM,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE;oBACxB,OAAO,EAAE,kBAAkB,CAAC,OAAO;iBACpC,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;IAES,gBAAgB,KAAU,CAAC;IAErC;;OAEG;IACI,MAAM,CAAC,OAAO;QACnB,IAAI,CAAC,qCAAqC,CAAC,iBAAiB,EAAE,CAAC;YAC7D,qCAAqC,CAAC,iBAAiB;gBACrD,IAAI,qCAAqC,EAAE,CAAC;QAChD,CAAC;QACD,OAAO,qCAAqC,CAAC,iBAAiB,CAAC;IACjE,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,aAAa,CAAC,MAAY;QAC9B,MAAM,UAAU,GAAG,MAAM,qCAAqC,CAAC,OAAO,EAAE,CAAC,aAAa,EAAE,CAAC;QACzF,MAAM,MAAM,GAAG;YACb,IAAI,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;SAChD,CAAC;QACF,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC;QACvD,OAAO,MAA8B,CAAC;IACxC,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NonogramKatanaItem, User } from '@aneuhold/core-ts-db-lib';
|
|
2
|
-
import {
|
|
2
|
+
import type { UUID } from 'crypto';
|
|
3
3
|
import type { RepoListeners } from '../../services/RepoSubscriptionService.js';
|
|
4
4
|
import CleanDocument from '../../util/DocumentCleaner.js';
|
|
5
5
|
import DashboardNonogramKatanaItemValidator from '../../validators/dashboard/NonogramKatanaItemValidator.js';
|
|
@@ -23,13 +23,19 @@ export default class DashboardNonogramKatanaItemRepository extends DashboardBase
|
|
|
23
23
|
const nonogramKatanaRepo = DashboardNonogramKatanaItemRepository.getRepo();
|
|
24
24
|
return {
|
|
25
25
|
deleteOne: async (userId) => {
|
|
26
|
-
await (
|
|
26
|
+
await (
|
|
27
|
+
await nonogramKatanaRepo.getCollection()
|
|
28
|
+
).deleteMany({
|
|
29
|
+
userId,
|
|
30
|
+
docType: NonogramKatanaItem.docType
|
|
31
|
+
});
|
|
27
32
|
},
|
|
28
33
|
deleteList: async (userIds) => {
|
|
29
34
|
await (
|
|
30
35
|
await nonogramKatanaRepo.getCollection()
|
|
31
36
|
).deleteMany({
|
|
32
|
-
userId: { $in: userIds }
|
|
37
|
+
userId: { $in: userIds },
|
|
38
|
+
docType: NonogramKatanaItem.docType
|
|
33
39
|
});
|
|
34
40
|
}
|
|
35
41
|
};
|
|
@@ -53,8 +59,8 @@ export default class DashboardNonogramKatanaItemRepository extends DashboardBase
|
|
|
53
59
|
*
|
|
54
60
|
* @param userId The ID of the user to get items for.
|
|
55
61
|
*/
|
|
56
|
-
async getAllForUser(userId:
|
|
57
|
-
const collection = await
|
|
62
|
+
async getAllForUser(userId: UUID): Promise<NonogramKatanaItem[]> {
|
|
63
|
+
const collection = await DashboardNonogramKatanaItemRepository.getRepo().getCollection();
|
|
58
64
|
const filter = {
|
|
59
65
|
$and: [this.getFilterWithDefault(), { userId }]
|
|
60
66
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NonogramKatanaUpgrade, User } from '@aneuhold/core-ts-db-lib';
|
|
2
|
-
import {
|
|
2
|
+
import type { UUID } from 'crypto';
|
|
3
3
|
import type { RepoListeners } from '../../services/RepoSubscriptionService.js';
|
|
4
4
|
import DashboardBaseRepository from './DashboardBaseRepository.js';
|
|
5
5
|
/**
|
|
@@ -19,6 +19,6 @@ export default class DashboardNonogramKatanaUpgradeRepository extends DashboardB
|
|
|
19
19
|
*
|
|
20
20
|
* @param userId The ID of the user to get upgrades for.
|
|
21
21
|
*/
|
|
22
|
-
getAllForUser(userId:
|
|
22
|
+
getAllForUser(userId: UUID): Promise<NonogramKatanaUpgrade[]>;
|
|
23
23
|
}
|
|
24
24
|
//# sourceMappingURL=DashboardNonogramKatanaUpgradeRepository.d.ts.map
|
|
@@ -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,
|
|
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,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAG/E,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAEnE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,wCAAyC,SAAQ,uBAAuB,CAAC,qBAAqB,CAAC;IAClH,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAuD;IAEvF,OAAO;IAQP,MAAM,CAAC,uBAAuB,IAAI,aAAa,CAAC,IAAI,CAAC;IAsBrD,SAAS,CAAC,gBAAgB,IAAI,IAAI;IAElC;;OAEG;WACW,OAAO,IAAI,wCAAwC;IAQjE;;;;OAIG;IACG,aAAa,CAAC,MAAM,EAAE,IAAI,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;CAQpE"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { NonogramKatanaUpgrade, User } from '@aneuhold/core-ts-db-lib';
|
|
2
|
-
import { ObjectId } from 'bson';
|
|
3
2
|
import CleanDocument from '../../util/DocumentCleaner.js';
|
|
4
3
|
import DashboardNonogramKatanaUpgradeValidator from '../../validators/dashboard/NonogramKatanaUpgradeValidator.js';
|
|
5
4
|
import DashboardBaseRepository from './DashboardBaseRepository.js';
|
|
@@ -15,11 +14,15 @@ export default class DashboardNonogramKatanaUpgradeRepository extends DashboardB
|
|
|
15
14
|
const upgradeRepo = DashboardNonogramKatanaUpgradeRepository.getRepo();
|
|
16
15
|
return {
|
|
17
16
|
deleteOne: async (userId) => {
|
|
18
|
-
await (await upgradeRepo.getCollection()).deleteMany({
|
|
17
|
+
await (await upgradeRepo.getCollection()).deleteMany({
|
|
18
|
+
userId,
|
|
19
|
+
docType: NonogramKatanaUpgrade.docType
|
|
20
|
+
});
|
|
19
21
|
},
|
|
20
22
|
deleteList: async (userIds) => {
|
|
21
23
|
await (await upgradeRepo.getCollection()).deleteMany({
|
|
22
|
-
userId: { $in: userIds }
|
|
24
|
+
userId: { $in: userIds },
|
|
25
|
+
docType: NonogramKatanaUpgrade.docType
|
|
23
26
|
});
|
|
24
27
|
}
|
|
25
28
|
};
|
|
@@ -41,7 +44,7 @@ export default class DashboardNonogramKatanaUpgradeRepository extends DashboardB
|
|
|
41
44
|
* @param userId The ID of the user to get upgrades for.
|
|
42
45
|
*/
|
|
43
46
|
async getAllForUser(userId) {
|
|
44
|
-
const collection = await
|
|
47
|
+
const collection = await DashboardNonogramKatanaUpgradeRepository.getRepo().getCollection();
|
|
45
48
|
const filter = {
|
|
46
49
|
$and: [this.getFilterWithDefault(), { userId }]
|
|
47
50
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardNonogramKatanaUpgradeRepository.js","sourceRoot":"","sources":["../../../src/repositories/dashboard/DashboardNonogramKatanaUpgradeRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"DashboardNonogramKatanaUpgradeRepository.js","sourceRoot":"","sources":["../../../src/repositories/dashboard/DashboardNonogramKatanaUpgradeRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGvE,OAAO,aAAa,MAAM,+BAA+B,CAAC;AAC1D,OAAO,uCAAuC,MAAM,8DAA8D,CAAC;AACnH,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAEnE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,wCAAyC,SAAQ,uBAA8C;IAC1G,MAAM,CAAC,iBAAiB,CAAuD;IAEvF;QACE,KAAK,CACH,qBAAqB,CAAC,OAAO,EAC7B,IA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B,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NonogramKatanaUpgrade, User } from '@aneuhold/core-ts-db-lib';
|
|
2
|
-
import {
|
|
2
|
+
import type { UUID } from 'crypto';
|
|
3
3
|
import type { RepoListeners } from '../../services/RepoSubscriptionService.js';
|
|
4
4
|
import CleanDocument from '../../util/DocumentCleaner.js';
|
|
5
5
|
import DashboardNonogramKatanaUpgradeValidator from '../../validators/dashboard/NonogramKatanaUpgradeValidator.js';
|
|
@@ -23,13 +23,19 @@ export default class DashboardNonogramKatanaUpgradeRepository extends DashboardB
|
|
|
23
23
|
const upgradeRepo = DashboardNonogramKatanaUpgradeRepository.getRepo();
|
|
24
24
|
return {
|
|
25
25
|
deleteOne: async (userId) => {
|
|
26
|
-
await (
|
|
26
|
+
await (
|
|
27
|
+
await upgradeRepo.getCollection()
|
|
28
|
+
).deleteMany({
|
|
29
|
+
userId,
|
|
30
|
+
docType: NonogramKatanaUpgrade.docType
|
|
31
|
+
});
|
|
27
32
|
},
|
|
28
33
|
deleteList: async (userIds) => {
|
|
29
34
|
await (
|
|
30
35
|
await upgradeRepo.getCollection()
|
|
31
36
|
).deleteMany({
|
|
32
|
-
userId: { $in: userIds }
|
|
37
|
+
userId: { $in: userIds },
|
|
38
|
+
docType: NonogramKatanaUpgrade.docType
|
|
33
39
|
});
|
|
34
40
|
}
|
|
35
41
|
};
|
|
@@ -53,12 +59,12 @@ export default class DashboardNonogramKatanaUpgradeRepository extends DashboardB
|
|
|
53
59
|
*
|
|
54
60
|
* @param userId The ID of the user to get upgrades for.
|
|
55
61
|
*/
|
|
56
|
-
async getAllForUser(userId:
|
|
57
|
-
const collection = await
|
|
62
|
+
async getAllForUser(userId: UUID): Promise<NonogramKatanaUpgrade[]> {
|
|
63
|
+
const collection = await DashboardNonogramKatanaUpgradeRepository.getRepo().getCollection();
|
|
58
64
|
const filter = {
|
|
59
65
|
$and: [this.getFilterWithDefault(), { userId }]
|
|
60
66
|
};
|
|
61
67
|
const result = await collection.find(filter).toArray();
|
|
62
|
-
return result
|
|
68
|
+
return result;
|
|
63
69
|
}
|
|
64
70
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DashboardTask, User } from '@aneuhold/core-ts-db-lib';
|
|
2
|
-
import {
|
|
2
|
+
import type { UUID } from 'crypto';
|
|
3
3
|
import type { DeleteResult } from 'mongodb';
|
|
4
4
|
import type { RepoListeners } from '../../services/RepoSubscriptionService.js';
|
|
5
5
|
import DashboardBaseRepository from './DashboardBaseRepository.js';
|
|
@@ -33,14 +33,14 @@ export default class DashboardTaskRepository extends DashboardBaseRepository<Das
|
|
|
33
33
|
* @param docId The ID of the document to delete.
|
|
34
34
|
* @returns The result of the delete operation.
|
|
35
35
|
*/
|
|
36
|
-
delete(docId:
|
|
36
|
+
delete(docId: UUID): Promise<DeleteResult>;
|
|
37
37
|
/**
|
|
38
38
|
* Deletes a list of tasks and all children of those tasks.
|
|
39
39
|
*
|
|
40
40
|
* @param docIds The IDs of the documents to delete.
|
|
41
41
|
* @returns The result of the delete operation.
|
|
42
42
|
*/
|
|
43
|
-
deleteList(docIds:
|
|
43
|
+
deleteList(docIds: UUID[]): Promise<DeleteResult>;
|
|
44
44
|
/**
|
|
45
45
|
* Gets all tasks for a given user. Only the tasks that are owned by the user
|
|
46
46
|
* or shared with the user, while they have the user ID as a collaborator,
|
|
@@ -49,7 +49,7 @@ export default class DashboardTaskRepository extends DashboardBaseRepository<Das
|
|
|
49
49
|
* @param userId The ID of the user to get tasks for.
|
|
50
50
|
* @returns The list of tasks for the user.
|
|
51
51
|
*/
|
|
52
|
-
getAllForUser(userId:
|
|
52
|
+
getAllForUser(userId: UUID): Promise<DashboardTask[]>;
|
|
53
53
|
/**
|
|
54
54
|
* Gets all the task IDs that need to be deleted if the provided list of
|
|
55
55
|
* tasks is deleted.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardTaskRepository.d.ts","sourceRoot":"","sources":["../../../src/repositories/dashboard/DashboardTaskRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAwB,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACrF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"DashboardTaskRepository.d.ts","sourceRoot":"","sources":["../../../src/repositories/dashboard/DashboardTaskRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAwB,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACrF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAG/E,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAGnE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,uBAAuB,CAAC,aAAa,CAAC;IACzF,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAA0B;IAE3D;;OAEG;IACH,OAAO;IASP;;;;;OAKG;IACH,MAAM,CAAC,uBAAuB,IAAI,aAAa,CAAC,IAAI,CAAC;IA6BrD,SAAS,CAAC,gBAAgB,IAAI,IAAI;IAElC;;;;OAIG;WACW,OAAO,IAAI,uBAAuB;IAOhD;;;;;;OAMG;IACY,MAAM,CAAC,KAAK,EAAE,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC;IAMzD;;;;;OAKG;IACY,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC;IAMhE;;;;;;;OAOG;IACG,aAAa,CAAC,MAAM,EAAE,IAAI,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAyB3D;;;;;;OAMG;YACW,qBAAqB;CAYpC"}
|