@koalarx/nest 3.1.22 → 3.1.24
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.
|
@@ -317,7 +317,7 @@ class RepositoryBase {
|
|
|
317
317
|
relationKeys.push(propName);
|
|
318
318
|
const items = [];
|
|
319
319
|
data[propName]?.forEach((item) => {
|
|
320
|
-
const cacheKey = `${entity.
|
|
320
|
+
const cacheKey = `${entity.name}-${propName}-${this.getIdOnEntity(new entityInstance(), item)}`;
|
|
321
321
|
if (cache.has(cacheKey)) {
|
|
322
322
|
items.push(Promise.resolve(cache.get(cacheKey)));
|
|
323
323
|
return;
|
|
@@ -330,7 +330,7 @@ class RepositoryBase {
|
|
|
330
330
|
}
|
|
331
331
|
const relationEntity = auto_mapping_list_1.AutoMappingList.getSourceByName(propDef?.type ?? '');
|
|
332
332
|
if (relationEntity && data[propName]) {
|
|
333
|
-
const cacheKey = `${entity.
|
|
333
|
+
const cacheKey = `${entity.name}-${propName}-${this.getIdOnEntity(new relationEntity(), data[propName])}`;
|
|
334
334
|
if (cache.has(cacheKey)) {
|
|
335
335
|
data[propName] = cache.get(cacheKey);
|
|
336
336
|
return;
|
|
@@ -350,7 +350,9 @@ class RepositoryBase {
|
|
|
350
350
|
}
|
|
351
351
|
persistRelations(transaction, entity) {
|
|
352
352
|
const { relationCreates, relationUpdates, relationDeletes } = this.listToRelationActionList(entity);
|
|
353
|
-
return Promise.all([
|
|
353
|
+
return Promise.all(relationDeletes.map((relation) => transaction[relation.modelName].deleteMany({
|
|
354
|
+
where: relation.schema,
|
|
355
|
+
}))).then(() => Promise.all([
|
|
354
356
|
...relationCreates.map((relationCreate) => transaction[relationCreate.modelName]
|
|
355
357
|
.create(relationCreate.schema)
|
|
356
358
|
.then((response) => {
|
|
@@ -382,10 +384,8 @@ class RepositoryBase {
|
|
|
382
384
|
return this.persistRelations(transaction, relation);
|
|
383
385
|
});
|
|
384
386
|
}));
|
|
385
|
-
}), ...relationUpdates.map((relation) => transaction[relation.modelName].update(relation.schema)),
|
|
386
|
-
|
|
387
|
-
}))),
|
|
388
|
-
]);
|
|
387
|
+
}), ...relationUpdates.map((relation) => transaction[relation.modelName].update(relation.schema))),
|
|
388
|
+
]));
|
|
389
389
|
}
|
|
390
390
|
context(transactionalClient) {
|
|
391
391
|
const modelName = this._modelName.name;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koalarx/nest",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.24",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Igor D. Rangel",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@nestjs/swagger": "^11.0.7",
|
|
22
22
|
"@prisma/adapter-pg": "^7.2.0",
|
|
23
23
|
"@prisma/client": "^7.2.0",
|
|
24
|
-
"@scalar/nestjs-api-reference": "^0.
|
|
24
|
+
"@scalar/nestjs-api-reference": "^1.0.24",
|
|
25
25
|
"consola": "^3.4.2",
|
|
26
26
|
"dotenv": "^16.0.3",
|
|
27
27
|
"express-basic-auth": "^1.2.1",
|