complexqa_frontend_core 1.3.2 → 1.4.1
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/package.json
CHANGED
|
@@ -85,9 +85,9 @@ export class ApiAbstractElementClass
|
|
|
85
85
|
|
|
86
86
|
let url = `/${ this.api_prefix }/${ this.module_prefix }/search`;
|
|
87
87
|
|
|
88
|
-
payload = this
|
|
89
|
-
let response = this
|
|
90
|
-
response = this
|
|
88
|
+
payload = this.handle_request_payload(payload);
|
|
89
|
+
let response = this.api_request(url, payload);
|
|
90
|
+
response = this.handle_response(response);
|
|
91
91
|
|
|
92
92
|
return {
|
|
93
93
|
response: response,
|
|
@@ -158,9 +158,9 @@ export class ApiAbstractElementClass
|
|
|
158
158
|
|
|
159
159
|
let url = `/${ this.api_prefix }/${ this.module_prefix }/create`;
|
|
160
160
|
|
|
161
|
-
payload = this
|
|
162
|
-
let response = this
|
|
163
|
-
response = this
|
|
161
|
+
payload = this.handle_request_payload(payload);
|
|
162
|
+
let response = this.api_request(url, payload);
|
|
163
|
+
response = this.handle_response(response);
|
|
164
164
|
|
|
165
165
|
return {
|
|
166
166
|
response: response,
|
|
@@ -206,9 +206,9 @@ export class ApiAbstractElementClass
|
|
|
206
206
|
|
|
207
207
|
let url = `/${ this.api_prefix }/${ this.module_prefix }/update_property`;
|
|
208
208
|
|
|
209
|
-
payload = this
|
|
210
|
-
let response = this
|
|
211
|
-
response = this
|
|
209
|
+
payload = this.handle_request_payload(payload);
|
|
210
|
+
let response = this.api_request(url, payload);
|
|
211
|
+
response = this.handle_response(response);
|
|
212
212
|
|
|
213
213
|
return {
|
|
214
214
|
response: response,
|
|
@@ -239,9 +239,9 @@ export class ApiAbstractElementClass
|
|
|
239
239
|
|
|
240
240
|
let url = `/${ this.api_prefix }/${ this.module_prefix }/delete`;
|
|
241
241
|
|
|
242
|
-
payload = this
|
|
243
|
-
let response = this
|
|
244
|
-
response = this
|
|
242
|
+
payload = this.handle_request_payload(payload);
|
|
243
|
+
let response = this.api_request(url, payload);
|
|
244
|
+
response = this.handle_response(response);
|
|
245
245
|
|
|
246
246
|
return {
|
|
247
247
|
response: response,
|
|
@@ -255,12 +255,12 @@ export class ApiAbstractElementClass
|
|
|
255
255
|
|
|
256
256
|
/******************************************************************************************/
|
|
257
257
|
|
|
258
|
-
|
|
258
|
+
handle_request_payload(payload)
|
|
259
259
|
{
|
|
260
|
-
return this
|
|
260
|
+
return this.object_replace_null_recursively(payload);
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
|
|
263
|
+
object_replace_null_recursively(object)
|
|
264
264
|
{
|
|
265
265
|
let result = clone_object(object);
|
|
266
266
|
for (let key in result)
|
|
@@ -271,7 +271,7 @@ export class ApiAbstractElementClass
|
|
|
271
271
|
}
|
|
272
272
|
else if (( result[ key ]?.constructor === Object ) || ( result[ key ]?.constructor === Array ))
|
|
273
273
|
{
|
|
274
|
-
result[ key ] = this
|
|
274
|
+
result[ key ] = this.object_replace_null_recursively(result[ key ]);
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
|
|
@@ -286,8 +286,9 @@ export class ApiAbstractElementClass
|
|
|
286
286
|
* @param method
|
|
287
287
|
* @returns {Promise<Promise<axios.AxiosResponse<any>> | *>}
|
|
288
288
|
* @version v.0.2 (26/01/2025)
|
|
289
|
+
* @todo - валидация входящих параметров
|
|
289
290
|
*/
|
|
290
|
-
async
|
|
291
|
+
async api_request(url, payload, method = 'POST')
|
|
291
292
|
{
|
|
292
293
|
let request_params;
|
|
293
294
|
if (!payload)
|
|
@@ -299,9 +300,9 @@ export class ApiAbstractElementClass
|
|
|
299
300
|
request_params = clone_object(payload)
|
|
300
301
|
}
|
|
301
302
|
|
|
302
|
-
request_params = this
|
|
303
|
+
request_params = this.mixin_service_params(request_params);
|
|
303
304
|
|
|
304
|
-
console.log({payload, request_params});
|
|
305
|
+
//console.log({payload, request_params});
|
|
305
306
|
|
|
306
307
|
|
|
307
308
|
if (this.host_api)
|
|
@@ -335,6 +336,7 @@ export class ApiAbstractElementClass
|
|
|
335
336
|
*
|
|
336
337
|
* @param object
|
|
337
338
|
* @returns {string}
|
|
339
|
+
* @todo - валидация входящих параметров
|
|
338
340
|
*/
|
|
339
341
|
object_to_string(object)
|
|
340
342
|
{
|
|
@@ -344,7 +346,7 @@ export class ApiAbstractElementClass
|
|
|
344
346
|
}
|
|
345
347
|
|
|
346
348
|
|
|
347
|
-
|
|
349
|
+
mixin_service_params(params)
|
|
348
350
|
{
|
|
349
351
|
params.client = 'webapp';
|
|
350
352
|
return params;
|
|
@@ -357,7 +359,7 @@ export class ApiAbstractElementClass
|
|
|
357
359
|
* @returns {Promise<any>}
|
|
358
360
|
* @version v.0.1 (01/06/2024)
|
|
359
361
|
*/
|
|
360
|
-
|
|
362
|
+
handle_response(response)
|
|
361
363
|
{
|
|
362
364
|
response = response.then((api_response) =>
|
|
363
365
|
{
|
|
@@ -14,4 +14,29 @@ export class ProjectApi extends ApiAbstractElementClass
|
|
|
14
14
|
super(options);
|
|
15
15
|
this.set_element_class_instance(typeProject);
|
|
16
16
|
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* All test cases + suites
|
|
24
|
+
*
|
|
25
|
+
* @version v.1.0 (23/08/2025)
|
|
26
|
+
* @param payload
|
|
27
|
+
* @todo - валидация входящих параметров
|
|
28
|
+
*/
|
|
29
|
+
async get_test_structure(payload)
|
|
30
|
+
{
|
|
31
|
+
let url = `/web_api/project/get/test_structure`;
|
|
32
|
+
|
|
33
|
+
payload = this.handle_request_payload(payload);
|
|
34
|
+
let response = this.api_request(url, payload);
|
|
35
|
+
response = this.handle_response(response);
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
response: response,
|
|
39
|
+
payload : payload
|
|
40
|
+
};
|
|
41
|
+
}
|
|
17
42
|
}
|
|
@@ -21,10 +21,10 @@ export class typeProject extends familyGeneralElement
|
|
|
21
21
|
api_key = 'project';
|
|
22
22
|
|
|
23
23
|
structure_scheme = {
|
|
24
|
-
project_id
|
|
25
|
-
project_name
|
|
26
|
-
project_description
|
|
27
|
-
project_status
|
|
24
|
+
project_id : 'integer | require',
|
|
25
|
+
project_name : 'string | require',
|
|
26
|
+
project_description: 'string | optional',
|
|
27
|
+
project_status : 'string | enum | require',
|
|
28
28
|
team_id : 'integer | require',
|
|
29
29
|
//reference_document_ids: 'array | reference | optional',
|
|
30
30
|
};
|
|
@@ -87,6 +87,48 @@ export class typeProject extends familyGeneralElement
|
|
|
87
87
|
|
|
88
88
|
/******************************************************************************************/
|
|
89
89
|
|
|
90
|
+
/**
|
|
91
|
+
*
|
|
92
|
+
* All test cases + suites
|
|
93
|
+
* @version v.1.0 (23/08/2025)
|
|
94
|
+
* @param project_id
|
|
95
|
+
* @param callback
|
|
96
|
+
* @returns {Promise<any>}
|
|
97
|
+
*/
|
|
98
|
+
async get_test_structure(project_id = false, callback = {})
|
|
99
|
+
{
|
|
100
|
+
if (!project_id)
|
|
101
|
+
{
|
|
102
|
+
project_id = this.project_id;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
let payload = {
|
|
106
|
+
project_id: project_id
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* {Api} ApiService
|
|
110
|
+
*/
|
|
111
|
+
return ApiService[ this.api_key ].get_test_structure(payload).then((response) =>
|
|
112
|
+
{
|
|
113
|
+
if (typeof callback?.success === 'function')
|
|
114
|
+
{
|
|
115
|
+
callback?.success({ response, payload })
|
|
116
|
+
}
|
|
117
|
+
}).catch((error) =>
|
|
118
|
+
{
|
|
119
|
+
echo({ error });
|
|
120
|
+
if (typeof callback?.error === 'function')
|
|
121
|
+
{
|
|
122
|
+
callback?.error({ error, payload })
|
|
123
|
+
}
|
|
124
|
+
}).finally((response) =>
|
|
125
|
+
{
|
|
126
|
+
if (typeof callback?.final === 'function')
|
|
127
|
+
{
|
|
128
|
+
callback?.final({ response, payload })
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
90
132
|
|
|
91
133
|
/**
|
|
92
134
|
*
|