@futdevpro/nts-dynamo 1.7.12 → 1.7.15

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.
@@ -605,10 +605,15 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
605
605
  if (dataExists) {
606
606
  // if data exists do modify
607
607
  this.data = await this.dataDBService.modifyData(this.data, this.issuer);
608
+
608
609
  return this.data;
610
+
609
611
  } else {
610
612
  // if data not exists check that dependency already exists for this
611
- const dependencyExists = await this.getDependencyDataDBService().getDataById(this.data[this.depKey]);
613
+ const dependencyExists = await this.getDependencyDataDBService()
614
+ .getDataById(this.data[this.depKey])
615
+ .catch(error => null);
616
+
612
617
  if(!dependencyExists) {
613
618
  throw new Dynamo_Error({
614
619
  ...this._getDefaultErrorSettings(
@@ -630,6 +635,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
630
635
  } catch (error) {
631
636
  if (['NTS-DS0-SD1', 'NTS-DS0-SD2'].includes(error?.errorCode)) {
632
637
  throw error;
638
+
633
639
  } else {
634
640
  throw new Dynamo_Error({
635
641
  ...this._getDefaultErrorSettings('saveData', error),
@@ -82,6 +82,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
82
82
 
83
83
  status: 204,
84
84
  errorCode: 'NTS-DBS-CD1',
85
+ additionalContent: { data },
85
86
  issuer,
86
87
  });
87
88
  }
@@ -94,6 +95,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
94
95
 
95
96
  status: 422,
96
97
  errorCode: 'NTS-DBS-CD0',
98
+ additionalContent: { data },
97
99
  message: `createData failed, Create new ${this.dataParams.dbName} was unsuccessful (NTS DB)`,
98
100
  issuer,
99
101
  });
@@ -114,10 +116,10 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
114
116
  data.__lastModified = new Date();
115
117
  data.__lastModifiedBy = issuer;
116
118
 
117
- /** EZ A SZAR TELJESEN SZAR, nem friss, a db-be mentett adatokat ad vissza, átír random value-kat */
119
+ /** EZ A SZAR TELJESEN SZAR, nem friss, nem a db-be mentett adatokat ad vissza, átír random value-kat össze vissza, WTF */
118
120
  /* let newData: T = */ await this.dataModel.findByIdAndUpdate(data._id, data).then(res => {
119
- if (res) {
120
- /* return res?.toObject() as T; */
121
+ /* if (res) {
122
+ //return res?.toObject() as T;
121
123
  } else {
122
124
  throw new Dynamo_Error({
123
125
  ...this._getDefaultErrorSettings(
@@ -128,14 +130,16 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
128
130
 
129
131
  status: 204,
130
132
  errorCode: 'NTS-DBS-FU1',
133
+ additionalContent: { data },
131
134
  issuer,
132
135
  });
133
- }
136
+ } */
134
137
  }).catch(error => {
135
138
  throw new Dynamo_Error({
136
139
  ...this._getDefaultErrorSettings('modifyData', error, issuer),
137
140
 
138
141
  errorCode: 'NTS-DBS-FU0',
142
+ additionalContent: { data },
139
143
  message: `modifyData ${this.dataParams.dbName} was unsuccessful (NTS DB)`,
140
144
  issuer,
141
145
  });
@@ -168,6 +172,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
168
172
  ...this._getDefaultErrorSettings('getDataById', error),
169
173
 
170
174
  errorCode: 'NTS-DBS-GI0',
175
+ additionalContent: { id },
171
176
  message: `get ${this.dataParams.dbName} by ID was unsuccessful (NTS DB)`,
172
177
  });
173
178
  });
@@ -204,6 +209,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
204
209
  ...this._getDefaultErrorSettings('getDataByDependencyId', error),
205
210
 
206
211
  errorCode: 'NTS-DBS-GD1',
212
+ additionalContent: { dependencyId },
207
213
  message: `get ${this.dataParams.dbName} by ${this.depDataName} was unsuccessful (NTS DB)`,
208
214
  });
209
215
  });
@@ -240,6 +246,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
240
246
  ...this._getDefaultErrorSettings('getDataListByDependencyId', error),
241
247
 
242
248
  errorCode: 'NTS-DBS-GLD1',
249
+ additionalContent: { dependencyId },
243
250
  message: `get ${this.dataParams.dbName} by ${this.depDataName} was unsuccessful (NTS DB)`,
244
251
  });
245
252
  });
@@ -271,6 +278,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
271
278
  ...this._getDefaultErrorSettings('getDatasByDependencyIds', error),
272
279
 
273
280
  errorCode: 'NTS-DBS-GLDS1',
281
+ additionalContent: { dependencyIds },
274
282
  message: `get ${this.dataParams.dbName} by ${this.depDataName} was unsuccessful (NTS DB)`,
275
283
  });
276
284
  });
@@ -309,6 +317,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
309
317
  ...this._getDefaultErrorSettings('getDataListByDependencyIds', error),
310
318
 
311
319
  errorCode: 'NTS-DBS-GLDS1',
320
+ additionalContent: { ids },
312
321
  message: `get ${this.dataParams.dbName}s by ${this.depDataName}s was unsuccessful (NTS DB)`,
313
322
  });
314
323
  });
@@ -356,6 +365,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
356
365
  ...this._getDefaultErrorSettings('deleteDataById', error),
357
366
 
358
367
  errorCode: 'NTS-DBS-DD0',
368
+ additionalContent: { id },
359
369
  message: `delete ${this.dataParams.dbName} was unsuccessful (NTS DB)`,
360
370
  });
361
371
  });
@@ -383,6 +393,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
383
393
  ...this._getDefaultErrorSettings('deleteDataByDependencyId', error),
384
394
 
385
395
  errorCode: 'NTS-DBS-DDD1',
396
+ additionalContent: { dependencyId },
386
397
  message: `delete ${this.dataParams.dbName} by ${this.depDataName} was unsuccessful (NTS DB)`,
387
398
  });
388
399
  });
@@ -470,6 +481,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
470
481
  ...this._getDefaultErrorSettings('searchData', error),
471
482
 
472
483
  errorCode: 'NTS-DBS-SD1',
484
+ additionalContent: { filterBy, narrowByDependencyIds },
473
485
  message: `search ${this.dataParams.dbName} was unsuccessful (NTS DB)`,
474
486
  });
475
487
  });
@@ -520,7 +532,8 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
520
532
  ...this._getDefaultErrorSettings('findOne', error),
521
533
 
522
534
  errorCode: 'NTS-DBS-FO0',
523
- message: `findOne ${this.dataParams.dbName} was unsuccessful (NTS DB) fliter: ${filterBy}`,
535
+ additionalContent: { filterBy },
536
+ message: `findOne ${this.dataParams.dbName} was unsuccessful (NTS DB)`,
524
537
  });
525
538
  });
526
539
 
@@ -565,6 +578,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
565
578
  ...this._getDefaultErrorSettings('find', error),
566
579
 
567
580
  errorCode: 'NTS-DBS-F0',
581
+ additionalContent: { filterBy },
568
582
  message: `find ${this.dataParams.dbName} was unsuccessful (NTS DB)`,
569
583
  });
570
584
  });
@@ -620,6 +634,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
620
634
  ...this._getDefaultErrorSettings('findWithPaging', error),
621
635
 
622
636
  errorCode: 'NTS-DBS-WP0',
637
+ additionalContent: { filterBy, page, pageSize, sort },
623
638
  message: `findWithPaging ${this.dataParams.dbName} was unsuccessful (NTS DB)`,
624
639
  });
625
640
  });
@@ -651,6 +666,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
651
666
  ...this._getDefaultErrorSettings('findByIdAndUpdate', error, issuer),
652
667
 
653
668
  errorCode: 'NTS-DBS-FIU0',
669
+ additionalContent: { id, update },
654
670
  message: `findByIdAndUpdate ${this.dataParams.dbName} was unsuccessful (NTS DB)`,
655
671
  issuer,
656
672
  });
@@ -722,6 +738,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
722
738
  ...this._getDefaultErrorSettings('updateOne', error, issuer),
723
739
 
724
740
  errorCode: 'NTS-DBS-UO0',
741
+ additionalContent: { filterBy, update },
725
742
  message: `updateOne ${this.dataParams.dbName} was unsuccessful (NTS DB)`,
726
743
  issuer,
727
744
  });
@@ -788,6 +805,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
788
805
  ...this._getDefaultErrorSettings('updateMany', error, issuer),
789
806
 
790
807
  errorCode: 'NTS-DBS-UM0',
808
+ additionalContent: { filterBy, update },
791
809
  message: `updateMany ${this.dataParams.dbName} was unsuccessful (NTS DB)`,
792
810
  issuer,
793
811
  });
@@ -417,6 +417,7 @@ export abstract class DynamoNTS_App extends DynamoNTS_SingletonService {
417
417
 
418
418
  if (this.constructErrors.length) {
419
419
  Dynamo_Log.error(`${this._params.name} start failed. ERROR`, this.constructErrors);
420
+
420
421
  throw new Dynamo_Error({
421
422
  ...this._getDefaultErrorSettings(
422
423
  'ready',