@techextensor/tab-core-utility 2.1.5 → 2.1.7
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/.eslintrc.json +92 -0
- package/README.md +7 -0
- package/jest.config.ts +22 -0
- package/ng-package.json +7 -0
- package/package.json +18 -31
- package/project.json +42 -0
- package/{index.d.ts → src/index.ts} +77 -53
- package/src/lib/tab-core-utility/app/constants/api-constants.ts +33 -0
- package/src/lib/tab-core-utility/app/constants/common.ts +34 -0
- package/src/lib/tab-core-utility/app/constants/error-messages.ts +21 -0
- package/src/lib/tab-core-utility/app/constants/storage-constants.ts +17 -0
- package/src/lib/tab-core-utility/app/crud/tab-delete.service.ts +144 -0
- package/src/lib/tab-core-utility/app/crud/tab-get.service.ts +160 -0
- package/src/lib/tab-core-utility/app/crud/tab-insert.service.ts +75 -0
- package/src/lib/tab-core-utility/app/crud/tab-update.service.ts +105 -0
- package/src/lib/tab-core-utility/app/crud/tab-workflow.service.ts +39 -0
- package/src/lib/tab-core-utility/app/enums/controllers.enum.ts +24 -0
- package/src/lib/tab-core-utility/app/enums/dsq.enum.ts +46 -0
- package/src/lib/tab-core-utility/app/enums/permission.enum.ts +18 -0
- package/src/lib/tab-core-utility/app/enums/query.enum.ts +12 -0
- package/src/lib/tab-core-utility/app/enums/workflow.enum.ts +35 -0
- package/src/lib/tab-core-utility/app/helpers/common/app.helpers.ts +65 -0
- package/src/lib/tab-core-utility/app/helpers/common/dsq.helpers.ts +80 -0
- package/src/lib/tab-core-utility/app/helpers/common/req-res.helpers.ts +75 -0
- package/src/lib/tab-core-utility/app/helpers/common/where-clause.helpers.ts +262 -0
- package/src/lib/tab-core-utility/app/helpers/screen/forms.helpers.ts +33 -0
- package/src/lib/tab-core-utility/app/helpers/screen/grid-column-data.helpers.ts +88 -0
- package/src/lib/tab-core-utility/app/helpers/screen/grid.helpers.ts +113 -0
- package/src/lib/tab-core-utility/app/helpers/screen/media-upload.helpers.ts +74 -0
- package/src/lib/tab-core-utility/app/helpers/screen/plugin.helpers.ts +52 -0
- package/src/lib/tab-core-utility/app/helpers/screen/screen.helpers.ts +20 -0
- package/{lib/tab-core-utility/app/interfaces/auth.interface.d.ts → src/lib/tab-core-utility/app/interfaces/auth.interface.ts} +18 -15
- package/src/lib/tab-core-utility/app/interfaces/common-api.interface.ts +27 -0
- package/src/lib/tab-core-utility/app/interfaces/grid.interface.ts +118 -0
- package/src/lib/tab-core-utility/app/interfaces/orgInfo.interface.ts +34 -0
- package/src/lib/tab-core-utility/app/interfaces/schema.interface.ts +11 -0
- package/src/lib/tab-core-utility/app/interfaces/user.interface.ts +91 -0
- package/src/lib/tab-core-utility/app/models/api-query.class.ts +92 -0
- package/src/lib/tab-core-utility/app/models/app-object.class.ts +87 -0
- package/src/lib/tab-core-utility/app/models/common.class.ts +30 -0
- package/src/lib/tab-core-utility/app/models/data-source-queries.class.ts +114 -0
- package/src/lib/tab-core-utility/app/utils/filter.util.ts +78 -0
- package/src/lib/tab-core-utility/app/utils/form-builder.util.ts +31 -0
- package/src/lib/tab-core-utility/app/utils/json.util.ts +137 -0
- package/src/lib/tab-core-utility/app/utils/operators.util.ts +129 -0
- package/src/lib/tab-core-utility/app/utils/req-res.util.ts +189 -0
- package/src/lib/tab-core-utility/app/utils/tab-app.util.ts +131 -0
- package/src/lib/tab-core-utility/auth/auth.service.spec.ts +167 -0
- package/src/lib/tab-core-utility/auth/auth.service.ts +91 -0
- package/src/lib/tab-core-utility/auth/idb-storage.service.ts +77 -0
- package/src/lib/tab-core-utility/auth/local-storage.service.spec.ts +47 -0
- package/src/lib/tab-core-utility/auth/local-storage.service.ts +46 -0
- package/src/lib/tab-core-utility/auth/session-storage.service.spec.ts +47 -0
- package/src/lib/tab-core-utility/auth/session-storage.service.ts +46 -0
- package/src/lib/tab-core-utility/core/error-handler/error-handler-interceptor.service.ts +32 -0
- package/src/lib/tab-core-utility/core/error-handler/error-handler.store.spec.ts +16 -0
- package/src/lib/tab-core-utility/core/error-handler/error-handler.store.ts +26 -0
- package/src/lib/tab-core-utility/core/error-handler/models/error-handler.state.ts +9 -0
- package/src/lib/tab-core-utility/core/http-client/api-url.token.ts +4 -0
- package/src/lib/tab-core-utility/core/http-client/api.service.spec.ts +18 -0
- package/src/lib/tab-core-utility/core/http-client/api.service.ts +105 -0
- package/src/lib/tab-core-utility/core/util/auth.utils.ts +22 -0
- package/src/lib/tab-core-utility/store/auth.store.ts +54 -0
- package/src/lib/tab-core-utility/store/orginfo.store.ts +57 -0
- package/src/lib/tab-core-utility/store/schema.store.ts +85 -0
- package/src/test-setup.ts +8 -0
- package/tsconfig.json +29 -0
- package/tsconfig.lib.json +17 -0
- package/tsconfig.lib.prod.json +7 -0
- package/tsconfig.spec.json +16 -0
- package/esm2022/index.mjs +0 -64
- package/esm2022/lib/tab-core-utility/app/constants/api-constants.mjs +0 -33
- package/esm2022/lib/tab-core-utility/app/constants/common.mjs +0 -23
- package/esm2022/lib/tab-core-utility/app/constants/error-messages.mjs +0 -13
- package/esm2022/lib/tab-core-utility/app/constants/storage-constants.mjs +0 -15
- package/esm2022/lib/tab-core-utility/app/crud/tab-delete.service.mjs +0 -145
- package/esm2022/lib/tab-core-utility/app/crud/tab-get.service.mjs +0 -131
- package/esm2022/lib/tab-core-utility/app/crud/tab-insert.service.mjs +0 -77
- package/esm2022/lib/tab-core-utility/app/crud/tab-update.service.mjs +0 -105
- package/esm2022/lib/tab-core-utility/app/crud/tab-workflow.service.mjs +0 -43
- package/esm2022/lib/tab-core-utility/app/enums/controllers.enum.mjs +0 -26
- package/esm2022/lib/tab-core-utility/app/enums/dsq.enum.mjs +0 -48
- package/esm2022/lib/tab-core-utility/app/enums/permission.enum.mjs +0 -20
- package/esm2022/lib/tab-core-utility/app/enums/query.enum.mjs +0 -14
- package/esm2022/lib/tab-core-utility/app/enums/workflow.enum.mjs +0 -37
- package/esm2022/lib/tab-core-utility/app/helpers/common/app.helpers.mjs +0 -68
- package/esm2022/lib/tab-core-utility/app/helpers/common/dsq.helpers.mjs +0 -70
- package/esm2022/lib/tab-core-utility/app/helpers/common/req-res.helpers.mjs +0 -64
- package/esm2022/lib/tab-core-utility/app/helpers/common/where-clause.helpers.mjs +0 -208
- package/esm2022/lib/tab-core-utility/app/helpers/screen/forms.helpers.mjs +0 -38
- package/esm2022/lib/tab-core-utility/app/helpers/screen/grid-column-data.helpers.mjs +0 -78
- package/esm2022/lib/tab-core-utility/app/helpers/screen/grid.helpers.mjs +0 -112
- package/esm2022/lib/tab-core-utility/app/helpers/screen/media-upload.helpers.mjs +0 -77
- package/esm2022/lib/tab-core-utility/app/helpers/screen/plugin.helpers.mjs +0 -55
- package/esm2022/lib/tab-core-utility/app/helpers/screen/screen.helpers.mjs +0 -26
- package/esm2022/lib/tab-core-utility/app/interfaces/auth.interface.mjs +0 -2
- package/esm2022/lib/tab-core-utility/app/interfaces/common-api.interface.mjs +0 -2
- package/esm2022/lib/tab-core-utility/app/interfaces/grid.interface.mjs +0 -3
- package/esm2022/lib/tab-core-utility/app/interfaces/orgInfo.interface.mjs +0 -2
- package/esm2022/lib/tab-core-utility/app/interfaces/schema.interface.mjs +0 -2
- package/esm2022/lib/tab-core-utility/app/interfaces/user.interface.mjs +0 -2
- package/esm2022/lib/tab-core-utility/app/models/api-query.class.mjs +0 -47
- package/esm2022/lib/tab-core-utility/app/models/app-object.class.mjs +0 -30
- package/esm2022/lib/tab-core-utility/app/models/common.class.mjs +0 -12
- package/esm2022/lib/tab-core-utility/app/models/data-source-queries.class.mjs +0 -31
- package/esm2022/lib/tab-core-utility/app/utils/filter.util.mjs +0 -75
- package/esm2022/lib/tab-core-utility/app/utils/form-builder.util.mjs +0 -39
- package/esm2022/lib/tab-core-utility/app/utils/json.util.mjs +0 -138
- package/esm2022/lib/tab-core-utility/app/utils/operators.util.mjs +0 -129
- package/esm2022/lib/tab-core-utility/app/utils/req-res.util.mjs +0 -147
- package/esm2022/lib/tab-core-utility/app/utils/tab-app.util.mjs +0 -99
- package/esm2022/lib/tab-core-utility/auth/auth.service.mjs +0 -74
- package/esm2022/lib/tab-core-utility/auth/idb-storage.service.mjs +0 -69
- package/esm2022/lib/tab-core-utility/auth/local-storage.service.mjs +0 -52
- package/esm2022/lib/tab-core-utility/auth/session-storage.service.mjs +0 -52
- package/esm2022/lib/tab-core-utility/core/error-handler/error-handler-interceptor.service.mjs +0 -26
- package/esm2022/lib/tab-core-utility/core/error-handler/error-handler.store.mjs +0 -21
- package/esm2022/lib/tab-core-utility/core/error-handler/models/error-handler.state.mjs +0 -5
- package/esm2022/lib/tab-core-utility/core/http-client/api-url.token.mjs +0 -4
- package/esm2022/lib/tab-core-utility/core/http-client/api.service.mjs +0 -99
- package/esm2022/lib/tab-core-utility/core/util/auth.utils.mjs +0 -21
- package/esm2022/lib/tab-core-utility/store/auth.store.mjs +0 -43
- package/esm2022/lib/tab-core-utility/store/orginfo.store.mjs +0 -42
- package/esm2022/lib/tab-core-utility/store/schema.store.mjs +0 -68
- package/esm2022/techextensor-tab-core-utility.mjs +0 -5
- package/lib/tab-core-utility/app/constants/api-constants.d.ts +0 -30
- package/lib/tab-core-utility/app/constants/common.d.ts +0 -8
- package/lib/tab-core-utility/app/constants/error-messages.d.ts +0 -6
- package/lib/tab-core-utility/app/constants/storage-constants.d.ts +0 -14
- package/lib/tab-core-utility/app/crud/tab-delete.service.d.ts +0 -51
- package/lib/tab-core-utility/app/crud/tab-get.service.d.ts +0 -58
- package/lib/tab-core-utility/app/crud/tab-insert.service.d.ts +0 -37
- package/lib/tab-core-utility/app/crud/tab-update.service.d.ts +0 -14
- package/lib/tab-core-utility/app/crud/tab-workflow.service.d.ts +0 -20
- package/lib/tab-core-utility/app/enums/controllers.enum.d.ts +0 -24
- package/lib/tab-core-utility/app/enums/dsq.enum.d.ts +0 -42
- package/lib/tab-core-utility/app/enums/permission.enum.d.ts +0 -16
- package/lib/tab-core-utility/app/enums/query.enum.d.ts +0 -11
- package/lib/tab-core-utility/app/enums/workflow.enum.d.ts +0 -30
- package/lib/tab-core-utility/app/helpers/common/app.helpers.d.ts +0 -31
- package/lib/tab-core-utility/app/helpers/common/dsq.helpers.d.ts +0 -32
- package/lib/tab-core-utility/app/helpers/common/req-res.helpers.d.ts +0 -62
- package/lib/tab-core-utility/app/helpers/common/where-clause.helpers.d.ts +0 -82
- package/lib/tab-core-utility/app/helpers/screen/forms.helpers.d.ts +0 -11
- package/lib/tab-core-utility/app/helpers/screen/grid-column-data.helpers.d.ts +0 -33
- package/lib/tab-core-utility/app/helpers/screen/grid.helpers.d.ts +0 -63
- package/lib/tab-core-utility/app/helpers/screen/media-upload.helpers.d.ts +0 -38
- package/lib/tab-core-utility/app/helpers/screen/plugin.helpers.d.ts +0 -25
- package/lib/tab-core-utility/app/helpers/screen/screen.helpers.d.ts +0 -11
- package/lib/tab-core-utility/app/interfaces/common-api.interface.d.ts +0 -24
- package/lib/tab-core-utility/app/interfaces/grid.interface.d.ts +0 -110
- package/lib/tab-core-utility/app/interfaces/orgInfo.interface.d.ts +0 -31
- package/lib/tab-core-utility/app/interfaces/schema.interface.d.ts +0 -11
- package/lib/tab-core-utility/app/interfaces/user.interface.d.ts +0 -84
- package/lib/tab-core-utility/app/models/api-query.class.d.ts +0 -69
- package/lib/tab-core-utility/app/models/app-object.class.d.ts +0 -74
- package/lib/tab-core-utility/app/models/common.class.d.ts +0 -24
- package/lib/tab-core-utility/app/models/data-source-queries.class.d.ts +0 -95
- package/lib/tab-core-utility/app/utils/filter.util.d.ts +0 -30
- package/lib/tab-core-utility/app/utils/form-builder.util.d.ts +0 -13
- package/lib/tab-core-utility/app/utils/json.util.d.ts +0 -25
- package/lib/tab-core-utility/app/utils/operators.util.d.ts +0 -21
- package/lib/tab-core-utility/app/utils/req-res.util.d.ts +0 -61
- package/lib/tab-core-utility/app/utils/tab-app.util.d.ts +0 -48
- package/lib/tab-core-utility/auth/auth.service.d.ts +0 -53
- package/lib/tab-core-utility/auth/idb-storage.service.d.ts +0 -14
- package/lib/tab-core-utility/auth/local-storage.service.d.ts +0 -22
- package/lib/tab-core-utility/auth/session-storage.service.d.ts +0 -22
- package/lib/tab-core-utility/core/error-handler/error-handler-interceptor.service.d.ts +0 -3
- package/lib/tab-core-utility/core/error-handler/error-handler.store.d.ts +0 -10
- package/lib/tab-core-utility/core/error-handler/models/error-handler.state.d.ts +0 -5
- package/lib/tab-core-utility/core/http-client/api-url.token.d.ts +0 -3
- package/lib/tab-core-utility/core/http-client/api.service.d.ts +0 -65
- package/lib/tab-core-utility/core/util/auth.utils.d.ts +0 -9
- package/lib/tab-core-utility/store/auth.store.d.ts +0 -19
- package/lib/tab-core-utility/store/orginfo.store.d.ts +0 -22
- package/lib/tab-core-utility/store/schema.store.d.ts +0 -32
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
import { HttpHeaders } from "@angular/common/http";
|
|
4
|
+
import { Injectable, inject } from "@angular/core";
|
|
5
|
+
import { ApiService } from "../../core/http-client/api.service";
|
|
6
|
+
import { DSQHelper } from "../helpers/common/dsq.helpers";
|
|
7
|
+
import { getHeaders } from "../utils/req-res.util";
|
|
8
|
+
import { API } from "../constants/api-constants";
|
|
9
|
+
import { getAppObject } from "../utils/tab-app.util";
|
|
10
|
+
import { Common } from "../constants/common";
|
|
11
|
+
import { APISelectQuery } from "../models/api-query.class";
|
|
12
|
+
import { FilterValueType } from "../enums/dsq.enum";
|
|
13
|
+
import { QueryType } from "../enums/query.enum";
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@Injectable({ providedIn: 'root' })
|
|
17
|
+
export class TabGetService {
|
|
18
|
+
private readonly apiService = inject(ApiService);
|
|
19
|
+
private readonly dsqHelper = inject(DSQHelper);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Execute RAW DSQ with Name
|
|
23
|
+
* @param data - Object containing AppObjectName and DSQName
|
|
24
|
+
* @returns Response from the API
|
|
25
|
+
*/
|
|
26
|
+
executeRAWDSQWithName(data: any): any {
|
|
27
|
+
const headers = getHeaders();
|
|
28
|
+
if (headers) {
|
|
29
|
+
return this.apiService.post(
|
|
30
|
+
`${API.getDSQ}/${data.AppObjectName}/${data.DSQName}`,
|
|
31
|
+
data,
|
|
32
|
+
headers
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Get Record
|
|
40
|
+
* @param params - Parameters for the request
|
|
41
|
+
* @returns Response from the API
|
|
42
|
+
*/
|
|
43
|
+
getRecord(params: any): any {
|
|
44
|
+
const headers = getHeaders();
|
|
45
|
+
if (headers) {
|
|
46
|
+
return this.apiService.get(`${API.getrecord}`, params, headers);
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Execute Raw SQL
|
|
53
|
+
* @param data - Data for the request
|
|
54
|
+
* @returns Response from the API
|
|
55
|
+
*/
|
|
56
|
+
executeRawSql(data: any): any {
|
|
57
|
+
const headers = getHeaders();
|
|
58
|
+
if (headers) {
|
|
59
|
+
return this.apiService.post(
|
|
60
|
+
`${API.rawSQL}${data}`,
|
|
61
|
+
'',
|
|
62
|
+
headers
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Get History
|
|
70
|
+
* @param appObjectId - ID of the application object
|
|
71
|
+
* @param recordIds - Array of record IDs
|
|
72
|
+
* @returns Response from the API
|
|
73
|
+
*/
|
|
74
|
+
getHistory(appObjectId: string, recordIds: string[]): any {
|
|
75
|
+
const data: any = {};
|
|
76
|
+
if (appObjectId && recordIds) {
|
|
77
|
+
const appObjectName = getAppObject(appObjectId)?.ObjectName;
|
|
78
|
+
const headers = getHeaders();
|
|
79
|
+
if (appObjectName && headers) {
|
|
80
|
+
data.ObjectName = appObjectName;
|
|
81
|
+
data.RecordIds = recordIds;
|
|
82
|
+
return this.apiService.post(
|
|
83
|
+
`${API.getHistory}`,
|
|
84
|
+
data,
|
|
85
|
+
headers
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Change Password
|
|
94
|
+
* @param data - Data for changing password
|
|
95
|
+
* @returns Response from the API
|
|
96
|
+
*/
|
|
97
|
+
changePassword(data: any): any {
|
|
98
|
+
const headers = getHeaders();
|
|
99
|
+
if (headers) {
|
|
100
|
+
return this.apiService.post(
|
|
101
|
+
`${API.changePassword}`,
|
|
102
|
+
data,
|
|
103
|
+
headers
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Reset Password
|
|
110
|
+
* @param data - Data for resetting password
|
|
111
|
+
* @returns Response from the API
|
|
112
|
+
*/
|
|
113
|
+
resetPassword(data: any): any {
|
|
114
|
+
const headers = new HttpHeaders({
|
|
115
|
+
'Content-Type': 'application/json',
|
|
116
|
+
applicationCode: Common.applicationCode,
|
|
117
|
+
});
|
|
118
|
+
return this.apiService.post(
|
|
119
|
+
`${API.restpassword}`,
|
|
120
|
+
data,
|
|
121
|
+
headers
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* PMJAY Import
|
|
127
|
+
* @param data - Data for PMJAY import
|
|
128
|
+
* @returns Response from the API
|
|
129
|
+
*/
|
|
130
|
+
pmjayImport(data: any): any {
|
|
131
|
+
const headers = getHeaders();
|
|
132
|
+
if (headers) {
|
|
133
|
+
return this.apiService.post(
|
|
134
|
+
`${API.pmjayImport}`,
|
|
135
|
+
data,
|
|
136
|
+
headers
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Executes a select query with optional parameters
|
|
143
|
+
* @param data - The select query data
|
|
144
|
+
* @param parameters - Optional parameters to be applied to the query
|
|
145
|
+
* @returns Result of the select query execution
|
|
146
|
+
*/
|
|
147
|
+
selectExecutor(data: APISelectQuery, parameters?: any): any {
|
|
148
|
+
if (parameters && Object.keys(parameters).length) {
|
|
149
|
+
data?.WhereClause?.Filters.forEach((element: any) => {
|
|
150
|
+
if (
|
|
151
|
+
element.ValueType === FilterValueType.Parameter &&
|
|
152
|
+
parameters[element.FieldID]
|
|
153
|
+
) {
|
|
154
|
+
element.Value = parameters[element.FieldID];
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
return this.dsqHelper.executeQuery(data, QueryType.Select);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { Injectable, inject } from '@angular/core';
|
|
3
|
+
import { DSQHelper } from '../helpers/common/dsq.helpers';
|
|
4
|
+
import { ScreenHelper } from '../helpers/screen/screen.helpers';
|
|
5
|
+
import { WhereClauseHelper } from '../helpers/common/where-clause.helpers';
|
|
6
|
+
import { RequestResponseHelper } from '../helpers/common/req-res.helpers';
|
|
7
|
+
import { getAppObject, getDataFromDataSourceQueryID, syncAppObjectFields } from '../utils/tab-app.util';
|
|
8
|
+
import { AppObject, AppScreen } from '../models/app-object.class';
|
|
9
|
+
import { getPrimaryKeyFields, removeMultiplePrimaryKey, removePrimaryKey } from '../utils/req-res.util';
|
|
10
|
+
import { APIFilterCriteria } from '../models/api-query.class';
|
|
11
|
+
import { createDynamicData, removeBlankValue } from '../utils/json.util';
|
|
12
|
+
import { QueryType } from '../enums/query.enum';
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@Injectable({ providedIn: 'root' })
|
|
16
|
+
export class TabInsertService {
|
|
17
|
+
private readonly dsqHelper = inject(DSQHelper);
|
|
18
|
+
private readonly screenHelper = inject(ScreenHelper);
|
|
19
|
+
private readonly whereClauseHelper = inject(WhereClauseHelper);
|
|
20
|
+
private readonly requestResponseHelper = inject(RequestResponseHelper);
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Inserts data by screen ID.
|
|
24
|
+
* @param screenId The ID of the screen.
|
|
25
|
+
* @param data The data to insert.
|
|
26
|
+
* @returns An Observable with the insert result.
|
|
27
|
+
*/
|
|
28
|
+
insertByScreenId(screenId: string, data: any) {
|
|
29
|
+
const screen: AppScreen = this.screenHelper.getScreen(screenId);
|
|
30
|
+
const screenDataSource = getDataFromDataSourceQueryID(screen.DataSourceQuery);
|
|
31
|
+
return this.insertByObjectId(screenDataSource.ObjectID_Tosave, data);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Inserts data by object ID.
|
|
36
|
+
* @param objectId The ID of the object.
|
|
37
|
+
* @param data The data to insert.
|
|
38
|
+
* @returns An Observable with the insert result.
|
|
39
|
+
*/
|
|
40
|
+
insertByObjectId(objectId: string, data: any) {
|
|
41
|
+
const appObject: AppObject = getAppObject(objectId);
|
|
42
|
+
return this.prepareInsert(appObject, data);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Prepares data for insertion.
|
|
47
|
+
* @param appObject The app object.
|
|
48
|
+
* @param data The data to insert.
|
|
49
|
+
* @returns An Observable with the prepared data.
|
|
50
|
+
*/
|
|
51
|
+
prepareInsert(appObject: AppObject, data: any) {
|
|
52
|
+
const crudTableName = appObject.SystemDBTableName;
|
|
53
|
+
syncAppObjectFields(data.data, appObject);
|
|
54
|
+
const PrimaryKeyFields = getPrimaryKeyFields(appObject);
|
|
55
|
+
if (PrimaryKeyFields && PrimaryKeyFields.length === 1) {
|
|
56
|
+
removePrimaryKey(data.data, PrimaryKeyFields[0]?.FieldName);
|
|
57
|
+
} else if (PrimaryKeyFields && PrimaryKeyFields.length > 1) {
|
|
58
|
+
removeMultiplePrimaryKey(data.data, PrimaryKeyFields);
|
|
59
|
+
}
|
|
60
|
+
const whereClause: APIFilterCriteria = this.whereClauseHelper.bindWhereClauseForInsert();
|
|
61
|
+
const dataObj: any = createDynamicData(data.data);
|
|
62
|
+
removeBlankValue(dataObj);
|
|
63
|
+
const requestPayload = this.requestResponseHelper.insertPayload(crudTableName, whereClause, dataObj);
|
|
64
|
+
return this.insert(requestPayload);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Inserts data.
|
|
69
|
+
* @param data The data to insert.
|
|
70
|
+
* @returns An Observable with the insert result.
|
|
71
|
+
*/
|
|
72
|
+
insert(data: any) {
|
|
73
|
+
return this.dsqHelper.executeQuery(data, QueryType.Insert);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
import { Injectable, inject } from "@angular/core";
|
|
4
|
+
import { DSQHelper } from "../helpers/common/dsq.helpers";
|
|
5
|
+
import { ScreenHelper } from "../helpers/screen/screen.helpers";
|
|
6
|
+
import { WhereClauseHelper } from "../helpers/common/where-clause.helpers";
|
|
7
|
+
import { RequestResponseHelper } from "../helpers/common/req-res.helpers";
|
|
8
|
+
import { APIFilterCriteria, APIUpdateQuery } from "../models/api-query.class";
|
|
9
|
+
import { QueryType } from "../enums/query.enum";
|
|
10
|
+
import { getAppObject, getAppObjectFromSystemDBTableName, getDataFromDataSourceQueryID, syncAppObjectFields } from "../utils/tab-app.util";
|
|
11
|
+
import { AppObject, AppScreen } from "../models/app-object.class";
|
|
12
|
+
import { createDynamicData, removeBlankValue } from "../utils/json.util";
|
|
13
|
+
import { getEditRecordId, getPrimaryKeyFields, removeMultiplePrimaryKey, removePrimaryKey } from "../utils/req-res.util";
|
|
14
|
+
import { UpdateQueryParameter } from "../models/data-source-queries.class";
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@Injectable({ providedIn: 'root' })
|
|
18
|
+
export class TabUpdateService {
|
|
19
|
+
private readonly dsqHelper = inject(DSQHelper);
|
|
20
|
+
private readonly screenHelper = inject(ScreenHelper);
|
|
21
|
+
private readonly whereClauseHelper = inject(WhereClauseHelper);
|
|
22
|
+
private readonly requestResponseHelper = inject(RequestResponseHelper);
|
|
23
|
+
|
|
24
|
+
update(data: APIUpdateQuery) {
|
|
25
|
+
return this.dsqHelper.executeQuery(data, QueryType.Update);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
updateUsingDSQ(dsqId: string, data: any, tableName: string, queryFieldsArray?: any) {
|
|
29
|
+
const appObject: AppObject = getDataFromDataSourceQueryID(dsqId);
|
|
30
|
+
if (appObject) {
|
|
31
|
+
if (data && data.data) {
|
|
32
|
+
const whereClause: APIFilterCriteria = this.whereClauseHelper.bindWhereClauseForUpdate(tableName, queryFieldsArray);
|
|
33
|
+
let dataObj: any = [];
|
|
34
|
+
dataObj = createDynamicData(data.data);
|
|
35
|
+
const requestPayload = this.requestResponseHelper.updateRequestPayload(tableName, whereClause, dataObj);
|
|
36
|
+
return this.update(requestPayload);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
updateUsingScreenId(screenId: string, data: any, objectIdToSave?: string) {
|
|
43
|
+
let fields;
|
|
44
|
+
let appObject: any = AppObject;
|
|
45
|
+
let crudTableName;
|
|
46
|
+
if (screenId) {
|
|
47
|
+
const screen: AppScreen = this.screenHelper.getScreen(screenId);
|
|
48
|
+
const screenDataSource = getDataFromDataSourceQueryID(screen.DataSourceQuery);
|
|
49
|
+
fields = screenDataSource.Fields;
|
|
50
|
+
appObject = getAppObject(screenDataSource.ObjectID_Tosave);
|
|
51
|
+
crudTableName = appObject.SystemDBTableName;
|
|
52
|
+
syncAppObjectFields(data.data, appObject);
|
|
53
|
+
}
|
|
54
|
+
if (objectIdToSave) {
|
|
55
|
+
fields = [];
|
|
56
|
+
appObject = getAppObject(objectIdToSave);
|
|
57
|
+
appObject.Fields.forEach((element: any) => {
|
|
58
|
+
fields.push({ Field: element })
|
|
59
|
+
});
|
|
60
|
+
crudTableName = appObject.SystemDBTableName;
|
|
61
|
+
syncAppObjectFields(data.data, appObject);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const PrimaryKeyFields: any = getPrimaryKeyFields(appObject);
|
|
65
|
+
let whereClause: any = APIFilterCriteria;
|
|
66
|
+
if (appObject) {
|
|
67
|
+
if (data.data) {
|
|
68
|
+
const recordId = getEditRecordId(data.data, PrimaryKeyFields[0]?.FieldName);
|
|
69
|
+
data['recordId'] = recordId;
|
|
70
|
+
|
|
71
|
+
if (PrimaryKeyFields && PrimaryKeyFields.length === 1) {
|
|
72
|
+
removePrimaryKey(data.data, PrimaryKeyFields[0]?.FieldName);
|
|
73
|
+
whereClause = this.whereClauseHelper.bindWhereClauseForUpdateGrid(fields, data.recordId, PrimaryKeyFields[0].FieldName, crudTableName);
|
|
74
|
+
} else if (PrimaryKeyFields && PrimaryKeyFields.length > 1) {
|
|
75
|
+
whereClause = this.whereClauseHelper.bindWhereClauseForMultiplePrimaryKeys(data.data, PrimaryKeyFields, crudTableName);
|
|
76
|
+
removeMultiplePrimaryKey(data.data, PrimaryKeyFields);
|
|
77
|
+
}
|
|
78
|
+
const dataObj: any = createDynamicData(data.data);
|
|
79
|
+
removeBlankValue(dataObj);
|
|
80
|
+
const requestPayload = this.requestResponseHelper.updateRequestPayload(crudTableName, whereClause, dataObj);
|
|
81
|
+
return this.update(requestPayload);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
updateScreen(screenId: string, screenData: any) {
|
|
88
|
+
const screen: AppScreen = this.screenHelper.getScreen(screenId);
|
|
89
|
+
if (screen) {
|
|
90
|
+
const appObject = getAppObjectFromSystemDBTableName('TABMD_AppScreen');
|
|
91
|
+
if (appObject) {
|
|
92
|
+
syncAppObjectFields(screenData, appObject);
|
|
93
|
+
}
|
|
94
|
+
Object.assign({}, screen, { Container: screenData.Container });
|
|
95
|
+
const queryFilters: UpdateQueryParameter[] = [];
|
|
96
|
+
queryFilters.push({ FieldName: 'ID', FieldValue: screenId })
|
|
97
|
+
const whereClause = this.whereClauseHelper.bindWhereClauseForUpdate('TABMD_AppScreen', queryFilters);
|
|
98
|
+
const dataObj: any = createDynamicData(screenData);
|
|
99
|
+
removeBlankValue(dataObj);
|
|
100
|
+
const requestPayload = this.requestResponseHelper.updateRequestPayload('TABMD_AppScreen', whereClause, dataObj);
|
|
101
|
+
return this.update(requestPayload);
|
|
102
|
+
}
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
import { Injectable, inject } from "@angular/core";
|
|
4
|
+
import { ApiService } from "../../core/http-client/api.service";
|
|
5
|
+
import { getHeaders } from "../utils/req-res.util";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@Injectable({ providedIn: 'root' })
|
|
9
|
+
export class TabWorkflowService {
|
|
10
|
+
private readonly apiService = inject(ApiService);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Executes a TAB workflow.
|
|
14
|
+
* @param endPoint The endpoint for the workflow.
|
|
15
|
+
* @param data The data to send with the request.
|
|
16
|
+
* @returns An observable of the workflow execution result.
|
|
17
|
+
*/
|
|
18
|
+
executeTABWorkflow(endPoint: string, data: string) {
|
|
19
|
+
const headers = getHeaders();
|
|
20
|
+
if (headers) {
|
|
21
|
+
return this.apiService.post(endPoint, data, headers);
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Executes an ELSA workflow.
|
|
28
|
+
* @param endPoint The endpoint for the workflow.
|
|
29
|
+
* @param data The data to send with the request.
|
|
30
|
+
* @returns An observable of the workflow execution result.
|
|
31
|
+
*/
|
|
32
|
+
executeELSAWorkflow(endPoint: string, data: string) {
|
|
33
|
+
const headers = getHeaders();
|
|
34
|
+
if (headers) {
|
|
35
|
+
return this.apiService.postWorkflow(endPoint, data, headers);
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export enum DataTypes {
|
|
2
|
+
AutoNumber = 1,
|
|
3
|
+
Number = 2,
|
|
4
|
+
CheckBox = 3,
|
|
5
|
+
Currency = 4,
|
|
6
|
+
Date = 5,
|
|
7
|
+
DateTime = 6,
|
|
8
|
+
Email = 7,
|
|
9
|
+
GeoLocation = 8,
|
|
10
|
+
Percent = 9,
|
|
11
|
+
PhoneNumber = 10,
|
|
12
|
+
PickList = 11,
|
|
13
|
+
PickList_MultiSelect = 12,
|
|
14
|
+
Text = 13,
|
|
15
|
+
TextArea = 14,
|
|
16
|
+
TextArea_RICHEDITOR = 15,
|
|
17
|
+
URL = 16,
|
|
18
|
+
UniqueIdentifier = 17,
|
|
19
|
+
Insert_TimeStamp = 18,
|
|
20
|
+
Update_TimeStamp = 19,
|
|
21
|
+
NextNumber = 20,
|
|
22
|
+
Array = 21,
|
|
23
|
+
JSON = 22,
|
|
24
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export enum ConjuctionClause {
|
|
2
|
+
AND = 1,
|
|
3
|
+
OR = 2,
|
|
4
|
+
AND_NOT = 3,
|
|
5
|
+
OR_NOT = 4,
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export enum RelationalOperator {
|
|
9
|
+
GreaterThan = 1,
|
|
10
|
+
LessThan = 2,
|
|
11
|
+
EqualTo = 3,
|
|
12
|
+
IN = 4,
|
|
13
|
+
NOTIN = 5,
|
|
14
|
+
IsNULL = 6,
|
|
15
|
+
IsNotNULL = 7,
|
|
16
|
+
NotEqualTo = 8,
|
|
17
|
+
GreaterThanOREqualTo = 9,
|
|
18
|
+
LessThanOREqualTo = 10,
|
|
19
|
+
Contains = 11,
|
|
20
|
+
NotContains = 12,
|
|
21
|
+
StartsWith = 13,
|
|
22
|
+
NotStartsWith = 14,
|
|
23
|
+
EndsWith = 15,
|
|
24
|
+
NotEndsWith = 16,
|
|
25
|
+
Between = 17,
|
|
26
|
+
NotBetween = 18,
|
|
27
|
+
SplitContains = 19,
|
|
28
|
+
NotSplitContains = 20,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export enum FilterValueType {
|
|
32
|
+
Literal = 1,
|
|
33
|
+
Parameter = 2,
|
|
34
|
+
Property = 3,
|
|
35
|
+
Global = 4,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export enum SortSequence {
|
|
39
|
+
Asc = 1,
|
|
40
|
+
Desc = 2,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export enum ObjectCreationType {
|
|
44
|
+
Standard = 1,
|
|
45
|
+
Custom = 2,
|
|
46
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export enum AccessType {
|
|
2
|
+
READ = 'READ',
|
|
3
|
+
CREATE = 'CREATE',
|
|
4
|
+
UPDATE = 'UPDATE',
|
|
5
|
+
DELETE = 'DELETE',
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export enum AccessPermission {
|
|
9
|
+
None = 1,
|
|
10
|
+
Own = 2,
|
|
11
|
+
Team = 3,
|
|
12
|
+
All = 4,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export enum DeploymentStatus {
|
|
16
|
+
InDevelopment = 1,
|
|
17
|
+
Deployed = 2,
|
|
18
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export enum WorkFlowTriggerType {
|
|
2
|
+
EventBased = 1,
|
|
3
|
+
DateBased = 2,
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export enum WorkFlowEventExecution_WorkFlowTriggerEvent {
|
|
7
|
+
Created = 1,
|
|
8
|
+
Edited = 2,
|
|
9
|
+
CreatedOrEdited = 3,
|
|
10
|
+
Deleted = 4,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export enum WorkFlowEventExecution_WorkFlowTriggerFieldCriteria {
|
|
14
|
+
WhenAnyFieldIsUpdated = 1,
|
|
15
|
+
WhenAnySelectedFieldIsUpdated = 2,
|
|
16
|
+
WhenSelectedAllFieldsAreUpdated = 3,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export enum WorkFlowEventExecution_WorkFlowTriggerOccurence {
|
|
20
|
+
Everytime = 1,
|
|
21
|
+
FirstTime = 2,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export enum WorkFlowTimeExecution_DaysRelationalOperator {
|
|
25
|
+
Before = 1,
|
|
26
|
+
After = 2,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export enum WorkFlowTimeExecution_ExecutionCycle {
|
|
30
|
+
Once = 1,
|
|
31
|
+
Weekly = 2,
|
|
32
|
+
Monthly = 3,
|
|
33
|
+
Yearly = 4,
|
|
34
|
+
Daily = 5,
|
|
35
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
import { Injectable, inject } from '@angular/core';
|
|
4
|
+
import { ApiService } from '../../../core/http-client/api.service';
|
|
5
|
+
import { getHeaders } from '../../utils/req-res.util';
|
|
6
|
+
import { API } from '../../constants/api-constants';
|
|
7
|
+
import { LocalStorageService } from '../../../auth/local-storage.service';
|
|
8
|
+
|
|
9
|
+
@Injectable({ providedIn: 'root' })
|
|
10
|
+
export class AppHelper {
|
|
11
|
+
private readonly apiService = inject(ApiService);
|
|
12
|
+
private readonly localStorageService = inject(LocalStorageService);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Rebuilds the application.
|
|
16
|
+
* @param data Optional data for rebuilding the application
|
|
17
|
+
* @returns Result of the rebuild operation
|
|
18
|
+
*/
|
|
19
|
+
rebuildApp(data?: any) {
|
|
20
|
+
const headers = getHeaders();
|
|
21
|
+
if (headers) {
|
|
22
|
+
return this.apiService.post(API.buildApp, data ? data : {}, headers);
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Publishes the application.
|
|
29
|
+
* @param params Optional parameters for publishing the application
|
|
30
|
+
* @returns Result of the publish operation
|
|
31
|
+
*/
|
|
32
|
+
publishApp(params?: any) {
|
|
33
|
+
const headers = getHeaders();
|
|
34
|
+
if (headers) {
|
|
35
|
+
return this.apiService.get(API.publishApp, params, headers);
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Retrieves screen data.
|
|
42
|
+
* @param params Optional parameters for retrieving screen data
|
|
43
|
+
* @returns Screen data
|
|
44
|
+
*/
|
|
45
|
+
getScreen(params?: any) {
|
|
46
|
+
const headers = getHeaders();
|
|
47
|
+
if (headers) {
|
|
48
|
+
return this.apiService.get(API.getScreen, params, headers);
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Retrieves schema data.
|
|
55
|
+
* @param params Optional parameters for retrieving schema data
|
|
56
|
+
* @returns Subscription for getting schema data
|
|
57
|
+
*/
|
|
58
|
+
getSchema(params?: any) {
|
|
59
|
+
const headers = getHeaders();
|
|
60
|
+
if (headers) {
|
|
61
|
+
return this.apiService.get(API.getSchema, params, headers);
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
import { Injectable, inject } from '@angular/core';
|
|
4
|
+
import { ApiService } from '../../../core/http-client/api.service';
|
|
5
|
+
import { QueryType } from '../../enums/query.enum';
|
|
6
|
+
import { API } from '../../constants/api-constants';
|
|
7
|
+
import { getHeaders } from '../../utils/req-res.util';
|
|
8
|
+
import { getAppObjectFromDataSourceQueryID } from '../../utils/tab-app.util';
|
|
9
|
+
import { AccessPermission, AccessType } from '../../enums/permission.enum';
|
|
10
|
+
|
|
11
|
+
@Injectable({ providedIn: 'root' })
|
|
12
|
+
export class DSQHelper {
|
|
13
|
+
private readonly apiService = inject(ApiService);
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Executes a query based on the query type
|
|
17
|
+
* @param data The data to be executed
|
|
18
|
+
* @param queryType The type of query to be executed
|
|
19
|
+
* @returns The result of the query execution
|
|
20
|
+
*/
|
|
21
|
+
executeQuery(data: any, queryType: QueryType) {
|
|
22
|
+
switch (queryType) {
|
|
23
|
+
case QueryType.Insert:
|
|
24
|
+
return this.execution(data, API.insert);
|
|
25
|
+
case QueryType.Update:
|
|
26
|
+
return this.execution(data, API.update);
|
|
27
|
+
case QueryType.Delete:
|
|
28
|
+
return this.execution(data, API.delete);
|
|
29
|
+
case QueryType.Select:
|
|
30
|
+
return this.execution(data, API.select);
|
|
31
|
+
default:
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Executes an HTTP POST request with the provided data and URL
|
|
38
|
+
* @param data The data to be sent in the POST request
|
|
39
|
+
* @param endPointName The URL to send the POST request to
|
|
40
|
+
* @returns The result of the POST request if headers are available, otherwise null
|
|
41
|
+
*/
|
|
42
|
+
private execution(data: any, endPointName: string) {
|
|
43
|
+
const headers = getHeaders();
|
|
44
|
+
if (headers) {
|
|
45
|
+
return this.apiService.post(endPointName, data, headers);
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Checks if the user has access to the specified object based on roles and access type
|
|
52
|
+
* @param dsqId The DataSourceQuery ID to check access for
|
|
53
|
+
* @param accessType The type of access to check (e.g., read, write)
|
|
54
|
+
* @param roles The roles of the user with IDs
|
|
55
|
+
* @returns True if the user has access, false otherwise
|
|
56
|
+
*/
|
|
57
|
+
doesHaveObjectAccess(
|
|
58
|
+
dsqId: string,
|
|
59
|
+
accessType: AccessType,
|
|
60
|
+
roles: [{ ID: string }]
|
|
61
|
+
) {
|
|
62
|
+
const appObject = getAppObjectFromDataSourceQueryID(dsqId);
|
|
63
|
+
|
|
64
|
+
if (appObject) {
|
|
65
|
+
const accessList: any[] = appObject.AccessList.filter((access: any) =>
|
|
66
|
+
roles.some(
|
|
67
|
+
(role) =>
|
|
68
|
+
access.RoleID.toLowerCase() === role.ID.toLowerCase() &&
|
|
69
|
+
access.IsEnabled
|
|
70
|
+
)
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
return accessList.some(
|
|
74
|
+
(access) => access[accessType] === AccessPermission.All
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
}
|