@futdevpro/nts-dynamo 1.7.28 → 1.8.5
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/_constants/global-settings.const.d.ts +2 -2
- package/lib/_constants/global-settings.const.d.ts.map +1 -1
- package/lib/_constants/global-settings.const.js +2 -2
- package/lib/_constants/global-settings.const.js.map +1 -1
- package/lib/_constants/mocks/app-extended-server.mock.d.ts +12 -12
- package/lib/_constants/mocks/app-extended-server.mock.d.ts.map +1 -1
- package/lib/_constants/mocks/app-extended-server.mock.js +16 -16
- package/lib/_constants/mocks/app-extended-server.mock.js.map +1 -1
- package/lib/_constants/mocks/app-params.mock.d.ts +2 -2
- package/lib/_constants/mocks/app-params.mock.d.ts.map +1 -1
- package/lib/_constants/mocks/app-params.mock.js +1 -1
- package/lib/_constants/mocks/app-params.mock.js.map +1 -1
- package/lib/_constants/mocks/app-server.mock.d.ts +15 -15
- package/lib/_constants/mocks/app-server.mock.d.ts.map +1 -1
- package/lib/_constants/mocks/app-server.mock.js +10 -10
- package/lib/_constants/mocks/app-server.mock.js.map +1 -1
- package/lib/_constants/mocks/data-model.mock.d.ts +3 -3
- package/lib/_constants/mocks/data-model.mock.d.ts.map +1 -1
- package/lib/_constants/mocks/data-model.mock.js +22 -22
- package/lib/_constants/mocks/data-model.mock.js.map +1 -1
- package/lib/_constants/mocks/email-service-collection.mock.d.ts +2 -2
- package/lib/_constants/mocks/email-service-collection.mock.d.ts.map +1 -1
- package/lib/_constants/mocks/email-service-collection.mock.js +1 -1
- package/lib/_constants/mocks/email-service-collection.mock.js.map +1 -1
- package/lib/_constants/mocks/endpoint.mock.d.ts +8 -8
- package/lib/_constants/mocks/endpoint.mock.d.ts.map +1 -1
- package/lib/_constants/mocks/endpoint.mock.js +18 -18
- package/lib/_constants/mocks/endpoint.mock.js.map +1 -1
- package/lib/_constants/mocks/socket-client.mock.d.ts +2 -2
- package/lib/_constants/mocks/socket-client.mock.d.ts.map +1 -1
- package/lib/_constants/mocks/socket-client.mock.js +1 -1
- package/lib/_constants/mocks/socket-client.mock.js.map +1 -1
- package/lib/_constants/mocks/socket-server.mock.d.ts +2 -2
- package/lib/_constants/mocks/socket-server.mock.d.ts.map +1 -1
- package/lib/_constants/mocks/socket-server.mock.js +1 -1
- package/lib/_constants/mocks/socket-server.mock.js.map +1 -1
- package/lib/_enums/data-model-type.enum.d.ts +1 -0
- package/lib/_enums/data-model-type.enum.d.ts.map +1 -1
- package/lib/_enums/data-model-type.enum.js +1 -0
- package/lib/_enums/data-model-type.enum.js.map +1 -1
- package/lib/_models/control-models/api-call-params.control-model.d.ts +3 -3
- package/lib/_models/control-models/api-call-params.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/api-call-params.control-model.js +5 -5
- package/lib/_models/control-models/api-call-params.control-model.js.map +1 -1
- package/lib/_models/control-models/{app-system-controls.control-model copy.d.ts → app-ext-system-controls.control-model.d.ts} +1 -1
- package/lib/_models/control-models/app-ext-system-controls.control-model.d.ts.map +1 -0
- package/lib/_models/control-models/{app-system-controls.control-model copy.js → app-ext-system-controls.control-model.js} +1 -1
- package/lib/_models/control-models/app-ext-system-controls.control-model.js.map +1 -0
- package/lib/_models/control-models/app-params.control-model.d.ts +2 -2
- package/lib/_models/control-models/app-params.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/app-params.control-model.js +3 -3
- package/lib/_models/control-models/app-params.control-model.js.map +1 -1
- package/lib/_models/control-models/endpoint-params.control-model.d.ts +1 -1
- package/lib/_models/control-models/endpoint-params.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/endpoint-params.control-model.js +8 -8
- package/lib/_models/control-models/endpoint-params.control-model.js.map +1 -1
- package/lib/_models/control-models/http-settings.control-model.d.ts +2 -2
- package/lib/_models/control-models/http-settings.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/http-settings.control-model.js +3 -3
- package/lib/_models/control-models/http-settings.control-model.js.map +1 -1
- package/lib/_models/control-models/socket-client-service-params.control-model.d.ts +2 -2
- package/lib/_models/control-models/socket-client-service-params.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/socket-client-service-params.control-model.js +3 -3
- package/lib/_models/control-models/socket-client-service-params.control-model.js.map +1 -1
- package/lib/_models/control-models/socket-event.control-model.js +4 -4
- package/lib/_models/control-models/socket-presence.control-model.d.ts +12 -0
- package/lib/_models/control-models/socket-presence.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/socket-presence.control-model.js +4 -0
- package/lib/_models/control-models/socket-presence.control-model.js.map +1 -1
- package/lib/_models/control-models/socket-server-service-params.control-model.d.ts +2 -2
- package/lib/_models/control-models/socket-server-service-params.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/socket-server-service-params.control-model.js +4 -4
- package/lib/_models/control-models/socket-server-service-params.control-model.js.map +1 -1
- package/lib/_models/interfaces/certification-settings.interface.d.ts +1 -1
- package/lib/_models/interfaces/certification-settings.interface.d.ts.map +1 -1
- package/lib/_models/interfaces/global-service-settings.interface.d.ts +6 -6
- package/lib/_models/interfaces/global-service-settings.interface.d.ts.map +1 -1
- package/lib/_models/interfaces/global-settings.interface.d.ts +1 -1
- package/lib/_models/interfaces/global-settings.interface.d.ts.map +1 -1
- package/lib/_models/interfaces/routing-module-settings.interface.d.ts +1 -1
- package/lib/_models/interfaces/routing-module-settings.interface.d.ts.map +1 -1
- package/lib/_models/types/db-filter.type.d.ts.map +1 -1
- package/lib/_models/types/db-update.type.d.ts +2 -1
- package/lib/_models/types/db-update.type.d.ts.map +1 -1
- package/lib/_modules/custom-data/custom-data.controller.d.ts +2 -2
- package/lib/_modules/custom-data/custom-data.controller.d.ts.map +1 -1
- package/lib/_modules/custom-data/custom-data.controller.js +18 -16
- package/lib/_modules/custom-data/custom-data.controller.js.map +1 -1
- package/lib/_modules/custom-data/custom-data.data-service.d.ts +1 -1
- package/lib/_modules/custom-data/custom-data.data-service.d.ts.map +1 -1
- package/lib/_modules/custom-data/custom-data.data-service.js +4 -4
- package/lib/_modules/custom-data/custom-data.data-service.js.map +1 -1
- package/lib/_modules/custom-data/get-custom-data-routing-module.util.d.ts +1 -1
- package/lib/_modules/custom-data/get-custom-data-routing-module.util.d.ts.map +1 -1
- package/lib/_modules/custom-data/get-custom-data-routing-module.util.js +5 -5
- package/lib/_modules/custom-data/get-custom-data-routing-module.util.js.map +1 -1
- package/lib/_modules/test/get-test-routing-module.util.d.ts +1 -1
- package/lib/_modules/test/get-test-routing-module.util.d.ts.map +1 -1
- package/lib/_modules/test/get-test-routing-module.util.js +5 -5
- package/lib/_modules/test/get-test-routing-module.util.js.map +1 -1
- package/lib/_modules/test/test.controller.d.ts +2 -2
- package/lib/_modules/test/test.controller.d.ts.map +1 -1
- package/lib/_modules/test/test.controller.js +33 -33
- package/lib/_modules/test/test.controller.js.map +1 -1
- package/lib/_modules/usage/get-usage-routing-module.util.d.ts +1 -1
- package/lib/_modules/usage/get-usage-routing-module.util.d.ts.map +1 -1
- package/lib/_modules/usage/get-usage-routing-module.util.js +5 -5
- package/lib/_modules/usage/get-usage-routing-module.util.js.map +1 -1
- package/lib/_modules/usage/usage.controller.d.ts +2 -2
- package/lib/_modules/usage/usage.controller.d.ts.map +1 -1
- package/lib/_modules/usage/usage.controller.js +16 -16
- package/lib/_modules/usage/usage.controller.js.map +1 -1
- package/lib/_modules/usage/usage.data-service.d.ts +1 -1
- package/lib/_modules/usage/usage.data-service.d.ts.map +1 -1
- package/lib/_modules/usage/usage.data-service.js +4 -4
- package/lib/_modules/usage/usage.data-service.js.map +1 -1
- package/lib/_services/base/data.service.d.ts +3 -3
- package/lib/_services/base/data.service.d.ts.map +1 -1
- package/lib/_services/base/data.service.js +15 -15
- package/lib/_services/base/data.service.js.map +1 -1
- package/lib/_services/base/db.service.d.ts +3 -3
- package/lib/_services/base/db.service.d.ts.map +1 -1
- package/lib/_services/base/db.service.js +10 -6
- package/lib/_services/base/db.service.js.map +1 -1
- package/lib/_services/core/api.service.d.ts +4 -4
- package/lib/_services/core/api.service.d.ts.map +1 -1
- package/lib/_services/core/api.service.js +9 -9
- package/lib/_services/core/api.service.js.map +1 -1
- package/lib/_services/core/email.service.d.ts +4 -4
- package/lib/_services/core/email.service.d.ts.map +1 -1
- package/lib/_services/core/email.service.js.map +1 -1
- package/lib/_services/core/global.service.d.ts +12 -12
- package/lib/_services/core/global.service.d.ts.map +1 -1
- package/lib/_services/core/global.service.js +14 -1
- package/lib/_services/core/global.service.js.map +1 -1
- package/lib/_services/core/service-collection.service.d.ts +1 -1
- package/lib/_services/core/service-collection.service.d.ts.map +1 -1
- package/lib/_services/core/service-collection.service.js +3 -3
- package/lib/_services/core/service-collection.service.js.map +1 -1
- package/lib/_services/route/controller.service.d.ts +2 -2
- package/lib/_services/route/controller.service.d.ts.map +1 -1
- package/lib/_services/route/controller.service.js.map +1 -1
- package/lib/_services/route/routing-module.service.d.ts +4 -4
- package/lib/_services/route/routing-module.service.d.ts.map +1 -1
- package/lib/_services/route/routing-module.service.js +2 -2
- package/lib/_services/route/routing-module.service.js.map +1 -1
- package/lib/_services/server/app-extended.server.d.ts +2 -2
- package/lib/_services/server/app-extended.server.js +5 -5
- package/lib/_services/server/app-extended.server.js.map +1 -1
- package/lib/_services/server/app-extended.server.spec.js +3 -3
- package/lib/_services/server/app-extended.server.spec.js.map +1 -1
- package/lib/_services/server/app.server.d.ts +14 -14
- package/lib/_services/server/app.server.d.ts.map +1 -1
- package/lib/_services/server/app.server.js +8 -8
- package/lib/_services/server/app.server.js.map +1 -1
- package/lib/_services/server/app.server.spec.js +3 -3
- package/lib/_services/server/app.server.spec.js.map +1 -1
- package/lib/_services/shared.static-service.d.ts +3 -3
- package/lib/_services/shared.static-service.d.ts.map +1 -1
- package/lib/_services/shared.static-service.js +1 -1
- package/lib/_services/shared.static-service.js.map +1 -1
- package/lib/_services/socket/socket-client.service.d.ts +3 -3
- package/lib/_services/socket/socket-client.service.d.ts.map +1 -1
- package/lib/_services/socket/socket-client.service.js +24 -18
- package/lib/_services/socket/socket-client.service.js.map +1 -1
- package/lib/_services/socket/socket-server.service.d.ts +3 -3
- package/lib/_services/socket/socket-server.service.d.ts.map +1 -1
- package/lib/_services/socket/socket-server.service.js +5 -5
- package/lib/_services/socket/socket-server.service.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/_constants/global-settings.const.ts +2 -2
- package/src/_constants/mocks/app-extended-server.mock.ts +34 -35
- package/src/_constants/mocks/app-params.mock.ts +2 -2
- package/src/_constants/mocks/app-server.mock.ts +30 -30
- package/src/_constants/mocks/data-model.mock.ts +23 -23
- package/src/_constants/mocks/email-service-collection.mock.ts +2 -2
- package/src/_constants/mocks/endpoint.mock.ts +22 -22
- package/src/_constants/mocks/socket-client.mock.ts +3 -3
- package/src/_constants/mocks/socket-server.mock.ts +3 -3
- package/src/_enums/data-model-type.enum.ts +1 -0
- package/src/_models/control-models/api-call-params.control-model.ts +3 -3
- package/src/_models/control-models/app-params.control-model.ts +2 -2
- package/src/_models/control-models/endpoint-params.control-model.ts +7 -7
- package/src/_models/control-models/http-settings.control-model.ts +2 -2
- package/src/_models/control-models/socket-client-service-params.control-model.ts +2 -2
- package/src/_models/control-models/socket-event.control-model.ts +5 -5
- package/src/_models/control-models/socket-presence.control-model.ts +12 -0
- package/src/_models/control-models/socket-server-service-params.control-model.ts +4 -4
- package/src/_models/interfaces/certification-settings.interface.ts +1 -1
- package/src/_models/interfaces/global-service-settings.interface.ts +6 -6
- package/src/_models/interfaces/global-settings.interface.ts +1 -1
- package/src/_models/interfaces/routing-module-settings.interface.ts +1 -1
- package/src/_models/types/db-filter.type.ts +5 -2
- package/src/_models/types/db-update.type.ts +3 -2
- package/src/_modules/custom-data/custom-data.controller.ts +20 -18
- package/src/_modules/custom-data/custom-data.data-service.ts +6 -4
- package/src/_modules/custom-data/get-custom-data-routing-module.util.ts +7 -7
- package/src/_modules/test/get-test-routing-module.util.ts +7 -7
- package/src/_modules/test/test.controller.ts +34 -34
- package/src/_modules/usage/get-usage-routing-module.util.ts +7 -7
- package/src/_modules/usage/usage.controller.ts +18 -19
- package/src/_modules/usage/usage.data-service.ts +3 -3
- package/src/_services/base/data.service.ts +21 -20
- package/src/_services/base/db.service.ts +15 -12
- package/src/_services/core/api.service.ts +22 -22
- package/src/_services/core/email.service.ts +4 -4
- package/src/_services/core/global.service.ts +29 -15
- package/src/_services/core/service-collection.service.ts +1 -1
- package/src/_services/route/controller.service.ts +2 -2
- package/src/_services/route/routing-module.service.ts +12 -12
- package/src/_services/server/app-extended.server.spec.ts +4 -4
- package/src/_services/server/app-extended.server.ts +5 -5
- package/src/_services/server/app.server.spec.ts +4 -4
- package/src/_services/server/app.server.ts +27 -27
- package/src/_services/shared.static-service.ts +7 -4
- package/src/_services/socket/socket-client.service.ts +69 -37
- package/src/_services/socket/socket-server.service.ts +9 -9
- package/tsconfig.json +1 -0
- package/lib/_models/control-models/app-system-controls.control-model copy.d.ts.map +0 -1
- package/lib/_models/control-models/app-system-controls.control-model copy.js.map +0 -1
- /package/src/_models/control-models/{app-system-controls.control-model copy.ts → app-ext-system-controls.control-model.ts} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
Dynamo_usageModule_settings, Dynamo_UsageSession, Dynamo_RelativeDate
|
|
6
6
|
} from '@futdevpro/fsm-dynamo/usage-module';
|
|
7
7
|
|
|
8
8
|
import { DynamoNTS_HttpCallType } from '../../_enums/http/http-call-type.enum';
|
|
@@ -10,14 +10,14 @@ import { DynamoNTS_AuthService } from '../../_services/core/auth.service';
|
|
|
10
10
|
import { DynamoNTS_Controller } from '../../_services/route/controller.service';
|
|
11
11
|
import { DynamoNTS_GlobalService } from '../../_services/core/global.service';
|
|
12
12
|
import {
|
|
13
|
-
|
|
13
|
+
DynamoNTS_Endpoint_Params
|
|
14
14
|
} from '../../_models/control-models/endpoint-params.control-model';
|
|
15
|
-
import {
|
|
15
|
+
import { DynamoNTS_Usage_DataService } from './usage.data-service';
|
|
16
16
|
|
|
17
|
-
export class
|
|
17
|
+
export class DynamoNTS_Usage_Controller extends DynamoNTS_Controller {
|
|
18
18
|
|
|
19
|
-
static getInstance():
|
|
20
|
-
return
|
|
19
|
+
static getInstance(): DynamoNTS_Usage_Controller {
|
|
20
|
+
return DynamoNTS_Usage_Controller.getSingletonInstance();
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
// SERVICES
|
|
@@ -27,15 +27,15 @@ export class UsageController extends DynamoNTS_Controller {
|
|
|
27
27
|
this.authService = DynamoNTS_GlobalService.getAuthService();
|
|
28
28
|
|
|
29
29
|
this.endpoints = [
|
|
30
|
-
new
|
|
30
|
+
new DynamoNTS_Endpoint_Params({
|
|
31
31
|
name: 'newSession',
|
|
32
32
|
type: DynamoNTS_HttpCallType.get,
|
|
33
|
-
endpoint:
|
|
33
|
+
endpoint: Dynamo_usageModule_settings.endPoints.newSession,
|
|
34
34
|
tasks: [
|
|
35
35
|
async (req: Request, res: Response, issuer: string): Promise<void> => {
|
|
36
36
|
const authService = DynamoNTS_GlobalService.getAuthService();
|
|
37
37
|
const username = authService.getUsernameFromRequest(req);
|
|
38
|
-
const usageService = new
|
|
38
|
+
const usageService = new DynamoNTS_Usage_DataService({
|
|
39
39
|
usageSession: new Dynamo_UsageSession({
|
|
40
40
|
sessionStart: new Date(),
|
|
41
41
|
issuer: username,
|
|
@@ -53,14 +53,14 @@ export class UsageController extends DynamoNTS_Controller {
|
|
|
53
53
|
],
|
|
54
54
|
}),
|
|
55
55
|
|
|
56
|
-
new
|
|
56
|
+
new DynamoNTS_Endpoint_Params({
|
|
57
57
|
name: 'updateUsage',
|
|
58
58
|
type: DynamoNTS_HttpCallType.post,
|
|
59
|
-
endpoint:
|
|
59
|
+
endpoint: Dynamo_usageModule_settings.endPoints.updateUsage,
|
|
60
60
|
logRequestsContent: false,
|
|
61
61
|
tasks: [
|
|
62
62
|
async (req: Request, res: Response, issuer: string): Promise<void> => {
|
|
63
|
-
const usageService = new
|
|
63
|
+
const usageService = new DynamoNTS_Usage_DataService({
|
|
64
64
|
usageSession: { _id: req.params.sessionId },
|
|
65
65
|
usageData: req.body,
|
|
66
66
|
issuer,
|
|
@@ -75,13 +75,13 @@ export class UsageController extends DynamoNTS_Controller {
|
|
|
75
75
|
],
|
|
76
76
|
}),
|
|
77
77
|
|
|
78
|
-
new
|
|
78
|
+
new DynamoNTS_Endpoint_Params({
|
|
79
79
|
name: 'closeSession',
|
|
80
80
|
type: DynamoNTS_HttpCallType.get,
|
|
81
|
-
endpoint:
|
|
81
|
+
endpoint: Dynamo_usageModule_settings.endPoints.closeSession,
|
|
82
82
|
tasks: [
|
|
83
83
|
async (req: Request, res: Response, issuer: string): Promise<void> => {
|
|
84
|
-
const usageService = new
|
|
84
|
+
const usageService = new DynamoNTS_Usage_DataService({
|
|
85
85
|
usageSession: { _id: req.params.sessionId },
|
|
86
86
|
issuer,
|
|
87
87
|
});
|
|
@@ -95,16 +95,16 @@ export class UsageController extends DynamoNTS_Controller {
|
|
|
95
95
|
],
|
|
96
96
|
}),
|
|
97
97
|
|
|
98
|
-
new
|
|
98
|
+
new DynamoNTS_Endpoint_Params({
|
|
99
99
|
name: 'getUsageData',
|
|
100
100
|
type: DynamoNTS_HttpCallType.get,
|
|
101
|
-
endpoint:
|
|
101
|
+
endpoint: Dynamo_usageModule_settings.endPoints.getUsageData,
|
|
102
102
|
preProcessess: [this.authService.authTokenPermAccUsageData],
|
|
103
103
|
tasks: [
|
|
104
104
|
async (req: Request, res: Response): Promise<void> => {
|
|
105
105
|
const range: Dynamo_RelativeDate = req.params.range as Dynamo_RelativeDate;
|
|
106
106
|
|
|
107
|
-
const usageService = new
|
|
107
|
+
const usageService = new DynamoNTS_Usage_DataService();
|
|
108
108
|
|
|
109
109
|
await usageService.getUsage(range);
|
|
110
110
|
|
|
@@ -114,7 +114,6 @@ export class UsageController extends DynamoNTS_Controller {
|
|
|
114
114
|
},
|
|
115
115
|
],
|
|
116
116
|
}),
|
|
117
|
-
|
|
118
117
|
];
|
|
119
118
|
}
|
|
120
119
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
2
|
import { Request } from 'express';
|
|
3
3
|
import { Dynamo_Error, Dynamo_Time, Dynamo_RelativeDate } from '@futdevpro/fsm-dynamo';
|
|
4
|
-
import { Dynamo_UsageSession,
|
|
4
|
+
import { Dynamo_UsageSession, Dynamo_usageSessionModel_params, Dynamo_UsageData,
|
|
5
5
|
Dynamo_DailyUsageData } from '@futdevpro/fsm-dynamo/usage-module';
|
|
6
6
|
|
|
7
7
|
import { DynamoNTS_DataService } from '../../_services/base/data.service';
|
|
8
8
|
import { DynamoNTS_Shared } from '../../_services/shared.static-service';
|
|
9
9
|
|
|
10
|
-
export class
|
|
10
|
+
export class DynamoNTS_Usage_DataService extends DynamoNTS_DataService<Dynamo_UsageSession> {
|
|
11
11
|
usageData: Dynamo_UsageData[] = [];
|
|
12
12
|
simplifiedDailyUsage: Dynamo_DailyUsageData[] = [];
|
|
13
13
|
|
|
@@ -20,7 +20,7 @@ export class UsageService extends DynamoNTS_DataService<Dynamo_UsageSession> {
|
|
|
20
20
|
) {
|
|
21
21
|
super(
|
|
22
22
|
new Dynamo_UsageSession(set?.usageSession),
|
|
23
|
-
|
|
23
|
+
Dynamo_usageSessionModel_params,
|
|
24
24
|
set?.issuer
|
|
25
25
|
);
|
|
26
26
|
this.usageData = set?.usageData ? set?.usageData : [];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import {
|
|
3
|
-
Dynamo_Metadata,
|
|
3
|
+
Dynamo_Metadata, Dynamo_DataModel_Params, Dynamo_DataProperty_Params, Dynamo_Error,
|
|
4
4
|
Dynamo_Log, Dynamo_AnyError, Dynamo_Error_Settings
|
|
5
5
|
} from '@futdevpro/fsm-dynamo';
|
|
6
6
|
import { DynamoNTS_DBFilter } from '../../_models/types/db-filter.type';
|
|
@@ -43,7 +43,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
43
43
|
depKeyIsRequired?: boolean;
|
|
44
44
|
private depDataDBService: DynamoNTS_DBService<any>;
|
|
45
45
|
|
|
46
|
-
dataParams:
|
|
46
|
+
dataParams: Dynamo_DataModel_Params;
|
|
47
47
|
|
|
48
48
|
defaultErrorUserMsg: string =
|
|
49
49
|
`We encountered an unhandled Data Service Error, ` +
|
|
@@ -60,7 +60,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
60
60
|
/**
|
|
61
61
|
* DB data prams will be used to connect to usable dbService on GlobalService
|
|
62
62
|
*/
|
|
63
|
-
dataParams:
|
|
63
|
+
dataParams: Dynamo_DataModel_Params,
|
|
64
64
|
/**
|
|
65
65
|
* Initial set for issuer to be able to follow the issuer's activity
|
|
66
66
|
*/
|
|
@@ -383,6 +383,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
383
383
|
...this._getDefaultErrorSettings('getDataListByDependencyId', error),
|
|
384
384
|
|
|
385
385
|
errorCode: 'NTS-DS0-GLD0',
|
|
386
|
+
|
|
386
387
|
});
|
|
387
388
|
}
|
|
388
389
|
}
|
|
@@ -765,17 +766,17 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
765
766
|
*/
|
|
766
767
|
async validateForSave(): Promise<void> {
|
|
767
768
|
try {
|
|
768
|
-
for (let i = 0; i < this.dataParams.
|
|
769
|
+
for (let i = 0; i < this.dataParams.properties.length; i++) {
|
|
769
770
|
// basic required validations
|
|
770
771
|
if (
|
|
771
|
-
(this.dataParams.
|
|
772
|
-
(this.data[this.dataParams.
|
|
773
|
-
this.data[this.dataParams.
|
|
772
|
+
(this.dataParams.properties[i].required &&
|
|
773
|
+
(this.data[this.dataParams.properties[i].key] === null ||
|
|
774
|
+
this.data[this.dataParams.properties[i].key] === undefined
|
|
774
775
|
)
|
|
775
776
|
) ||
|
|
776
|
-
(this.dataParams.
|
|
777
|
-
(this.data[this.dataParams.
|
|
778
|
-
this.data[this.dataParams.
|
|
777
|
+
(this.dataParams.properties[i].index &&
|
|
778
|
+
(this.data[this.dataParams.properties[i].key] === null ||
|
|
779
|
+
this.data[this.dataParams.properties[i].key] === undefined
|
|
779
780
|
)
|
|
780
781
|
)
|
|
781
782
|
) {
|
|
@@ -783,7 +784,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
783
784
|
...this._getDefaultErrorSettings(
|
|
784
785
|
'validateForSave',
|
|
785
786
|
new Error(
|
|
786
|
-
`validateForSave failed, ${this.dataParams.
|
|
787
|
+
`validateForSave failed, ${this.dataParams.properties[i].key} is missing! ` +
|
|
787
788
|
`(${this.dataParams.dataName})`
|
|
788
789
|
)
|
|
789
790
|
),
|
|
@@ -795,14 +796,14 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
795
796
|
}
|
|
796
797
|
|
|
797
798
|
// specific Date validation
|
|
798
|
-
if (this.dataParams.
|
|
799
|
-
!(new Date(this.data[this.dataParams.
|
|
799
|
+
if (this.dataParams.properties[i].type === 'Date' &&
|
|
800
|
+
!(new Date(this.data[this.dataParams.properties[i].key]) instanceof Date)
|
|
800
801
|
) {
|
|
801
802
|
throw new Dynamo_Error({
|
|
802
803
|
...this._getDefaultErrorSettings(
|
|
803
804
|
'validateForSave',
|
|
804
805
|
new Error(
|
|
805
|
-
`validateForSave failed, ${this.dataParams.
|
|
806
|
+
`validateForSave failed, ${this.dataParams.properties[i].key} is not a date! ` +
|
|
806
807
|
`(${this.dataParams.dataName})`
|
|
807
808
|
)
|
|
808
809
|
),
|
|
@@ -814,10 +815,10 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
814
815
|
}
|
|
815
816
|
|
|
816
817
|
// call additional validators
|
|
817
|
-
if (this.dataParams.
|
|
818
|
-
for (let j = 0; j < this.dataParams.
|
|
819
|
-
this.dataParams.
|
|
820
|
-
this.data[this.dataParams.
|
|
818
|
+
if (this.dataParams.properties[i].additionalValidators) {
|
|
819
|
+
for (let j = 0; j < this.dataParams.properties[i].additionalValidators.length; j++) {
|
|
820
|
+
this.dataParams.properties[i].additionalValidators[j](
|
|
821
|
+
this.data[this.dataParams.properties[i].key]
|
|
821
822
|
);
|
|
822
823
|
}
|
|
823
824
|
}
|
|
@@ -840,8 +841,8 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
840
841
|
* setting up dependency dataHook by DynamoBEDataModelParams
|
|
841
842
|
*/
|
|
842
843
|
private lookForDependencyDataSettings(): void {
|
|
843
|
-
const dependencyParam:
|
|
844
|
-
(modelParams:
|
|
844
|
+
const dependencyParam: Dynamo_DataProperty_Params = this.dataParams.properties.find(
|
|
845
|
+
(modelParams: Dynamo_DataProperty_Params): boolean => modelParams.isDependencyHook
|
|
845
846
|
);
|
|
846
847
|
|
|
847
848
|
if (dependencyParam) {
|
|
@@ -3,7 +3,7 @@ import * as mongoose from 'mongoose';
|
|
|
3
3
|
import { Schema } from 'mongoose';
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
Dynamo_Metadata,
|
|
6
|
+
Dynamo_Metadata, Dynamo_DataModel_Params, Dynamo_DataProperty_Params, Dynamo_Error,
|
|
7
7
|
Dynamo_Log, Dynamo_AnyError, Dynamo_Error_Settings
|
|
8
8
|
} from '@futdevpro/fsm-dynamo';
|
|
9
9
|
import { DynamoNTS_DBFilter } from '../../_models/types/db-filter.type';
|
|
@@ -31,7 +31,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
|
|
|
31
31
|
* schemaSettings also MUST contain specific types that differs from the listed above (Array, Date)
|
|
32
32
|
*/
|
|
33
33
|
constructor(
|
|
34
|
-
public dataParams:
|
|
34
|
+
public dataParams: Dynamo_DataModel_Params
|
|
35
35
|
){
|
|
36
36
|
try {
|
|
37
37
|
this.serviceName = this.constructor?.name;
|
|
@@ -50,8 +50,8 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
|
|
|
50
50
|
} catch (error) {
|
|
51
51
|
Dynamo_Log.error(
|
|
52
52
|
`\nDynamoNTS_DBService ERROR, ` +
|
|
53
|
-
`The dbService construction failed for ${dataParams.dataName}. ${this.serviceName}
|
|
54
|
-
error,
|
|
53
|
+
`The dbService construction failed for ${dataParams.dataName}. ${this.serviceName}` +
|
|
54
|
+
`\nERROR: `, error,
|
|
55
55
|
new Error()
|
|
56
56
|
);
|
|
57
57
|
}
|
|
@@ -246,13 +246,16 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
|
|
|
246
246
|
...this._getDefaultErrorSettings(
|
|
247
247
|
'getDataListByDependencyId',
|
|
248
248
|
new Error(
|
|
249
|
-
`
|
|
249
|
+
`isDependencyHook not setted up for this dataModel (${this.dataParams.dbName}) ` +
|
|
250
250
|
`(NTS DB)`
|
|
251
251
|
)
|
|
252
252
|
),
|
|
253
253
|
|
|
254
254
|
status: 501,
|
|
255
255
|
errorCode: 'NTS-DBS-GLD0',
|
|
256
|
+
additionalContent: {
|
|
257
|
+
dataModel: this.dataModel,
|
|
258
|
+
},
|
|
256
259
|
});
|
|
257
260
|
}
|
|
258
261
|
|
|
@@ -468,7 +471,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
|
|
|
468
471
|
filter[this.depDataName] = { $in: narrowByDependencyIds };
|
|
469
472
|
}
|
|
470
473
|
|
|
471
|
-
await this.dataParams.
|
|
474
|
+
await this.dataParams.properties.forEach((modelParam: Dynamo_DataProperty_Params): void => {
|
|
472
475
|
if (
|
|
473
476
|
(filterBy[modelParam.key] !== null && filterBy[modelParam.key] !== undefined) ||
|
|
474
477
|
filterBy[modelParam.key + 'Range']
|
|
@@ -944,14 +947,14 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
|
|
|
944
947
|
* @param params DynamoBEDataPropertyParams
|
|
945
948
|
* @returns mongoose schema object
|
|
946
949
|
*/
|
|
947
|
-
private buildMongooseSchemaByModelParams(params?:
|
|
950
|
+
private buildMongooseSchemaByModelParams(params?: Dynamo_DataProperty_Params[]): any {
|
|
948
951
|
const schemaSettingsObj = {};
|
|
949
952
|
|
|
950
953
|
if (!params) {
|
|
951
|
-
params = this.dataParams.
|
|
954
|
+
params = this.dataParams.properties;
|
|
952
955
|
}
|
|
953
956
|
|
|
954
|
-
params.forEach((property:
|
|
957
|
+
params.forEach((property: Dynamo_DataProperty_Params): void => {
|
|
955
958
|
const beType = this.getBEType(property.type);
|
|
956
959
|
|
|
957
960
|
if (
|
|
@@ -960,7 +963,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
|
|
|
960
963
|
property?.subObjectParams?.length == 0
|
|
961
964
|
) {
|
|
962
965
|
schemaSettingsObj[property.key] = {
|
|
963
|
-
type: beType
|
|
966
|
+
type: beType,
|
|
964
967
|
};
|
|
965
968
|
|
|
966
969
|
if (property.index) {
|
|
@@ -1041,8 +1044,8 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
|
|
|
1041
1044
|
* sets depDataKey
|
|
1042
1045
|
*/
|
|
1043
1046
|
private lookForDependencyDataSettings(): void {
|
|
1044
|
-
const dependencyParam:
|
|
1045
|
-
(modelParams:
|
|
1047
|
+
const dependencyParam: Dynamo_DataProperty_Params = this.dataParams.properties.find(
|
|
1048
|
+
(modelParams: Dynamo_DataProperty_Params): boolean => modelParams.isDependencyHook
|
|
1046
1049
|
);
|
|
1047
1050
|
|
|
1048
1051
|
if (dependencyParam) {
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
import { DynamoNTS_HttpCallType } from '../../_enums/http/http-call-type.enum';
|
|
8
8
|
import { DynamoNTS_HttpResponseType } from '../../_enums/http/http-response-type.enum';
|
|
9
9
|
import {
|
|
10
|
-
|
|
10
|
+
DynamoNTS_ApiCall_Params
|
|
11
11
|
} from '../../_models/control-models/api-call-params.control-model';
|
|
12
|
-
import {
|
|
12
|
+
import { DynamoNTS_globalSettings } from '../../_constants';
|
|
13
13
|
|
|
14
|
-
export interface
|
|
14
|
+
export interface DynamoNTS_ApiCallInput_Params<T_Body = any> {
|
|
15
15
|
pathParams?: {
|
|
16
16
|
/**
|
|
17
17
|
* path params setted in endpoint
|
|
@@ -47,11 +47,11 @@ export class DynamoNTS_ApiService {
|
|
|
47
47
|
* you must setup the basic api call params with this.
|
|
48
48
|
* follow the instructions in the constructor: new DynamoNTS_ApiCallParams({ ... })
|
|
49
49
|
*/
|
|
50
|
-
callParams:
|
|
50
|
+
callParams: DynamoNTS_ApiCall_Params,
|
|
51
51
|
/**
|
|
52
52
|
* you can pass data and other inputs in this section
|
|
53
53
|
*/
|
|
54
|
-
inputParams?:
|
|
54
|
+
inputParams?: DynamoNTS_ApiCallInput_Params<T_Body>
|
|
55
55
|
): Promise<T_Response /* | Axios.AxiosResponse */> {
|
|
56
56
|
try {
|
|
57
57
|
let a: T_Response;
|
|
@@ -70,7 +70,7 @@ export class DynamoNTS_ApiService {
|
|
|
70
70
|
this.setupQueryParams<T_Body>(inputParams, callParams);
|
|
71
71
|
} */
|
|
72
72
|
|
|
73
|
-
if (
|
|
73
|
+
if (DynamoNTS_globalSettings.logApiEvents) {
|
|
74
74
|
this.logEvent(url, inputParams, callParams);
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -146,7 +146,7 @@ export class DynamoNTS_ApiService {
|
|
|
146
146
|
} */
|
|
147
147
|
|
|
148
148
|
private static handleError<T_Body>(
|
|
149
|
-
callParams:
|
|
149
|
+
callParams: DynamoNTS_ApiCall_Params,
|
|
150
150
|
error: any,
|
|
151
151
|
inputParams: {
|
|
152
152
|
pathParams?: { [param: string]: string; };
|
|
@@ -243,17 +243,17 @@ export class DynamoNTS_ApiService {
|
|
|
243
243
|
|
|
244
244
|
private static async postPutPatch<T_Response, T_Body>(
|
|
245
245
|
axios: Axios.AxiosInstance,
|
|
246
|
-
callParams:
|
|
246
|
+
callParams: DynamoNTS_ApiCall_Params,
|
|
247
247
|
url: string,
|
|
248
|
-
inputParams:
|
|
248
|
+
inputParams: DynamoNTS_ApiCallInput_Params<T_Body>
|
|
249
249
|
): Promise<T_Response> {
|
|
250
250
|
return await axios[callParams.type]<T_Response>(
|
|
251
251
|
url,
|
|
252
252
|
inputParams.body,
|
|
253
253
|
callParams.httpOptions
|
|
254
254
|
).then((res: Axios.AxiosResponse): T_Response => {
|
|
255
|
-
if (
|
|
256
|
-
if (
|
|
255
|
+
if (DynamoNTS_globalSettings.logApiEvents) {
|
|
256
|
+
if (DynamoNTS_globalSettings.logApiResponseContents) {
|
|
257
257
|
Dynamo_Log.success(`> ${callParams.name} api call was successful`, res.data);
|
|
258
258
|
|
|
259
259
|
} else {
|
|
@@ -272,12 +272,12 @@ export class DynamoNTS_ApiService {
|
|
|
272
272
|
private static async delete<T_Response>(
|
|
273
273
|
axios: Axios.AxiosInstance,
|
|
274
274
|
url: string,
|
|
275
|
-
callParams:
|
|
275
|
+
callParams: DynamoNTS_ApiCall_Params
|
|
276
276
|
): Promise<T_Response> {
|
|
277
277
|
return await axios.delete<T_Response>(url, callParams.httpOptions).then(
|
|
278
278
|
(res: Axios.AxiosResponse): T_Response => {
|
|
279
|
-
if (
|
|
280
|
-
if (
|
|
279
|
+
if (DynamoNTS_globalSettings.logApiEvents) {
|
|
280
|
+
if (DynamoNTS_globalSettings.logApiResponseContents) {
|
|
281
281
|
Dynamo_Log.success(`${callParams.name} was successful`, res.data);
|
|
282
282
|
} else {
|
|
283
283
|
Dynamo_Log.success(`${callParams.name} was successful`);
|
|
@@ -294,12 +294,12 @@ export class DynamoNTS_ApiService {
|
|
|
294
294
|
private static async get<T_Response>(
|
|
295
295
|
axios: Axios.AxiosInstance,
|
|
296
296
|
url: string,
|
|
297
|
-
callParams:
|
|
297
|
+
callParams: DynamoNTS_ApiCall_Params
|
|
298
298
|
): Promise<T_Response> {
|
|
299
299
|
return await axios.get<T_Response>(url, callParams.httpOptions).then(
|
|
300
300
|
(res: Axios.AxiosResponse): T_Response => {
|
|
301
|
-
if (
|
|
302
|
-
if (
|
|
301
|
+
if (DynamoNTS_globalSettings.logApiEvents) {
|
|
302
|
+
if (DynamoNTS_globalSettings.logApiResponseContents) {
|
|
303
303
|
Dynamo_Log.success(`${callParams.name} was successful`, res.data);
|
|
304
304
|
} else {
|
|
305
305
|
Dynamo_Log.success(`${callParams.name} was successful`);
|
|
@@ -317,17 +317,17 @@ export class DynamoNTS_ApiService {
|
|
|
317
317
|
|
|
318
318
|
private static logEvent<T_Body>(
|
|
319
319
|
url: string,
|
|
320
|
-
inputParams:
|
|
321
|
-
callParams:
|
|
320
|
+
inputParams: DynamoNTS_ApiCallInput_Params<T_Body>,
|
|
321
|
+
callParams: DynamoNTS_ApiCall_Params
|
|
322
322
|
): void {
|
|
323
|
-
if (
|
|
323
|
+
if (DynamoNTS_globalSettings.logApiRequestContents) {
|
|
324
324
|
Dynamo_Log.log(`< outgoing API call: ${url} \nbody:`, inputParams?.body);
|
|
325
325
|
|
|
326
326
|
} else {
|
|
327
327
|
Dynamo_Log.log(`< outgoing API call: ${url}`);
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
if (
|
|
330
|
+
if (DynamoNTS_globalSettings.logApiRequestSettings) {
|
|
331
331
|
Dynamo_Log.log(`callParams:`, callParams);
|
|
332
332
|
Dynamo_Log.log('inputParams:', {
|
|
333
333
|
pathParams: inputParams.pathParams ?? {},
|
|
@@ -337,7 +337,7 @@ export class DynamoNTS_ApiService {
|
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
private static setupHeaders(
|
|
340
|
-
callParams:
|
|
340
|
+
callParams: DynamoNTS_ApiCall_Params,
|
|
341
341
|
axios: Axios.AxiosInstance
|
|
342
342
|
): void {
|
|
343
343
|
for (const headerKey in callParams.httpOptions.headers) {
|
|
@@ -7,7 +7,7 @@ import { Options as MailOptions, Attachment } from 'nodemailer/lib/mailer';
|
|
|
7
7
|
|
|
8
8
|
import { Dynamo_AnyError, Dynamo_Array, Dynamo_Error, Dynamo_Error_Settings, Dynamo_Log } from '@futdevpro/fsm-dynamo';
|
|
9
9
|
|
|
10
|
-
export interface
|
|
10
|
+
export interface DynamoNTS_EmailService_Settings {
|
|
11
11
|
host: string,
|
|
12
12
|
port: number,
|
|
13
13
|
email: string,
|
|
@@ -41,7 +41,7 @@ export class DynamoNTS_EmailTemplateComponent {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
export interface
|
|
44
|
+
export interface DynamoNTS_SendEmail_Settings<T = { [propertyKey: string]: string; }> {
|
|
45
45
|
to: string;
|
|
46
46
|
subject: string;
|
|
47
47
|
/** direct email content, if provided, this will be used */
|
|
@@ -78,7 +78,7 @@ export class DynamoNTS_EmailService {
|
|
|
78
78
|
`\nplease contact the responsible development team.`;
|
|
79
79
|
|
|
80
80
|
constructor (
|
|
81
|
-
set:
|
|
81
|
+
set: DynamoNTS_EmailService_Settings
|
|
82
82
|
) {
|
|
83
83
|
this.serviceName = this.constructor?.name;
|
|
84
84
|
this.senderName = set.senderName;
|
|
@@ -126,7 +126,7 @@ export class DynamoNTS_EmailService {
|
|
|
126
126
|
* @param set
|
|
127
127
|
*/
|
|
128
128
|
public async sendEmail<T>(
|
|
129
|
-
set:
|
|
129
|
+
set: DynamoNTS_SendEmail_Settings<T>,
|
|
130
130
|
issuer: string
|
|
131
131
|
): Promise<void> {
|
|
132
132
|
try {
|
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
import { Request, Response } from 'express';
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
Dynamo_Metadata,
|
|
6
|
+
Dynamo_Metadata, Dynamo_DataModel_Params, Dynamo_Log, Dynamo_Error, Dynamo_Array
|
|
7
7
|
} from '@futdevpro/fsm-dynamo';
|
|
8
|
-
import {
|
|
8
|
+
import { DynamoNTS_App_Params } from '../../_models/control-models/app-params.control-model';
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
|
-
|
|
11
|
+
DynamoNTS_GlobalService_Settings
|
|
12
12
|
} from '../../_models/interfaces/global-service-settings.interface';
|
|
13
13
|
|
|
14
14
|
import { DynamoNTS_AuthService } from './auth.service';
|
|
15
15
|
/* import { DynamoNTS_DBServiceCollection } from './db-service-collection.service'; */
|
|
16
16
|
import { DynamoNTS_DBService } from '../base/db.service';
|
|
17
17
|
import { DynamoNTS_EmailService } from './email.service';
|
|
18
|
-
import {
|
|
18
|
+
import { DynamoNTS_Service_Collection } from './service-collection.service';
|
|
19
19
|
/* import { DynamoNTS_EmailServiceCollection } from './email-service-collection.service'; */
|
|
20
20
|
import { DynamoNTS_SingletonService } from '../base/singleton.service';
|
|
21
21
|
|
|
@@ -30,8 +30,8 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
30
30
|
return DynamoNTS_GlobalService.getSingletonInstance();
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
private static _params:
|
|
34
|
-
static get params():
|
|
33
|
+
private static _params: DynamoNTS_App_Params;
|
|
34
|
+
static get params(): DynamoNTS_App_Params {
|
|
35
35
|
return this._params;
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -44,8 +44,8 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
authService: DynamoNTS_AuthService;
|
|
47
|
-
dbServiceCollection:
|
|
48
|
-
emailServiceCollection:
|
|
47
|
+
dbServiceCollection: DynamoNTS_Service_Collection<DynamoNTS_DBService<any>>;
|
|
48
|
+
emailServiceCollection: DynamoNTS_Service_Collection<DynamoNTS_EmailService>;
|
|
49
49
|
|
|
50
50
|
static globalErrorHandler?: (
|
|
51
51
|
err: any,
|
|
@@ -57,21 +57,35 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
57
57
|
/**
|
|
58
58
|
* You need to setup global Services through this function
|
|
59
59
|
*/
|
|
60
|
-
static async setServices(set:
|
|
60
|
+
static async setServices(set: DynamoNTS_GlobalService_Settings): Promise<void> {
|
|
61
61
|
this.getInstance();
|
|
62
62
|
|
|
63
63
|
try {
|
|
64
64
|
this.instance.dbServiceCollection = {};
|
|
65
|
-
set.dbModels?.forEach((dbModel:
|
|
65
|
+
set.dbModels?.forEach((dbModel: Dynamo_DataModel_Params): void => {
|
|
66
|
+
if (!dbModel.constructed) {
|
|
67
|
+
throw new Dynamo_Error({
|
|
68
|
+
message: `DynamoNTS_GlobalService.setServices failed, ` +
|
|
69
|
+
`ERROR: dbModel is not constructed!`,
|
|
70
|
+
errorCode: 'NTS-GS0-SS1',
|
|
71
|
+
additionalContent: {
|
|
72
|
+
dbModel: dbModel,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
66
77
|
try {
|
|
67
78
|
this.instance.dbServiceCollection[dbModel.dataName] = new DynamoNTS_DBService(dbModel);
|
|
68
79
|
} catch (error) {
|
|
69
80
|
Dynamo_Log.error(`Failed to create DynamoNTS_DBService (${dbModel.dataName}).`, error);
|
|
70
81
|
|
|
71
82
|
throw new Dynamo_Error({
|
|
72
|
-
message: `Failed to create DynamoNTS_DBService (${dbModel.dataName})
|
|
83
|
+
message: `Failed to create DynamoNTS_DBService (${dbModel.dataName}).`,
|
|
73
84
|
issuerService: 'DynamoNTS_GlobalService',
|
|
74
85
|
error: error,
|
|
86
|
+
additionalContent: {
|
|
87
|
+
dbModel: dbModel,
|
|
88
|
+
},
|
|
75
89
|
});
|
|
76
90
|
}
|
|
77
91
|
});
|
|
@@ -102,7 +116,7 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
102
116
|
}
|
|
103
117
|
}
|
|
104
118
|
|
|
105
|
-
static setParams(params:
|
|
119
|
+
static setParams(params: DynamoNTS_App_Params): void {
|
|
106
120
|
this._params = params;
|
|
107
121
|
}
|
|
108
122
|
|
|
@@ -126,7 +140,7 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
126
140
|
*
|
|
127
141
|
* @returns
|
|
128
142
|
*/
|
|
129
|
-
static getDBServiceCollection():
|
|
143
|
+
static getDBServiceCollection(): DynamoNTS_Service_Collection<DynamoNTS_DBService<any>> {
|
|
130
144
|
if (!this.instance?.dbServiceCollection) {
|
|
131
145
|
throw new Error(
|
|
132
146
|
`\n Unique DataBase Service Collection missing!` +
|
|
@@ -145,7 +159,7 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
145
159
|
* @returns
|
|
146
160
|
*/
|
|
147
161
|
static getDBService<T extends Dynamo_Metadata>(
|
|
148
|
-
dataParams:
|
|
162
|
+
dataParams: Dynamo_DataModel_Params
|
|
149
163
|
): DynamoNTS_DBService<T> {
|
|
150
164
|
return this.getDBServiceByKey<T>(dataParams.dataName);
|
|
151
165
|
}
|
|
@@ -178,7 +192,7 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
178
192
|
*
|
|
179
193
|
* @returns
|
|
180
194
|
*/
|
|
181
|
-
static getEmailServiceCollection():
|
|
195
|
+
static getEmailServiceCollection(): DynamoNTS_Service_Collection<DynamoNTS_EmailService> {
|
|
182
196
|
if (!this.instance?.emailServiceCollection) {
|
|
183
197
|
throw new Error(
|
|
184
198
|
`\n Unique Email Service Collection missing!` +
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Dynamo_Log } from '@futdevpro/fsm-dynamo';
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
DynamoNTS_Endpoint_Params
|
|
6
6
|
} from '../../_models/control-models/endpoint-params.control-model';
|
|
7
7
|
|
|
8
8
|
import { DynamoNTS_SingletonService } from '../base/singleton.service';
|
|
@@ -76,7 +76,7 @@ export abstract class DynamoNTS_Controller extends DynamoNTS_SingletonService {
|
|
|
76
76
|
* }),
|
|
77
77
|
* ];
|
|
78
78
|
*/
|
|
79
|
-
endpoints:
|
|
79
|
+
endpoints: DynamoNTS_Endpoint_Params[];
|
|
80
80
|
|
|
81
81
|
protected constructor(){
|
|
82
82
|
super();
|