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