@futdevpro/nts-dynamo 1.5.40 → 1.5.45
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/futdevpro-nts-dynamo-01.05.41.tgz +0 -0
- package/futdevpro-nts-dynamo-01.05.42.tgz +0 -0
- package/futdevpro-nts-dynamo-01.05.43.tgz +0 -0
- package/futdevpro-nts-dynamo-01.05.44.tgz +0 -0
- package/futdevpro-nts-dynamo-01.05.45.tgz +0 -0
- package/lib/_enums/http/socket-event.enum.d.ts +2 -0
- package/lib/_enums/http/socket-event.enum.d.ts.map +1 -1
- package/lib/_enums/http/socket-event.enum.js +2 -0
- package/lib/_enums/http/socket-event.enum.js.map +1 -1
- package/lib/_models/dynamo-nts-socket-dictionary.d.ts +16 -0
- package/lib/_models/dynamo-nts-socket-dictionary.d.ts.map +1 -0
- package/lib/_models/dynamo-nts-socket-dictionary.js +28 -0
- package/lib/_models/dynamo-nts-socket-dictionary.js.map +1 -0
- package/lib/_models/dynamo-nts-socket-event-params.d.ts +2 -0
- package/lib/_models/dynamo-nts-socket-event-params.d.ts.map +1 -1
- package/lib/_models/dynamo-nts-socket-event-params.js +6 -5
- package/lib/_models/dynamo-nts-socket-event-params.js.map +1 -1
- package/lib/_models/index.d.ts +1 -0
- package/lib/_models/index.d.ts.map +1 -1
- package/lib/_models/index.js +1 -0
- package/lib/_models/index.js.map +1 -1
- package/lib/_modules/app-extended.index.d.ts +1 -0
- package/lib/_modules/app-extended.index.d.ts.map +1 -1
- package/lib/_modules/app-extended.index.js +1 -0
- package/lib/_modules/app-extended.index.js.map +1 -1
- package/lib/_modules/usage/usage.service.d.ts.map +1 -1
- package/lib/_modules/usage/usage.service.js +8 -4
- package/lib/_modules/usage/usage.service.js.map +1 -1
- package/lib/_services/dynamo-nts-api.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-api.service.js +5 -4
- package/lib/_services/dynamo-nts-api.service.js.map +1 -1
- package/lib/_services/dynamo-nts-app-extended.d.ts +1 -1
- package/lib/_services/dynamo-nts-app-extended.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-app-extended.js +2 -4
- package/lib/_services/dynamo-nts-app-extended.js.map +1 -1
- package/lib/_services/dynamo-nts-app.js +4 -1
- package/lib/_services/dynamo-nts-app.js.map +1 -1
- package/lib/_services/dynamo-nts-auth.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-auth.service.js +4 -2
- package/lib/_services/dynamo-nts-auth.service.js.map +1 -1
- package/lib/_services/dynamo-nts-controller.service.d.ts +37 -0
- package/lib/_services/dynamo-nts-controller.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-controller.service.js +37 -0
- package/lib/_services/dynamo-nts-controller.service.js.map +1 -1
- package/lib/_services/dynamo-nts-data.service.d.ts +19 -0
- package/lib/_services/dynamo-nts-data.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-data.service.js +70 -31
- package/lib/_services/dynamo-nts-data.service.js.map +1 -1
- package/lib/_services/dynamo-nts-db.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-db.service.js +72 -48
- package/lib/_services/dynamo-nts-db.service.js.map +1 -1
- package/lib/_services/dynamo-nts-email.service.js +4 -4
- package/lib/_services/dynamo-nts-email.service.js.map +1 -1
- package/lib/_services/dynamo-nts-global.service.d.ts +2 -2
- package/lib/_services/dynamo-nts-global.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-global.service.js.map +1 -1
- package/lib/_services/dynamo-nts-routing-module.service.js +3 -3
- package/lib/_services/dynamo-nts-routing-module.service.js.map +1 -1
- package/lib/_services/dynamo-nts-shared.service.d.ts +6 -0
- package/lib/_services/dynamo-nts-shared.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-shared.service.js +8 -0
- package/lib/_services/dynamo-nts-shared.service.js.map +1 -1
- package/lib/_services/dynamo-nts-socket-service-collection.service.d.ts +1 -1
- package/lib/_services/dynamo-nts-socket-service-collection.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-socket.service.d.ts +6 -9
- package/lib/_services/dynamo-nts-socket.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-socket.service.js +20 -19
- package/lib/_services/dynamo-nts-socket.service.js.map +1 -1
- package/lib/_services/dynamobe-api.service.js +2 -2
- package/lib/_services/dynamobe-auth.service.js +2 -2
- package/lib/_services/dynamobe-data.service.js +15 -15
- package/lib/_services/dynamobe-db.service.js +24 -24
- package/lib/_services/dynamobe-email.service.js +4 -4
- package/lib/_services/dynamobe-routing-module.service.js +3 -3
- package/lib/tsconfig.tsbuildinfo +77 -52
- package/package.json +12 -9
- package/src/_enums/http/socket-event.enum.ts +2 -0
- package/src/_models/dynamo-nts-socket-dictionary.ts +36 -0
- package/src/_models/dynamo-nts-socket-event-params.ts +8 -5
- package/src/_models/index.ts +1 -0
- package/src/_modules/app-extended.index.ts +1 -0
- package/src/_modules/usage/usage.service.ts +8 -4
- package/src/_services/dynamo-nts-api.service.ts +7 -4
- package/src/_services/dynamo-nts-app-extended.ts +9 -9
- package/src/_services/dynamo-nts-app.ts +2 -2
- package/src/_services/dynamo-nts-auth.service.ts +6 -2
- package/src/_services/dynamo-nts-controller.service.ts +37 -0
- package/src/_services/dynamo-nts-data.service.ts +70 -31
- package/src/_services/dynamo-nts-db.service.ts +72 -48
- package/src/_services/dynamo-nts-email.service.ts +4 -4
- package/src/_services/dynamo-nts-global.service.ts +9 -2
- package/src/_services/dynamo-nts-routing-module.service.ts +3 -3
- package/src/_services/dynamo-nts-shared.service.ts +9 -0
- package/src/_services/dynamo-nts-socket-service-collection.service.ts +1 -1
- package/src/_services/dynamo-nts-socket.service.ts +27 -27
|
@@ -5,7 +5,44 @@ import { DynamoNTS_Shared } from './dynamo-nts-shared.service';
|
|
|
5
5
|
import { DynamoNTS_SingletonService } from './dynamo-nts-singleton.service';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
+
* Basic controller for endpoint handlings
|
|
8
9
|
*
|
|
10
|
+
* @example
|
|
11
|
+
* export class UserMatchStatisticsController extends DynamoNTS_Controller {
|
|
12
|
+
*
|
|
13
|
+
* static getInstance(): UserMatchStatisticsController {
|
|
14
|
+
* return UserMatchStatisticsController.getSingletonInstance();
|
|
15
|
+
* }
|
|
16
|
+
*
|
|
17
|
+
* // SERVICES
|
|
18
|
+
* private authService: AuthService;
|
|
19
|
+
*
|
|
20
|
+
* setupEndpoints(): void {
|
|
21
|
+
* this.authService = AuthService.getInstance();
|
|
22
|
+
*
|
|
23
|
+
* this.endpoints = [
|
|
24
|
+
* new DynamoNTS_EndpointParams({
|
|
25
|
+
* name: 'getUserMatchStatistics',
|
|
26
|
+
* type: HttpCallType.get,
|
|
27
|
+
* endpoint: '/get/user-match-statistics/:userId',
|
|
28
|
+
* preProcessess: [ this.authService.authenticateTokenSelf ],
|
|
29
|
+
* tasks: [
|
|
30
|
+
* async (req: Request, res: Response) => {
|
|
31
|
+
* const userMatchStatistics = new UserMatchStatisticsService({
|
|
32
|
+
* data: { userId: req.params.userId }
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* await userMatchStatistics.getDataByDependencyId();
|
|
36
|
+
*
|
|
37
|
+
* res.send(
|
|
38
|
+
* userMatchStatistics.data
|
|
39
|
+
* );
|
|
40
|
+
* }
|
|
41
|
+
* ]
|
|
42
|
+
* }),
|
|
43
|
+
* ];
|
|
44
|
+
* }
|
|
45
|
+
* }
|
|
9
46
|
*/
|
|
10
47
|
export abstract class DynamoNTS_Controller extends DynamoNTS_SingletonService {
|
|
11
48
|
|
|
@@ -4,6 +4,25 @@ import { Metadata, DynamoNTS_DataParams, DynamoNTS_DataPropertyParams, DynamoNTS
|
|
|
4
4
|
import { DynamoNTS_DBService } from './dynamo-nts-db.service';
|
|
5
5
|
import { DynamoNTS_GlobalService } from './dynamo-nts-global.service';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Basic Data Service that is connected to the relevant DBServices
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* export class UserMatchStatisticsService extends DynamoNTS_DataService<UserMatchStatistics> {
|
|
12
|
+
* constructor(
|
|
13
|
+
* set?: {
|
|
14
|
+
* data?: UserMatchStatistics,
|
|
15
|
+
* issuer?: string,
|
|
16
|
+
* }
|
|
17
|
+
* ) {
|
|
18
|
+
* super(
|
|
19
|
+
* new UserMatchStatistics(set?.data),
|
|
20
|
+
* userMatchStatisticsModelParams
|
|
21
|
+
* );
|
|
22
|
+
* this.issuer = set?.issuer;
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
*/
|
|
7
26
|
export class DynamoNTS_DataService<T extends Metadata> {
|
|
8
27
|
dataDBService: DynamoNTS_DBService<T>;
|
|
9
28
|
data: T;
|
|
@@ -39,8 +58,9 @@ export class DynamoNTS_DataService<T extends Metadata> {
|
|
|
39
58
|
});
|
|
40
59
|
} catch (error) {
|
|
41
60
|
throw new DynamoNTS_Error({
|
|
42
|
-
status: 417,
|
|
43
|
-
|
|
61
|
+
status: 417,
|
|
62
|
+
message: 'getAll was unsuccessful',
|
|
63
|
+
userMessage: `We encountered a DB Error, please contact the responsible development team. \nerrorCode: 744-234-130`,
|
|
44
64
|
error: error
|
|
45
65
|
});
|
|
46
66
|
}
|
|
@@ -62,15 +82,17 @@ export class DynamoNTS_DataService<T extends Metadata> {
|
|
|
62
82
|
return dataExists;
|
|
63
83
|
} else {
|
|
64
84
|
throw new DynamoNTS_Error({
|
|
65
|
-
status: 417,
|
|
66
|
-
|
|
85
|
+
status: 417,
|
|
86
|
+
message: `ID is missing! (maybe you wanted to use getDataByDependencyId instead...)`,
|
|
87
|
+
userMessage: `We encountered a DB Error, please contact the responsible development team. \nerrorCode: 744-234-131B`,
|
|
67
88
|
error: new Error()
|
|
68
89
|
});
|
|
69
90
|
}
|
|
70
91
|
} catch (error) {
|
|
71
92
|
throw new DynamoNTS_Error({
|
|
72
|
-
status: 417,
|
|
73
|
-
|
|
93
|
+
status: 417,
|
|
94
|
+
message: 'getDataById was unsuccessful',
|
|
95
|
+
userMessage: `We encountered a DB Error, please contact the responsible development team. \nerrorCode: 744-234-131A`,
|
|
74
96
|
error: error
|
|
75
97
|
});
|
|
76
98
|
}
|
|
@@ -94,22 +116,25 @@ export class DynamoNTS_DataService<T extends Metadata> {
|
|
|
94
116
|
return dataExists;
|
|
95
117
|
} else {
|
|
96
118
|
throw new DynamoNTS_Error({
|
|
97
|
-
status: 417,
|
|
98
|
-
|
|
119
|
+
status: 417,
|
|
120
|
+
message: `${this.depKey} is missing!`,
|
|
121
|
+
userMessage: `We encountered a DB Error, please contact the responsible development team. \nerrorCode: 744-234-132C`,
|
|
99
122
|
error: new Error()
|
|
100
123
|
});
|
|
101
124
|
}
|
|
102
125
|
} else {
|
|
103
126
|
throw new DynamoNTS_Error({
|
|
104
|
-
status: 417,
|
|
105
|
-
|
|
127
|
+
status: 417,
|
|
128
|
+
message: 'dependencyDataIdKey is missing from service!',
|
|
129
|
+
userMessage: `We encountered a DB Error, please contact the responsible development team. \nerrorCode: 744-234-132B`,
|
|
106
130
|
error: new Error()
|
|
107
131
|
});
|
|
108
132
|
}
|
|
109
133
|
} catch (error) {
|
|
110
134
|
throw new DynamoNTS_Error({
|
|
111
|
-
status: 417,
|
|
112
|
-
|
|
135
|
+
status: 417,
|
|
136
|
+
message: 'getDataByDependencyId was unsuccessful',
|
|
137
|
+
userMessage: `We encountered a DB Error, please contact the responsible development team. \nerrorCode: 744-234-132A`,
|
|
113
138
|
error: error
|
|
114
139
|
});
|
|
115
140
|
}
|
|
@@ -128,22 +153,24 @@ export class DynamoNTS_DataService<T extends Metadata> {
|
|
|
128
153
|
});
|
|
129
154
|
} else {
|
|
130
155
|
throw new DynamoNTS_Error({
|
|
131
|
-
status: 417,
|
|
132
|
-
|
|
156
|
+
status: 417,
|
|
157
|
+
message: `${this.depKey} is missing!`,
|
|
158
|
+
userMessage: `We encountered a DB Error, please contact the responsible development team. \nerrorCode: 744-234-133C`,
|
|
133
159
|
error: new Error()
|
|
134
160
|
});
|
|
135
161
|
}
|
|
136
162
|
} else {
|
|
137
163
|
throw new DynamoNTS_Error({
|
|
138
|
-
status: 417,
|
|
139
|
-
|
|
164
|
+
status: 417,
|
|
165
|
+
message: 'dependencyDataIdKey is missing from service!',
|
|
166
|
+
userMessage: `We encountered a DB Error, please contact the responsible development team. \nerrorCode: 744-234-133B`,
|
|
140
167
|
error: new Error()
|
|
141
168
|
});
|
|
142
169
|
}
|
|
143
170
|
} catch (error) {
|
|
144
171
|
throw new DynamoNTS_Error({ status: 417,
|
|
145
172
|
message: 'getDataListByDependencyId was unsuccessful',
|
|
146
|
-
userMessage: `We encountered a DB Error, please contact the responsible development team.
|
|
173
|
+
userMessage: `We encountered a DB Error, please contact the responsible development team. \nerrorCode: 744-234-133A`,
|
|
147
174
|
error: error
|
|
148
175
|
});
|
|
149
176
|
}
|
|
@@ -171,16 +198,18 @@ export class DynamoNTS_DataService<T extends Metadata> {
|
|
|
171
198
|
dependencyExists = !!dep;
|
|
172
199
|
});
|
|
173
200
|
if (!dependencyExists) {
|
|
174
|
-
throw new DynamoNTS_Error({
|
|
201
|
+
throw new DynamoNTS_Error({
|
|
202
|
+
status: 417,
|
|
175
203
|
message: `saveData was unsuccessful: dependency data not exists (key: ${this.depKey}, id: ${this.data[this.depKey]})`,
|
|
176
|
-
userMessage: `We encountered a DB Error, please contact the responsible development team.
|
|
204
|
+
userMessage: `We encountered a DB Error, please contact the responsible development team. \nerrorCode: 744-234-333A`,
|
|
177
205
|
error: new Error()
|
|
178
206
|
});
|
|
179
207
|
}
|
|
180
208
|
} else {
|
|
181
|
-
throw new DynamoNTS_Error({
|
|
209
|
+
throw new DynamoNTS_Error({
|
|
210
|
+
status: 417,
|
|
182
211
|
message: `saveData was unsuccessful: dependency data id missing from data (key: ${this.depKey})`,
|
|
183
|
-
userMessage: `We encountered a DB Error, please contact the responsible development team.
|
|
212
|
+
userMessage: `We encountered a DB Error, please contact the responsible development team. \nerrorCode: 744-234-333B`,
|
|
184
213
|
error: new Error()
|
|
185
214
|
});
|
|
186
215
|
}
|
|
@@ -203,8 +232,9 @@ export class DynamoNTS_DataService<T extends Metadata> {
|
|
|
203
232
|
}
|
|
204
233
|
} catch (error) {
|
|
205
234
|
throw new DynamoNTS_Error({
|
|
206
|
-
status: 417,
|
|
207
|
-
|
|
235
|
+
status: 417,
|
|
236
|
+
message: `modifyData was unsuccessful (${this.dataParams.dataName})`,
|
|
237
|
+
userMessage: `We encountered a DB Error, please contact the responsible development team. \nerrorCode: 744-234-222`,
|
|
208
238
|
error: error
|
|
209
239
|
});
|
|
210
240
|
}
|
|
@@ -222,8 +252,9 @@ export class DynamoNTS_DataService<T extends Metadata> {
|
|
|
222
252
|
}
|
|
223
253
|
} catch (error) {
|
|
224
254
|
throw new DynamoNTS_Error({
|
|
225
|
-
status: 417,
|
|
226
|
-
|
|
255
|
+
status: 417,
|
|
256
|
+
message: 'deleteData was unsuccessful',
|
|
257
|
+
userMessage: `We encountered a DB Error, please contact the responsible development team. \nerrorCode: 744-234-223`,
|
|
227
258
|
error: error
|
|
228
259
|
});
|
|
229
260
|
}
|
|
@@ -238,11 +269,17 @@ export class DynamoNTS_DataService<T extends Metadata> {
|
|
|
238
269
|
// basic required validations
|
|
239
270
|
if ((this.dataParams.modelParams[i].required && (this.data[this.dataParams.modelParams[i].key] === null || this.data[this.dataParams.modelParams[i].key] === undefined)) ||
|
|
240
271
|
(this.dataParams.modelParams[i].index && (this.data[this.dataParams.modelParams[i].key] === null || this.data[this.dataParams.modelParams[i].key] === undefined))) {
|
|
241
|
-
throw new DynamoNTS_Error({
|
|
272
|
+
throw new DynamoNTS_Error({
|
|
273
|
+
status: 422,
|
|
274
|
+
message: `${this.dataParams.modelParams[i].key} is missing! (${this.dataParams.modelParams[i].required ? 'required' : 'index'})`
|
|
275
|
+
});
|
|
242
276
|
}
|
|
243
277
|
// specific Date validation
|
|
244
278
|
if (this.dataParams.modelParams[i].type === 'Date' && !(new Date(this.data[this.dataParams.modelParams[i].key]) instanceof Date)) {
|
|
245
|
-
throw new DynamoNTS_Error({
|
|
279
|
+
throw new DynamoNTS_Error({
|
|
280
|
+
status: 422,
|
|
281
|
+
message: `${this.dataParams.modelParams[i].key} is not a date!`
|
|
282
|
+
});
|
|
246
283
|
}
|
|
247
284
|
// call additional validators
|
|
248
285
|
if (this.dataParams.modelParams[i].additionalValidators) {
|
|
@@ -253,8 +290,9 @@ export class DynamoNTS_DataService<T extends Metadata> {
|
|
|
253
290
|
}
|
|
254
291
|
} catch (error) {
|
|
255
292
|
throw new DynamoNTS_Error({
|
|
256
|
-
status: 422,
|
|
257
|
-
|
|
293
|
+
status: 422,
|
|
294
|
+
message: 'validateForSave was unsuccessful',
|
|
295
|
+
userMessage: `We encountered a DB Error, please contact the responsible development team. \nerrorCode: 744-234-220`,
|
|
258
296
|
error: error
|
|
259
297
|
});
|
|
260
298
|
}
|
|
@@ -282,8 +320,9 @@ export class DynamoNTS_DataService<T extends Metadata> {
|
|
|
282
320
|
return DynamoNTS_GlobalService.getDBService(this.dataParams);
|
|
283
321
|
} else {
|
|
284
322
|
throw new DynamoNTS_Error({
|
|
285
|
-
status: 501,
|
|
286
|
-
|
|
323
|
+
status: 501,
|
|
324
|
+
message: 'getDependencyDataDBService was unsuccessful, service key not setted up!',
|
|
325
|
+
userMessage: `We encountered a DB Error, please contact the responsible development team. \nerrorCode: 744-234-200`,
|
|
287
326
|
error: new Error()
|
|
288
327
|
});
|
|
289
328
|
}
|
|
@@ -40,15 +40,17 @@ export class DynamoNTS_DBService<T extends Metadata> {
|
|
|
40
40
|
newData = res.toObject() as T;
|
|
41
41
|
} else {
|
|
42
42
|
throw new DynamoNTS_Error({
|
|
43
|
-
status: 204,
|
|
44
|
-
|
|
43
|
+
status: 204,
|
|
44
|
+
message: `${this.dataParams.dbName} not found! (BD)`,
|
|
45
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-401`,
|
|
45
46
|
error: new Error()
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
49
|
}).catch(error => {
|
|
49
50
|
throw new DynamoNTS_Error({
|
|
50
|
-
status: 422,
|
|
51
|
-
|
|
51
|
+
status: 422,
|
|
52
|
+
message: `Create new ${this.dataParams.dbName} was unsuccessful (BD)`,
|
|
53
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-400`,
|
|
52
54
|
error
|
|
53
55
|
});
|
|
54
56
|
});
|
|
@@ -75,15 +77,17 @@ export class DynamoNTS_DBService<T extends Metadata> {
|
|
|
75
77
|
newData = res.toObject() as T;
|
|
76
78
|
} else {
|
|
77
79
|
throw new DynamoNTS_Error({
|
|
78
|
-
status: 204,
|
|
79
|
-
|
|
80
|
+
status: 204,
|
|
81
|
+
message: `${this.dataParams.dbName} not found! (BD)`,
|
|
82
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-411`,
|
|
80
83
|
error: new Error()
|
|
81
84
|
});
|
|
82
85
|
}
|
|
83
86
|
}).catch(error => {
|
|
84
87
|
throw new DynamoNTS_Error({
|
|
85
|
-
status: 417,
|
|
86
|
-
|
|
88
|
+
status: 417,
|
|
89
|
+
message: `modify ${this.dataParams.dbName} was unsuccessful (DB)`,
|
|
90
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-410`,
|
|
87
91
|
error
|
|
88
92
|
});
|
|
89
93
|
});
|
|
@@ -106,8 +110,9 @@ export class DynamoNTS_DBService<T extends Metadata> {
|
|
|
106
110
|
}
|
|
107
111
|
}).catch(error => {
|
|
108
112
|
throw new DynamoNTS_Error({
|
|
109
|
-
status: 417,
|
|
110
|
-
|
|
113
|
+
status: 417,
|
|
114
|
+
message: `get ${this.dataParams.dbName} by ID was unsuccessful (DB)`,
|
|
115
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-430`,
|
|
111
116
|
error
|
|
112
117
|
});
|
|
113
118
|
});
|
|
@@ -133,8 +138,9 @@ export class DynamoNTS_DBService<T extends Metadata> {
|
|
|
133
138
|
}
|
|
134
139
|
}).catch(error => {
|
|
135
140
|
throw new DynamoNTS_Error({
|
|
136
|
-
status: 417,
|
|
137
|
-
|
|
141
|
+
status: 417,
|
|
142
|
+
message: `get ${this.dataParams.dbName} by ${this.depDataName} was unsuccessful (DB)`,
|
|
143
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-441`,
|
|
138
144
|
error
|
|
139
145
|
});
|
|
140
146
|
});
|
|
@@ -144,8 +150,9 @@ export class DynamoNTS_DBService<T extends Metadata> {
|
|
|
144
150
|
return data;
|
|
145
151
|
} else {
|
|
146
152
|
throw new DynamoNTS_Error({
|
|
147
|
-
status: 501,
|
|
148
|
-
|
|
153
|
+
status: 501,
|
|
154
|
+
message: `dependencyDataIdKey not setted up for this db-service (${this.dataParams.dbName}) (BD)`,
|
|
155
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-440`,
|
|
149
156
|
error: new Error()
|
|
150
157
|
});
|
|
151
158
|
}
|
|
@@ -165,8 +172,9 @@ export class DynamoNTS_DBService<T extends Metadata> {
|
|
|
165
172
|
}
|
|
166
173
|
}).catch(error => {
|
|
167
174
|
throw new DynamoNTS_Error({
|
|
168
|
-
status: 417,
|
|
169
|
-
|
|
175
|
+
status: 417,
|
|
176
|
+
message: `get ${this.dataParams.dbName} by ${this.depDataName} was unsuccessful (DB)`,
|
|
177
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-451`,
|
|
170
178
|
error
|
|
171
179
|
});
|
|
172
180
|
});
|
|
@@ -178,8 +186,9 @@ export class DynamoNTS_DBService<T extends Metadata> {
|
|
|
178
186
|
return dataList;
|
|
179
187
|
} else {
|
|
180
188
|
throw new DynamoNTS_Error({
|
|
181
|
-
status: 501,
|
|
182
|
-
|
|
189
|
+
status: 501,
|
|
190
|
+
message: `dependencyDataIdKey not setted up for this db-service (${this.dataParams.dbName}) (BD)`,
|
|
191
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-450`,
|
|
183
192
|
error: new Error()
|
|
184
193
|
});
|
|
185
194
|
}
|
|
@@ -199,16 +208,18 @@ export class DynamoNTS_DBService<T extends Metadata> {
|
|
|
199
208
|
}
|
|
200
209
|
}).catch(error => {
|
|
201
210
|
throw new DynamoNTS_Error({
|
|
202
|
-
status: 417,
|
|
203
|
-
|
|
211
|
+
status: 417,
|
|
212
|
+
message: `get ${this.dataParams.dbName}s by ${this.depDataName}s was unsuccessful (DB)`,
|
|
213
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-461`,
|
|
204
214
|
error
|
|
205
215
|
});
|
|
206
216
|
});
|
|
207
217
|
return dataList;
|
|
208
218
|
} else {
|
|
209
219
|
throw new DynamoNTS_Error({
|
|
210
|
-
status: 501,
|
|
211
|
-
|
|
220
|
+
status: 501,
|
|
221
|
+
message: `dependencyDataIdKey not setted up for this db-service (${this.dataParams.dbName}) (BD)`,
|
|
222
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-460`,
|
|
212
223
|
error: new Error()
|
|
213
224
|
});
|
|
214
225
|
}
|
|
@@ -229,8 +240,9 @@ export class DynamoNTS_DBService<T extends Metadata> {
|
|
|
229
240
|
filter[this.depDataName] = { $in: narrowByDependencyIds };
|
|
230
241
|
} else {
|
|
231
242
|
throw new DynamoNTS_Error({
|
|
232
|
-
status: 501,
|
|
233
|
-
|
|
243
|
+
status: 501,
|
|
244
|
+
message: `dependencyDataIdKey not setted up for this db-service (${this.dataParams.dbName}) (BD)`,
|
|
245
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-470`,
|
|
234
246
|
error: new Error()
|
|
235
247
|
});
|
|
236
248
|
}
|
|
@@ -280,8 +292,9 @@ export class DynamoNTS_DBService<T extends Metadata> {
|
|
|
280
292
|
}
|
|
281
293
|
}).catch(error => {
|
|
282
294
|
throw new DynamoNTS_Error({
|
|
283
|
-
status: 417,
|
|
284
|
-
|
|
295
|
+
status: 417,
|
|
296
|
+
message: `search ${this.dataParams.dbName} was unsuccessful (DB)`,
|
|
297
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-471`,
|
|
285
298
|
error
|
|
286
299
|
});
|
|
287
300
|
});
|
|
@@ -333,8 +346,9 @@ export class DynamoNTS_DBService<T extends Metadata> {
|
|
|
333
346
|
}
|
|
334
347
|
}).catch(error => {
|
|
335
348
|
throw new DynamoNTS_Error({
|
|
336
|
-
status: 417,
|
|
337
|
-
|
|
349
|
+
status: 417,
|
|
350
|
+
message: `get all ${this.dataParams.dbName} was unsuccessful (DB)`,
|
|
351
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-480`,
|
|
338
352
|
error
|
|
339
353
|
});
|
|
340
354
|
});
|
|
@@ -353,8 +367,9 @@ export class DynamoNTS_DBService<T extends Metadata> {
|
|
|
353
367
|
async deleteDataById(id: string): Promise<void> {
|
|
354
368
|
await this.dataModel.findByIdAndDelete(id).catch(error => {
|
|
355
369
|
throw new DynamoNTS_Error({
|
|
356
|
-
status: 417,
|
|
357
|
-
|
|
370
|
+
status: 417,
|
|
371
|
+
message: `delete ${this.dataParams.dbName} was unsuccessful (DB)`,
|
|
372
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-490`,
|
|
358
373
|
error
|
|
359
374
|
});
|
|
360
375
|
});
|
|
@@ -368,15 +383,17 @@ export class DynamoNTS_DBService<T extends Metadata> {
|
|
|
368
383
|
if (this.depDataName) {
|
|
369
384
|
await this.dataModel.deleteMany({ [this.depDataName]: dependencyId }).catch(error => {
|
|
370
385
|
throw new DynamoNTS_Error({
|
|
371
|
-
status: 417,
|
|
372
|
-
|
|
386
|
+
status: 417,
|
|
387
|
+
message: `delete ${this.dataParams.dbName} by ${this.depDataName} was unsuccessful (DB)`,
|
|
388
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-591`,
|
|
373
389
|
error
|
|
374
390
|
});
|
|
375
391
|
});
|
|
376
392
|
} else {
|
|
377
393
|
throw new DynamoNTS_Error({
|
|
378
|
-
status: 501,
|
|
379
|
-
|
|
394
|
+
status: 501,
|
|
395
|
+
message: `dependencyDataIdKey not setted up for this db-service (${this.dataParams.dbName}) (BD)`,
|
|
396
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-590`,
|
|
380
397
|
error: new Error()
|
|
381
398
|
});
|
|
382
399
|
}
|
|
@@ -416,8 +433,9 @@ export class DynamoNTS_DBService<T extends Metadata> {
|
|
|
416
433
|
}
|
|
417
434
|
}).catch(error => {
|
|
418
435
|
throw new DynamoNTS_Error({
|
|
419
|
-
status: 417,
|
|
420
|
-
|
|
436
|
+
status: 417,
|
|
437
|
+
message: `findOne ${this.dataParams.dbName} was unsuccessful (DB)`,
|
|
438
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-510`,
|
|
421
439
|
error
|
|
422
440
|
});
|
|
423
441
|
});
|
|
@@ -453,8 +471,9 @@ export class DynamoNTS_DBService<T extends Metadata> {
|
|
|
453
471
|
}
|
|
454
472
|
}).catch(error => {
|
|
455
473
|
throw new DynamoNTS_Error({
|
|
456
|
-
status: 417,
|
|
457
|
-
|
|
474
|
+
status: 417,
|
|
475
|
+
message: `find ${this.dataParams.dbName} was unsuccessful (DB)`,
|
|
476
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-520`,
|
|
458
477
|
error
|
|
459
478
|
});
|
|
460
479
|
});
|
|
@@ -499,8 +518,9 @@ export class DynamoNTS_DBService<T extends Metadata> {
|
|
|
499
518
|
}
|
|
500
519
|
}).catch(error => {
|
|
501
520
|
throw new DynamoNTS_Error({
|
|
502
|
-
status: 417,
|
|
503
|
-
|
|
521
|
+
status: 417,
|
|
522
|
+
message: `findWithPaging ${this.dataParams.dbName} was unsuccessful (DB)`,
|
|
523
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-530`,
|
|
504
524
|
error
|
|
505
525
|
});
|
|
506
526
|
});
|
|
@@ -527,15 +547,17 @@ export class DynamoNTS_DBService<T extends Metadata> {
|
|
|
527
547
|
data = res.toObject() as T;
|
|
528
548
|
} else {
|
|
529
549
|
throw new DynamoNTS_Error({
|
|
530
|
-
status: 204,
|
|
531
|
-
|
|
550
|
+
status: 204,
|
|
551
|
+
message: `${this.dataParams.dbName} not found! (BD)`,
|
|
552
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-541`,
|
|
532
553
|
error: new Error()
|
|
533
554
|
});
|
|
534
555
|
}
|
|
535
556
|
}).catch(error => {
|
|
536
557
|
throw new DynamoNTS_Error({
|
|
537
|
-
status: 417,
|
|
538
|
-
|
|
558
|
+
status: 417,
|
|
559
|
+
message: `findByIdAndUpdate ${this.dataParams.dbName} was unsuccessful (DB)`,
|
|
560
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-540`,
|
|
539
561
|
error
|
|
540
562
|
});
|
|
541
563
|
});
|
|
@@ -580,8 +602,9 @@ export class DynamoNTS_DBService<T extends Metadata> {
|
|
|
580
602
|
update.__lastModifiedBy = modifier;
|
|
581
603
|
await this.dataModel.updateOne(updateBy, update).catch(error => {
|
|
582
604
|
throw new DynamoNTS_Error({
|
|
583
|
-
status: 417,
|
|
584
|
-
|
|
605
|
+
status: 417,
|
|
606
|
+
message: `updateOne ${this.dataParams.dbName} was unsuccessful (DB)`,
|
|
607
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-550`,
|
|
585
608
|
error
|
|
586
609
|
});
|
|
587
610
|
});
|
|
@@ -623,8 +646,9 @@ export class DynamoNTS_DBService<T extends Metadata> {
|
|
|
623
646
|
update.__lastModifiedBy = modifier;
|
|
624
647
|
await this.dataModel.updateMany(updateBy, update).catch(error => {
|
|
625
648
|
throw new DynamoNTS_Error({
|
|
626
|
-
status: 417,
|
|
627
|
-
|
|
649
|
+
status: 417,
|
|
650
|
+
message: `updateMany ${this.dataParams.dbName} was unsuccessful (DB)`,
|
|
651
|
+
userMessage: `We encountered an unhandled DB Error, please contact the responsible development team. \nerrorCode: 505-223-560`,
|
|
628
652
|
error
|
|
629
653
|
});
|
|
630
654
|
});
|
|
@@ -89,7 +89,7 @@ export class DynamoNTS_EmailService {
|
|
|
89
89
|
if (!this.templates[set.useTemplate]) {
|
|
90
90
|
throw new DynamoNTS_Error({
|
|
91
91
|
message: `no template found with this parameter! (${set.useTemplate})`,
|
|
92
|
-
userMessage: `We encountered an uncought BackEnd Email Service Error, please contact the responsible development team.
|
|
92
|
+
userMessage: `We encountered an uncought BackEnd Email Service Error, please contact the responsible development team. \nerrorCode: 701-114-101`,
|
|
93
93
|
error: new Error()
|
|
94
94
|
});
|
|
95
95
|
}
|
|
@@ -104,7 +104,7 @@ export class DynamoNTS_EmailService {
|
|
|
104
104
|
DynamoNTS_Shared.logError('\nDynamoBEEmailService ERROR: INVALID sendEmail settings', set);
|
|
105
105
|
throw new DynamoNTS_Error({
|
|
106
106
|
message: `templateProperties missing! properties needed: ${props}`,
|
|
107
|
-
userMessage: `We encountered an uncought BackEnd Email Service Error, please contact the responsible development team.
|
|
107
|
+
userMessage: `We encountered an uncought BackEnd Email Service Error, please contact the responsible development team. \nerrorCode: 701-114-102`,
|
|
108
108
|
error: new Error()
|
|
109
109
|
});
|
|
110
110
|
}
|
|
@@ -119,7 +119,7 @@ export class DynamoNTS_EmailService {
|
|
|
119
119
|
} else {
|
|
120
120
|
throw new DynamoNTS_Error({
|
|
121
121
|
message: 'no content setting passsed to emailSending!',
|
|
122
|
-
userMessage: `We encountered an uncought BackEnd Email Service Error, please contact the responsible development team.
|
|
122
|
+
userMessage: `We encountered an uncought BackEnd Email Service Error, please contact the responsible development team. \nerrorCode: 701-114-100`,
|
|
123
123
|
error: new Error()
|
|
124
124
|
});
|
|
125
125
|
}
|
|
@@ -197,7 +197,7 @@ export class DynamoNTS_EmailService {
|
|
|
197
197
|
DynamoNTS_Shared.logError(`\nDynamoBEEmailService ERROR, missing closing tag from email template! (${propertyOpenTagIndex} -)`, propertyKeys);
|
|
198
198
|
throw new DynamoNTS_Error({
|
|
199
199
|
message: `ERROR, missing closing tag from email template! (${propertyOpenTagIndex} -)`,
|
|
200
|
-
userMessage: `We encountered an uncought BackEnd Email Service Error, please contact the responsible development team.
|
|
200
|
+
userMessage: `We encountered an uncought BackEnd Email Service Error, please contact the responsible development team. \nerrorCode: 701-114-200`,
|
|
201
201
|
error: new Error()
|
|
202
202
|
});
|
|
203
203
|
}
|
|
@@ -79,6 +79,7 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
79
79
|
`\nPlease create a Unique Authentication Service extending DynamoNTS_AuthService, ` +
|
|
80
80
|
`and Setup with "DBE_Global_SC.setServices(...)"`);
|
|
81
81
|
}
|
|
82
|
+
|
|
82
83
|
return this.instance.authService;
|
|
83
84
|
}
|
|
84
85
|
|
|
@@ -93,6 +94,7 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
93
94
|
`\nPlease create a Unique DataBase Service Collection extending DynamoNTS_DBServiceCollection, ` +
|
|
94
95
|
`and Setup with "DBE_Global_SC.setServices(...)"`);
|
|
95
96
|
}
|
|
97
|
+
|
|
96
98
|
return this.instance.dbServiceCollection;
|
|
97
99
|
}
|
|
98
100
|
|
|
@@ -117,6 +119,7 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
117
119
|
} else {
|
|
118
120
|
let keys: string = `${Object.keys(collection)}`;
|
|
119
121
|
keys = keys.replace(/,/g, '\n ');
|
|
122
|
+
|
|
120
123
|
throw new Error(
|
|
121
124
|
`\nDBE_Global_S.getDBService failed, ERROR:
|
|
122
125
|
no dbService on collection with this key: ${key}!
|
|
@@ -136,6 +139,7 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
136
139
|
`\nPlease create a Unique Email Service Collection extending DynamoBEEmailServiceCollection, ` +
|
|
137
140
|
`and Setup with "DBE_Global_SC.setServices(...)"`);
|
|
138
141
|
}
|
|
142
|
+
|
|
139
143
|
return this.instance.emailServiceCollection;
|
|
140
144
|
}
|
|
141
145
|
|
|
@@ -151,6 +155,7 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
151
155
|
`in the setupModules in the App using DynamoNTS_AppExtended, ` +
|
|
152
156
|
`and Setup with "DBE_Global_SC.setServices(...)"`);
|
|
153
157
|
}
|
|
158
|
+
|
|
154
159
|
return this.instance.socketServiceCollection;
|
|
155
160
|
}
|
|
156
161
|
|
|
@@ -159,13 +164,14 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
159
164
|
* @param name
|
|
160
165
|
* @returns
|
|
161
166
|
*/
|
|
162
|
-
static getSocketServiceByName(name: string): DynamoNTS_SocketService {
|
|
167
|
+
static getSocketServiceByName(name: string): DynamoNTS_SocketService<any> {
|
|
163
168
|
const collection = this.getSocketServiceCollection();
|
|
164
169
|
if (collection[name]) {
|
|
165
170
|
return collection[name];
|
|
166
171
|
} else {
|
|
167
172
|
let names: string = `${Object.keys(collection)}`;
|
|
168
173
|
names = names.replace(/,/g, '\n ');
|
|
174
|
+
|
|
169
175
|
throw new Error(
|
|
170
176
|
`\nDBE_Global_S.getSocketServiceByName failed, ERROR:
|
|
171
177
|
no socketService on collection with this name: ${name}!
|
|
@@ -174,13 +180,14 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
174
180
|
}
|
|
175
181
|
}
|
|
176
182
|
|
|
177
|
-
static attachNewSocketService(service: DynamoNTS_SocketService): void {
|
|
183
|
+
static attachNewSocketService(service: DynamoNTS_SocketService<any>): void {
|
|
178
184
|
const collection = this.getSocketServiceCollection();
|
|
179
185
|
if (!collection[service.name]) {
|
|
180
186
|
collection[service.name] = service;
|
|
181
187
|
} else {
|
|
182
188
|
let names: string = `${Object.keys(collection)}`;
|
|
183
189
|
names = names.replace(/,/g, '\n ');
|
|
190
|
+
|
|
184
191
|
throw new Error(
|
|
185
192
|
`\nDBE_Global_S.attachNewSocketService failed, ERROR:
|
|
186
193
|
socketService name is already taken on collection with this name: ${service.name}!
|