@stackfactor/client-api 1.1.12-9.2 → 1.1.12
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/{exports.ts → exports.js} +0 -14
- package/index.js +3 -0
- package/lib/{actionNotifications.ts → actionNotifications.js} +11 -21
- package/lib/{address.ts → address.js} +5 -4
- package/lib/axiosClient.js +85 -0
- package/lib/{config.ts → config.js} +9 -20
- package/lib/{constants.ts → constants.js} +41 -11
- package/lib/{dashboard.ts → dashboard.js} +10 -19
- package/lib/{departmentTrainingPlans.ts → departmentTrainingPlans.js} +32 -63
- package/lib/{groups.ts → groups.js} +29 -68
- package/lib/{integration.ts → integration.js} +47 -103
- package/lib/{integrationConfiguration.ts → integrationConfiguration.js} +22 -27
- package/lib/integrations/{contentGenerator.ts → contentGenerator.js} +18 -38
- package/lib/{learningContent.ts → learningContent.js} +62 -218
- package/lib/{learningPath.ts → learningPath.js} +30 -57
- package/lib/{logger.ts → logger.js} +8 -18
- package/lib/{role.ts → role.js} +69 -117
- package/lib/{roleTemplate.ts → roleTemplate.js} +30 -65
- package/lib/{skill.ts → skill.js} +87 -125
- package/lib/skillAssessmentTestingSession.js +148 -0
- package/lib/{skillAssessments.ts → skillAssessments.js} +16 -63
- package/lib/{skillTemplate.ts → skillTemplate.js} +42 -73
- package/lib/{teams.ts → teams.js} +38 -73
- package/lib/{tenants.ts → tenants.js} +10 -17
- package/lib/{trainingPlans.ts → trainingPlans.js} +56 -159
- package/lib/{userInformation.ts → userInformation.js} +26 -27
- package/lib/{users.ts → users.js} +140 -239
- package/lib/utils.js +48 -0
- package/package.json +1 -12
- package/.eslintrc.json +0 -13
- package/index.ts +0 -1
- package/lib/aiAssistant.ts +0 -197
- package/lib/avatar.ts +0 -41
- package/lib/axiosClient.ts +0 -92
- package/lib/microSkillsQuizes.ts +0 -70
- package/lib/quotas.ts +0 -59
- package/lib/security.ts +0 -99
- package/lib/skillAssessmentTestingSession.ts +0 -192
- package/lib/talentTransfromation.ts +0 -126
- package/lib/trainingPlansProficiencyLevels.ts +0 -132
- package/lib/utils.ts +0 -64
|
@@ -4,10 +4,10 @@ import { client } from "./axiosClient.js";
|
|
|
4
4
|
* Create skill and set information
|
|
5
5
|
* @param {Object} data
|
|
6
6
|
* @param {String} token Authorization token
|
|
7
|
-
* @returns {Promise
|
|
7
|
+
* @returns {Promise}
|
|
8
8
|
*/
|
|
9
|
-
const createSkill = (data
|
|
10
|
-
return new Promise((resolve, reject)
|
|
9
|
+
export const createSkill = (data, token) => {
|
|
10
|
+
return new Promise(function (resolve, reject) {
|
|
11
11
|
let confirmationRequest = client.put(
|
|
12
12
|
"api/v1/skills",
|
|
13
13
|
{ data: data },
|
|
@@ -27,15 +27,12 @@ const createSkill = (data: object, token: string): Promise<object> => {
|
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Create skills from templates
|
|
30
|
-
* @param {Array<String>} templateIds
|
|
30
|
+
* @param {Array<String>} templateIds,
|
|
31
31
|
* @param {String} token Authorization token
|
|
32
|
-
* @returns {Promise
|
|
32
|
+
* @returns {Promise}
|
|
33
33
|
*/
|
|
34
|
-
const createSkillsFromTemplates = (
|
|
35
|
-
|
|
36
|
-
token: string
|
|
37
|
-
): Promise<object> => {
|
|
38
|
-
return new Promise((resolve, reject) => {
|
|
34
|
+
export const createSkillsFromTemplates = (templateIds, token) => {
|
|
35
|
+
return new Promise(function (resolve, reject) {
|
|
39
36
|
const requestData = {
|
|
40
37
|
templateIds: templateIds,
|
|
41
38
|
};
|
|
@@ -61,15 +58,11 @@ const createSkillsFromTemplates = (
|
|
|
61
58
|
* @param {String} id The id of the skill to be deleted
|
|
62
59
|
* @param {String} comments The comments included with the deletion
|
|
63
60
|
* @param {String} token Authorization token
|
|
64
|
-
* @returns {Promise
|
|
61
|
+
* @returns {Promise}
|
|
65
62
|
*/
|
|
66
|
-
const deleteSkill = (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
token: string
|
|
70
|
-
): Promise<object> => {
|
|
71
|
-
return new Promise((resolve, reject) => {
|
|
72
|
-
const data: { id: string; comments?: string } = {
|
|
63
|
+
export const deleteSkill = (id, comments, token) => {
|
|
64
|
+
return new Promise(function (resolve, reject) {
|
|
65
|
+
const data = {
|
|
73
66
|
id: id,
|
|
74
67
|
};
|
|
75
68
|
if (comments) data.comments = comments;
|
|
@@ -89,12 +82,12 @@ const deleteSkill = (
|
|
|
89
82
|
|
|
90
83
|
/**
|
|
91
84
|
* Discard the skill draft changes
|
|
92
|
-
* @param {String} id The id of the skill to be
|
|
85
|
+
* @param {String} id The id of the skill to be deleted
|
|
93
86
|
* @param {String} token Authorization token
|
|
94
|
-
* @returns {Promise
|
|
87
|
+
* @returns {Promise}
|
|
95
88
|
*/
|
|
96
|
-
const discardSkillChanges = (id
|
|
97
|
-
return new Promise((resolve, reject)
|
|
89
|
+
export const discardSkillChanges = (id, token) => {
|
|
90
|
+
return new Promise(function (resolve, reject) {
|
|
98
91
|
const data = {};
|
|
99
92
|
const request = client.get(`api/v1/skills/discard/${id}`, {
|
|
100
93
|
headers: { authorization: token },
|
|
@@ -112,15 +105,16 @@ const discardSkillChanges = (id: string, token: string): Promise<object> => {
|
|
|
112
105
|
|
|
113
106
|
/**
|
|
114
107
|
* Get the list of imported skill templates
|
|
115
|
-
* @param {String} token
|
|
116
|
-
* @returns {Promise
|
|
108
|
+
* @param {String} token
|
|
109
|
+
* @returns {Promise}
|
|
117
110
|
*/
|
|
118
|
-
const getImportedSkillTemplates = (token
|
|
119
|
-
return new Promise((resolve, reject)
|
|
111
|
+
export const getImportedSkillTemplates = (token) => {
|
|
112
|
+
return new Promise(function (resolve, reject) {
|
|
120
113
|
const request = client.get(`api/v1/skills/getimportedskilltemplates`, {
|
|
121
114
|
headers: { authorization: token },
|
|
122
115
|
});
|
|
123
116
|
request
|
|
117
|
+
|
|
124
118
|
.then((response) => {
|
|
125
119
|
resolve(response.data);
|
|
126
120
|
})
|
|
@@ -133,18 +127,13 @@ const getImportedSkillTemplates = (token: string): Promise<object> => {
|
|
|
133
127
|
/**
|
|
134
128
|
* Get the skill related roles
|
|
135
129
|
* @param {String} id
|
|
136
|
-
* @param {String} token
|
|
137
|
-
* @
|
|
138
|
-
* @returns {Promise<Object>}
|
|
130
|
+
* @param {String} token
|
|
131
|
+
* @returns {Promise}
|
|
139
132
|
*/
|
|
140
|
-
const getSkillRelatedRoles = (
|
|
141
|
-
|
|
142
|
-
token: string,
|
|
143
|
-
includeRoleInformation = false
|
|
144
|
-
): Promise<object> => {
|
|
145
|
-
return new Promise((resolve, reject) => {
|
|
133
|
+
export const getSkillRelatedRoles = (id, token) => {
|
|
134
|
+
return new Promise(function (resolve, reject) {
|
|
146
135
|
let confirmationRequest = client.get(
|
|
147
|
-
`api/v1/skills/getskillrelatedroles/${id}
|
|
136
|
+
`api/v1/skills/getskillrelatedroles/${id}`,
|
|
148
137
|
{
|
|
149
138
|
headers: { authorization: token },
|
|
150
139
|
}
|
|
@@ -162,14 +151,11 @@ const getSkillRelatedRoles = (
|
|
|
162
151
|
/**
|
|
163
152
|
* Get skill required assessment type
|
|
164
153
|
* @param {String} id
|
|
165
|
-
* @param {String} token
|
|
166
|
-
* @returns {Promise
|
|
154
|
+
* @param {String} token
|
|
155
|
+
* @returns {Promise}
|
|
167
156
|
*/
|
|
168
|
-
const getSkillRequiredAssessmentType = (
|
|
169
|
-
|
|
170
|
-
token: string
|
|
171
|
-
): Promise<object> => {
|
|
172
|
-
return new Promise((resolve, reject) => {
|
|
157
|
+
export const getSkillRequiredAssessmentType = (id, token) => {
|
|
158
|
+
return new Promise(function (resolve, reject) {
|
|
173
159
|
let confirmationRequest = client.get(
|
|
174
160
|
`api/v1/skills/getrequiredassessmenttype/${id}`,
|
|
175
161
|
{
|
|
@@ -187,20 +173,20 @@ const getSkillRequiredAssessmentType = (
|
|
|
187
173
|
};
|
|
188
174
|
|
|
189
175
|
/**
|
|
190
|
-
* Get skill information
|
|
176
|
+
* Get skill skill information
|
|
191
177
|
* @param {String} id The id of the skill
|
|
192
178
|
* @param {String} version The version of the skill
|
|
193
179
|
* @param {Boolean} returnNullIfVersionNotFound When true it will return null if the version is not found
|
|
194
180
|
* @param {String} token Authorization token
|
|
195
|
-
* @returns {Promise
|
|
181
|
+
* @returns {Promise}
|
|
196
182
|
*/
|
|
197
|
-
const getSkillInformationById = (
|
|
198
|
-
id
|
|
199
|
-
version
|
|
200
|
-
returnNullIfVersionNotFound
|
|
201
|
-
token
|
|
202
|
-
)
|
|
203
|
-
return new Promise((resolve, reject)
|
|
183
|
+
export const getSkillInformationById = (
|
|
184
|
+
id,
|
|
185
|
+
version,
|
|
186
|
+
returnNullIfVersionNotFound,
|
|
187
|
+
token
|
|
188
|
+
) => {
|
|
189
|
+
return new Promise(function (resolve, reject) {
|
|
204
190
|
let confirmationRequest = client.get(
|
|
205
191
|
`api/v1/skills/skill/${id}/${version}/${returnNullIfVersionNotFound}`,
|
|
206
192
|
{
|
|
@@ -225,23 +211,22 @@ const getSkillInformationById = (
|
|
|
225
211
|
* @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
|
|
226
212
|
* @param {Boolean} namesOnly Return only the names of the skills
|
|
227
213
|
* @param {String} token Authorization token
|
|
228
|
-
* @returns {Promise
|
|
214
|
+
* @returns {Promise}
|
|
229
215
|
*/
|
|
230
|
-
const getSkillList = (
|
|
231
|
-
filter
|
|
232
|
-
version
|
|
233
|
-
includeDeleted
|
|
234
|
-
returnDefaultIfVersionNotAvailable
|
|
235
|
-
namesOnly
|
|
236
|
-
token
|
|
237
|
-
)
|
|
238
|
-
return new Promise((resolve, reject)
|
|
216
|
+
export const getSkillList = (
|
|
217
|
+
filter,
|
|
218
|
+
version,
|
|
219
|
+
includeDeleted,
|
|
220
|
+
returnDefaultIfVersionNotAvailable,
|
|
221
|
+
namesOnly,
|
|
222
|
+
token
|
|
223
|
+
) => {
|
|
224
|
+
return new Promise(function (resolve, reject) {
|
|
239
225
|
const requestData = {
|
|
240
226
|
includeDeleted: includeDeleted,
|
|
241
227
|
namesOnly: namesOnly,
|
|
242
228
|
returnDefaultIfVersionNotAvailable: returnDefaultIfVersionNotAvailable,
|
|
243
229
|
version: version,
|
|
244
|
-
filter: filter,
|
|
245
230
|
};
|
|
246
231
|
if (filter) requestData.filter = filter;
|
|
247
232
|
let confirmationRequest = client.post(`api/v1/skills`, requestData, {
|
|
@@ -263,15 +248,15 @@ const getSkillList = (
|
|
|
263
248
|
* @param {Number} maxDepth How many levels down in the organization the skills will be loaded
|
|
264
249
|
* @param {Boolean} returnNullIfVersionNotFound Return null if the version is not found
|
|
265
250
|
* @param {String} token Authorization token
|
|
266
|
-
* @returns {Promise
|
|
251
|
+
* @returns {Promise}
|
|
267
252
|
*/
|
|
268
|
-
const getTeamSkillsById = (
|
|
269
|
-
teamId
|
|
270
|
-
maxDepth
|
|
271
|
-
returnNullIfVersionNotFound
|
|
272
|
-
token
|
|
273
|
-
)
|
|
274
|
-
return new Promise((resolve, reject)
|
|
253
|
+
export const getTeamSkillsById = (
|
|
254
|
+
teamId,
|
|
255
|
+
maxDepth,
|
|
256
|
+
returnNullIfVersionNotFound,
|
|
257
|
+
token
|
|
258
|
+
) => {
|
|
259
|
+
return new Promise(function (resolve, reject) {
|
|
275
260
|
let confirmationRequest = client.get(
|
|
276
261
|
`api/v1/skills/getteambyid/${teamId}/${maxDepth}/${returnNullIfVersionNotFound}`,
|
|
277
262
|
{
|
|
@@ -292,13 +277,10 @@ const getTeamSkillsById = (
|
|
|
292
277
|
* Get current user team skills
|
|
293
278
|
* @param {Number} maxDepth How many levels down in the organization the skills will be loaded
|
|
294
279
|
* @param {String} token Authorization token
|
|
295
|
-
* @returns {Promise
|
|
280
|
+
* @returns {Promise}
|
|
296
281
|
*/
|
|
297
|
-
const getCurrentUserTeamSkills = (
|
|
298
|
-
|
|
299
|
-
token: string
|
|
300
|
-
): Promise<object> => {
|
|
301
|
-
return new Promise((resolve, reject) => {
|
|
282
|
+
export const getCurrentUserTeamSkills = (maxDepth, token) => {
|
|
283
|
+
return new Promise(function (resolve, reject) {
|
|
302
284
|
let confirmationRequest = client.get(
|
|
303
285
|
`api/v1/skills/getcurrentuserteam/${maxDepth}`,
|
|
304
286
|
{
|
|
@@ -318,14 +300,11 @@ const getCurrentUserTeamSkills = (
|
|
|
318
300
|
/**
|
|
319
301
|
* Get skill template updates
|
|
320
302
|
* @param {String} id The skill id
|
|
321
|
-
* @param {String} token
|
|
322
|
-
* @returns {Promise
|
|
303
|
+
* @param {String} token
|
|
304
|
+
* @returns {Promise}
|
|
323
305
|
*/
|
|
324
|
-
const getSkillTemplateUpdates = (
|
|
325
|
-
|
|
326
|
-
token: string
|
|
327
|
-
): Promise<object> => {
|
|
328
|
-
return new Promise((resolve, reject) => {
|
|
306
|
+
export const getSkillTemplateUpdates = (id, token) => {
|
|
307
|
+
return new Promise(function (resolve, reject) {
|
|
329
308
|
let confirmationRequest = client.get(
|
|
330
309
|
`api/v1/skills/getskilltemplateupdates/${id}`,
|
|
331
310
|
{
|
|
@@ -346,15 +325,11 @@ const getSkillTemplateUpdates = (
|
|
|
346
325
|
* Import skill templates
|
|
347
326
|
* @param {Array<String>} data The list of role templates to be imported
|
|
348
327
|
* @param {Boolean} publish If true the imported templates will be published
|
|
349
|
-
* @param {String} token
|
|
350
|
-
* @returns {Promise
|
|
328
|
+
* @param {String} token
|
|
329
|
+
* @returns {Promise}
|
|
351
330
|
*/
|
|
352
|
-
const importSkillTemplates = (
|
|
353
|
-
|
|
354
|
-
publish: boolean,
|
|
355
|
-
token: string
|
|
356
|
-
): Promise<object> => {
|
|
357
|
-
return new Promise((resolve, reject) => {
|
|
331
|
+
export const importSkillTemplates = (data, publish, token) => {
|
|
332
|
+
return new Promise(function (resolve, reject) {
|
|
358
333
|
const requestData = {
|
|
359
334
|
data: data,
|
|
360
335
|
publish: publish,
|
|
@@ -367,6 +342,7 @@ const importSkillTemplates = (
|
|
|
367
342
|
}
|
|
368
343
|
);
|
|
369
344
|
confirmationRequest
|
|
345
|
+
|
|
370
346
|
.then((response) => {
|
|
371
347
|
resolve(response.data);
|
|
372
348
|
})
|
|
@@ -381,15 +357,11 @@ const importSkillTemplates = (
|
|
|
381
357
|
* @param {String} id The id of the skill to be published
|
|
382
358
|
* @param {String} comments The comments to be include with the request
|
|
383
359
|
* @param {String} token Authorization token
|
|
384
|
-
* @returns {Promise
|
|
360
|
+
* @returns {Promise}
|
|
385
361
|
*/
|
|
386
|
-
const publishSkill = (
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
token: string
|
|
390
|
-
): Promise<object> => {
|
|
391
|
-
return new Promise((resolve, reject) => {
|
|
392
|
-
let data: { comments?: string } = {};
|
|
362
|
+
export const publishSkill = (id, comments, token) => {
|
|
363
|
+
return new Promise(function (resolve, reject) {
|
|
364
|
+
let data = {};
|
|
393
365
|
if (comments) data.comments = comments;
|
|
394
366
|
let confirmationRequest = client.post(`api/v1/skills/publish/${id}`, data, {
|
|
395
367
|
headers: { authorization: token },
|
|
@@ -409,14 +381,10 @@ const publishSkill = (
|
|
|
409
381
|
* @param {String} id The id of the skill to be updated
|
|
410
382
|
* @param {Object} data Data used to update the skill
|
|
411
383
|
* @param {String} token Authorization token
|
|
412
|
-
* @returns {Promise
|
|
384
|
+
* @returns {Promise}
|
|
413
385
|
*/
|
|
414
|
-
const setSkillInformation = (
|
|
415
|
-
|
|
416
|
-
data: object,
|
|
417
|
-
token: string
|
|
418
|
-
): Promise<object> => {
|
|
419
|
-
return new Promise((resolve, reject) => {
|
|
386
|
+
export const setSkillInformation = (id, data, token) => {
|
|
387
|
+
return new Promise(function (resolve, reject) {
|
|
420
388
|
const requestData = {
|
|
421
389
|
data: data,
|
|
422
390
|
id: id,
|
|
@@ -443,14 +411,10 @@ const setSkillInformation = (
|
|
|
443
411
|
* @param {String} id The id of the skill to be updated
|
|
444
412
|
* @param {Object} data Data used to update the skill
|
|
445
413
|
* @param {String} token Authorization token
|
|
446
|
-
* @returns {Promise
|
|
414
|
+
* @returns {Promise}
|
|
447
415
|
*/
|
|
448
|
-
const setSkillInformationFromTemplate = (
|
|
449
|
-
|
|
450
|
-
data: object,
|
|
451
|
-
token: string
|
|
452
|
-
): Promise<object> => {
|
|
453
|
-
return new Promise((resolve, reject) => {
|
|
416
|
+
export const setSkillInformationFromTemplate = (id, data, token) => {
|
|
417
|
+
return new Promise(function (resolve, reject) {
|
|
454
418
|
const requestData = {
|
|
455
419
|
data: data,
|
|
456
420
|
id: id,
|
|
@@ -476,10 +440,10 @@ const setSkillInformationFromTemplate = (
|
|
|
476
440
|
* Validate skill information
|
|
477
441
|
* @param {String} id The id of the skill to be updated
|
|
478
442
|
* @param {String} token Authorization token
|
|
479
|
-
* @returns {Promise
|
|
443
|
+
* @returns {Promise}
|
|
480
444
|
*/
|
|
481
|
-
const validateSkill = (id
|
|
482
|
-
return new Promise((resolve, reject)
|
|
445
|
+
export const validateSkill = (id, token) => {
|
|
446
|
+
return new Promise(function (resolve, reject) {
|
|
483
447
|
const requestData = {
|
|
484
448
|
id: id,
|
|
485
449
|
};
|
|
@@ -505,14 +469,10 @@ const validateSkill = (id: string, token: string): Promise<object> => {
|
|
|
505
469
|
* @param {String} id The id of the skill to be updated
|
|
506
470
|
* @param {Boolean} watch Set to true or false
|
|
507
471
|
* @param {String} token Authorization token
|
|
508
|
-
* @returns {Promise
|
|
472
|
+
* @returns {Promise}
|
|
509
473
|
*/
|
|
510
|
-
const watchSkill = (
|
|
511
|
-
|
|
512
|
-
watch: boolean,
|
|
513
|
-
token: string
|
|
514
|
-
): Promise<object> => {
|
|
515
|
-
return new Promise((resolve, reject) => {
|
|
474
|
+
export const watchSkill = (id, watch, token) => {
|
|
475
|
+
return new Promise(function (resolve, reject) {
|
|
516
476
|
const requestData = {
|
|
517
477
|
id: id,
|
|
518
478
|
watch: watch,
|
|
@@ -530,7 +490,7 @@ const watchSkill = (
|
|
|
530
490
|
});
|
|
531
491
|
};
|
|
532
492
|
|
|
533
|
-
|
|
493
|
+
const skill = {
|
|
534
494
|
createSkill,
|
|
535
495
|
createSkillsFromTemplates,
|
|
536
496
|
deleteSkill,
|
|
@@ -550,3 +510,5 @@ export default {
|
|
|
550
510
|
validateSkill,
|
|
551
511
|
watchSkill,
|
|
552
512
|
};
|
|
513
|
+
|
|
514
|
+
export default skill;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { client } from "./axiosClient.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* End an existing testing session
|
|
5
|
+
* @param {String} testingSessionId
|
|
6
|
+
* @param {String} token Authorization token
|
|
7
|
+
*/
|
|
8
|
+
export const endSession = (testingSessionId, token) => {
|
|
9
|
+
return new Promise(function (resolve, reject) {
|
|
10
|
+
let confirmationRequest = client.put(
|
|
11
|
+
"api/v1/skillassessmenttestingsession/endsession",
|
|
12
|
+
{ id: testingSessionId },
|
|
13
|
+
{
|
|
14
|
+
headers: { authorization: token },
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
confirmationRequest
|
|
18
|
+
.then((response) => {
|
|
19
|
+
resolve(response.data);
|
|
20
|
+
})
|
|
21
|
+
.catch((error) => {
|
|
22
|
+
reject(error);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* End an existing testing session
|
|
29
|
+
* @param {String} testingSessionId
|
|
30
|
+
* @param {Array<String>} selectedAnswers
|
|
31
|
+
* @param {String} token Authorization token
|
|
32
|
+
*/
|
|
33
|
+
export const getNextStep = (testingSessionId, selectedAnswers, token) => {
|
|
34
|
+
return new Promise(function (resolve, reject) {
|
|
35
|
+
let data = {
|
|
36
|
+
id: testingSessionId,
|
|
37
|
+
};
|
|
38
|
+
if (selectedAnswers) data.selectedAnswers = selectedAnswers;
|
|
39
|
+
let confirmationRequest = client.post(
|
|
40
|
+
`api/v1/skillassessmenttestingsession/getnextstep`,
|
|
41
|
+
data,
|
|
42
|
+
{
|
|
43
|
+
headers: { authorization: token },
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
confirmationRequest
|
|
47
|
+
.then((response) => {
|
|
48
|
+
resolve(response.data);
|
|
49
|
+
})
|
|
50
|
+
.catch((error) => {
|
|
51
|
+
reject(error);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Get skill assessment by user and skill
|
|
58
|
+
* @param {String} userId
|
|
59
|
+
* @param {String} skillId
|
|
60
|
+
* @param {String} token
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
export const getSkillTestAssessment = (userId, skillId, token) => {
|
|
64
|
+
return new Promise(function (resolve, reject) {
|
|
65
|
+
let confirmationRequest = client.post(
|
|
66
|
+
`api/v1/skillassessmenttestingsession/getbyuserandskill`,
|
|
67
|
+
{
|
|
68
|
+
userId: userId,
|
|
69
|
+
skillId: skillId,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
headers: { authorization: token },
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
confirmationRequest
|
|
76
|
+
.then((response) => {
|
|
77
|
+
resolve(response.data);
|
|
78
|
+
})
|
|
79
|
+
.catch((error) => {
|
|
80
|
+
reject(error);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Pause skill assessment
|
|
87
|
+
* @param {String} testingSessionId
|
|
88
|
+
* @param {String} token
|
|
89
|
+
* @returns
|
|
90
|
+
*/
|
|
91
|
+
export const pause = (testingSessionId, token) => {
|
|
92
|
+
return new Promise(function (resolve, reject) {
|
|
93
|
+
let confirmationRequest = client.post(
|
|
94
|
+
`api/v1/skillassessmenttestingsession/pausesession`,
|
|
95
|
+
{
|
|
96
|
+
id: testingSessionId,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
headers: { authorization: token },
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
confirmationRequest
|
|
103
|
+
.then((response) => {
|
|
104
|
+
resolve(response.data);
|
|
105
|
+
})
|
|
106
|
+
.catch((error) => {
|
|
107
|
+
reject(error);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Start a new test skill test assessment session
|
|
114
|
+
* @param {String} skillId
|
|
115
|
+
* @param {Boolean} saveSession
|
|
116
|
+
* @param {String} token
|
|
117
|
+
*/
|
|
118
|
+
export const startSession = (skillId, saveSession, token) => {
|
|
119
|
+
return new Promise(function (resolve, reject) {
|
|
120
|
+
let confirmationRequest = client.post(
|
|
121
|
+
"api/v1/skillassessmenttestingsession/startsession",
|
|
122
|
+
{
|
|
123
|
+
saveSession: saveSession,
|
|
124
|
+
skillId: skillId,
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
headers: { authorization: token },
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
confirmationRequest
|
|
131
|
+
.then((response) => {
|
|
132
|
+
resolve(response.data);
|
|
133
|
+
})
|
|
134
|
+
.catch((error) => {
|
|
135
|
+
reject(error);
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const skillAessementTestingSession = {
|
|
141
|
+
endSession,
|
|
142
|
+
getNextStep,
|
|
143
|
+
getSkillTestAssessment,
|
|
144
|
+
pause,
|
|
145
|
+
startSession,
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export default skillAessementTestingSession;
|
|
@@ -6,15 +6,9 @@ import { client } from "./axiosClient.js";
|
|
|
6
6
|
* @param {Object} data
|
|
7
7
|
* @param {String} comments
|
|
8
8
|
* @param {String} token Authorization token
|
|
9
|
-
* @returns {Promise<Object>}
|
|
10
9
|
*/
|
|
11
|
-
const addEntry = (
|
|
12
|
-
|
|
13
|
-
data: object,
|
|
14
|
-
comments: string,
|
|
15
|
-
token: string
|
|
16
|
-
): Promise<object> => {
|
|
17
|
-
return new Promise((resolve, reject) => {
|
|
10
|
+
export const addEntry = (id, data, comments, token) => {
|
|
11
|
+
return new Promise(function (resolve, reject) {
|
|
18
12
|
const requestData = {
|
|
19
13
|
comments: comments,
|
|
20
14
|
data: data,
|
|
@@ -43,15 +37,9 @@ const addEntry = (
|
|
|
43
37
|
* @param {String} comments
|
|
44
38
|
* @param {String} userId
|
|
45
39
|
* @param {String} token Authorization token
|
|
46
|
-
* @returns {Promise<Object>}
|
|
47
40
|
*/
|
|
48
|
-
const create = (
|
|
49
|
-
|
|
50
|
-
comments: string,
|
|
51
|
-
userId: string,
|
|
52
|
-
token: string
|
|
53
|
-
): Promise<object> => {
|
|
54
|
-
return new Promise((resolve, reject) => {
|
|
41
|
+
export const create = (data, comments, userId, token) => {
|
|
42
|
+
return new Promise(function (resolve, reject) {
|
|
55
43
|
const requestData = {
|
|
56
44
|
comments: comments,
|
|
57
45
|
data: data,
|
|
@@ -79,15 +67,10 @@ const create = (
|
|
|
79
67
|
* @param {number} id The id of the skill to be deleted
|
|
80
68
|
* @param {String} comments The comments included with the deletion
|
|
81
69
|
* @param {String} token Authorization token
|
|
82
|
-
* @returns {Promise<Object>}
|
|
83
70
|
*/
|
|
84
|
-
const deleteSkillAssessment = (
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
token: string
|
|
88
|
-
): Promise<object> => {
|
|
89
|
-
return new Promise((resolve, reject) => {
|
|
90
|
-
const data: { id: number, comments?: string } = {
|
|
71
|
+
export const deleteSkillAssessment = (id, comments, token) => {
|
|
72
|
+
return new Promise(function (resolve, reject) {
|
|
73
|
+
const data = {
|
|
91
74
|
id: id,
|
|
92
75
|
};
|
|
93
76
|
if (comments) data.comments = comments;
|
|
@@ -109,10 +92,9 @@ const deleteSkillAssessment = (
|
|
|
109
92
|
* Get skill assessment by id
|
|
110
93
|
* @param {String} id
|
|
111
94
|
* @param {String} token
|
|
112
|
-
* @returns {Promise<Object>}
|
|
113
95
|
*/
|
|
114
|
-
const getById = (id
|
|
115
|
-
return new Promise((resolve, reject)
|
|
96
|
+
export const getById = (id, token) => {
|
|
97
|
+
return new Promise(function (resolve, reject) {
|
|
116
98
|
let confirmationRequest = client.get(`api/v1/skillassessments/${id}`, {
|
|
117
99
|
headers: { authorization: token },
|
|
118
100
|
});
|
|
@@ -126,44 +108,14 @@ const getById = (id: string, token: string): Promise<object> => {
|
|
|
126
108
|
});
|
|
127
109
|
};
|
|
128
110
|
|
|
129
|
-
/**
|
|
130
|
-
* Get skill assessment by user and skill
|
|
131
|
-
* @param {String} userId
|
|
132
|
-
* @param {String} skillId
|
|
133
|
-
* @param {String} token
|
|
134
|
-
* @returns {Promise<Object>} The skill assessment
|
|
135
|
-
*/
|
|
136
|
-
const getByUserAndSkill = (
|
|
137
|
-
userId: string,
|
|
138
|
-
skillId: string,
|
|
139
|
-
token: string
|
|
140
|
-
): Promise<object> => {
|
|
141
|
-
return new Promise((resolve, reject) => {
|
|
142
|
-
let confirmationRequest = client.get(
|
|
143
|
-
`api/v1/skillassessments/getbyuserandskill/${userId}/${skillId}`,
|
|
144
|
-
{
|
|
145
|
-
headers: { authorization: token },
|
|
146
|
-
}
|
|
147
|
-
);
|
|
148
|
-
confirmationRequest
|
|
149
|
-
.then((response) => {
|
|
150
|
-
resolve(response.data);
|
|
151
|
-
})
|
|
152
|
-
.catch((error) => {
|
|
153
|
-
reject(error);
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
};
|
|
157
|
-
|
|
158
111
|
/**
|
|
159
112
|
* Get list
|
|
160
|
-
* @param {
|
|
113
|
+
* @param {Object} userId The user used to select the skill
|
|
161
114
|
* @param {String} token Authorization token
|
|
162
|
-
* @returns {Promise<Object>}
|
|
163
115
|
*/
|
|
164
|
-
const getList = (userId
|
|
165
|
-
return new Promise((resolve, reject)
|
|
166
|
-
const requestData
|
|
116
|
+
export const getList = (userId, token) => {
|
|
117
|
+
return new Promise(function (resolve, reject) {
|
|
118
|
+
const requestData = {};
|
|
167
119
|
if (userId) requestData.userId = userId;
|
|
168
120
|
let confirmationRequest = client.post(
|
|
169
121
|
`api/v1/skillassessments`,
|
|
@@ -182,11 +134,12 @@ const getList = (userId: string, token: string): Promise<object> => {
|
|
|
182
134
|
});
|
|
183
135
|
};
|
|
184
136
|
|
|
185
|
-
|
|
137
|
+
const skillAssessments = {
|
|
186
138
|
addEntry,
|
|
187
139
|
create,
|
|
188
140
|
deleteSkillAssessment,
|
|
189
141
|
getById,
|
|
190
|
-
getByUserAndSkill,
|
|
191
142
|
getList,
|
|
192
143
|
};
|
|
144
|
+
|
|
145
|
+
export default skillAssessments;
|