@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
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { client } from "./axiosClient.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Add new entry skill assessment
|
|
5
|
+
* @param {String} id
|
|
6
|
+
* @param {Object} data
|
|
7
|
+
* @param {String} comments
|
|
8
|
+
* @param {String} token Authorization token
|
|
9
|
+
* @returns {Promise<Object>}
|
|
10
|
+
*/
|
|
11
|
+
const addEntry = (
|
|
12
|
+
id: string,
|
|
13
|
+
data: object,
|
|
14
|
+
comments: string,
|
|
15
|
+
token: string
|
|
16
|
+
): Promise<object> => {
|
|
17
|
+
return new Promise((resolve, reject) => {
|
|
18
|
+
const requestData = {
|
|
19
|
+
comments: comments,
|
|
20
|
+
data: data,
|
|
21
|
+
id: id,
|
|
22
|
+
};
|
|
23
|
+
let confirmationRequest = client.put(
|
|
24
|
+
"api/v1/skillassessments/addentry",
|
|
25
|
+
requestData,
|
|
26
|
+
{
|
|
27
|
+
headers: { authorization: token },
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
confirmationRequest
|
|
31
|
+
.then((response) => {
|
|
32
|
+
resolve(response.data);
|
|
33
|
+
})
|
|
34
|
+
.catch((error) => {
|
|
35
|
+
reject(error);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Create skill assessment
|
|
42
|
+
* @param {Object} data
|
|
43
|
+
* @param {String} comments
|
|
44
|
+
* @param {String} userId
|
|
45
|
+
* @param {String} token Authorization token
|
|
46
|
+
* @returns {Promise<Object>}
|
|
47
|
+
*/
|
|
48
|
+
const create = (
|
|
49
|
+
data: object,
|
|
50
|
+
comments: string,
|
|
51
|
+
userId: string,
|
|
52
|
+
token: string
|
|
53
|
+
): Promise<object> => {
|
|
54
|
+
return new Promise((resolve, reject) => {
|
|
55
|
+
const requestData = {
|
|
56
|
+
comments: comments,
|
|
57
|
+
data: data,
|
|
58
|
+
userId: userId,
|
|
59
|
+
};
|
|
60
|
+
let confirmationRequest = client.put(
|
|
61
|
+
"api/v1/skillassessments/",
|
|
62
|
+
requestData,
|
|
63
|
+
{
|
|
64
|
+
headers: { authorization: token },
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
confirmationRequest
|
|
68
|
+
.then((response) => {
|
|
69
|
+
resolve(response.data);
|
|
70
|
+
})
|
|
71
|
+
.catch((error) => {
|
|
72
|
+
reject(error);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Delete skill assessment
|
|
79
|
+
* @param {number} id The id of the skill to be deleted
|
|
80
|
+
* @param {String} comments The comments included with the deletion
|
|
81
|
+
* @param {String} token Authorization token
|
|
82
|
+
* @returns {Promise<Object>}
|
|
83
|
+
*/
|
|
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 } = {
|
|
91
|
+
id: id,
|
|
92
|
+
};
|
|
93
|
+
if (comments) data.comments = comments;
|
|
94
|
+
const request = client.delete(`api/v1/skillassessments`, {
|
|
95
|
+
headers: { authorization: token },
|
|
96
|
+
data: data,
|
|
97
|
+
});
|
|
98
|
+
request
|
|
99
|
+
.then((response) => {
|
|
100
|
+
resolve(response.data);
|
|
101
|
+
})
|
|
102
|
+
.catch((error) => {
|
|
103
|
+
reject(error);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Get skill assessment by id
|
|
110
|
+
* @param {String} id
|
|
111
|
+
* @param {String} token
|
|
112
|
+
* @returns {Promise<Object>}
|
|
113
|
+
*/
|
|
114
|
+
const getById = (id: string, token: string): Promise<object> => {
|
|
115
|
+
return new Promise((resolve, reject) => {
|
|
116
|
+
let confirmationRequest = client.get(`api/v1/skillassessments/${id}`, {
|
|
117
|
+
headers: { authorization: token },
|
|
118
|
+
});
|
|
119
|
+
confirmationRequest
|
|
120
|
+
.then((response) => {
|
|
121
|
+
resolve(response.data);
|
|
122
|
+
})
|
|
123
|
+
.catch((error) => {
|
|
124
|
+
reject(error);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
};
|
|
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
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Get list
|
|
160
|
+
* @param {String} userId The user used to select the skill
|
|
161
|
+
* @param {String} token Authorization token
|
|
162
|
+
* @returns {Promise<Object>}
|
|
163
|
+
*/
|
|
164
|
+
const getList = (userId: string, token: string): Promise<object> => {
|
|
165
|
+
return new Promise((resolve, reject) => {
|
|
166
|
+
const requestData: { userId?: string } = {};
|
|
167
|
+
if (userId) requestData.userId = userId;
|
|
168
|
+
let confirmationRequest = client.post(
|
|
169
|
+
`api/v1/skillassessments`,
|
|
170
|
+
requestData,
|
|
171
|
+
{
|
|
172
|
+
headers: { authorization: token },
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
confirmationRequest
|
|
176
|
+
.then((response) => {
|
|
177
|
+
resolve(response.data);
|
|
178
|
+
})
|
|
179
|
+
.catch((error) => {
|
|
180
|
+
reject(error);
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export default {
|
|
186
|
+
addEntry,
|
|
187
|
+
create,
|
|
188
|
+
deleteSkillAssessment,
|
|
189
|
+
getById,
|
|
190
|
+
getByUserAndSkill,
|
|
191
|
+
getList,
|
|
192
|
+
};
|
|
@@ -4,9 +4,10 @@ import { client } from "./axiosClient.js";
|
|
|
4
4
|
* Create skill template and set information
|
|
5
5
|
* @param {Object} data
|
|
6
6
|
* @param {String} token Authorization token
|
|
7
|
+
* @returns {Promise<Object>}
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
-
return new Promise(
|
|
9
|
+
const createSkillTemplate = (data: object, token: string): Promise<object> => {
|
|
10
|
+
return new Promise((resolve, reject) => {
|
|
10
11
|
const requestData = {
|
|
11
12
|
data: data,
|
|
12
13
|
};
|
|
@@ -28,13 +29,18 @@ export const createSkillTemplate = (data, token) => {
|
|
|
28
29
|
* @param {number} id The id of the template to be deleted
|
|
29
30
|
* @param {String} comments The comments included with the deletion
|
|
30
31
|
* @param {String} token Authorization token
|
|
32
|
+
* @returns {Promise<Object>}
|
|
31
33
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
const deleteSkillTemplate = (
|
|
35
|
+
id: number,
|
|
36
|
+
comments: string,
|
|
37
|
+
token: string
|
|
38
|
+
): Promise<object> => {
|
|
39
|
+
const data: { id: number; comments?: string } = {
|
|
34
40
|
id: id,
|
|
35
41
|
};
|
|
36
42
|
if (comments) data.comments = comments;
|
|
37
|
-
return new Promise(
|
|
43
|
+
return new Promise((resolve, reject) => {
|
|
38
44
|
const request = client.delete(`api/v1/skilltemplates/`, {
|
|
39
45
|
headers: { authorization: token },
|
|
40
46
|
data: data,
|
|
@@ -53,9 +59,13 @@ export const deleteSkillTemplate = (id, comments, token) => {
|
|
|
53
59
|
* Discard the skill template draft changes
|
|
54
60
|
* @param {String} id The id of the skill template to be deleted
|
|
55
61
|
* @param {String} token Authorization token
|
|
62
|
+
* @returns {Promise<Object>}
|
|
56
63
|
*/
|
|
57
|
-
|
|
58
|
-
|
|
64
|
+
const discardSkillTemplateChanges = (
|
|
65
|
+
id: string,
|
|
66
|
+
token: string
|
|
67
|
+
): Promise<object> => {
|
|
68
|
+
return new Promise((resolve, reject) => {
|
|
59
69
|
const data = {};
|
|
60
70
|
const request = client.get(`api/v1/skilltemplates/discard/${id}`, {
|
|
61
71
|
headers: { authorization: token },
|
|
@@ -77,14 +87,15 @@ export const discardSkillTemplateChanges = (id, token) => {
|
|
|
77
87
|
* @param {String} version The version of the template
|
|
78
88
|
* @param {Boolean} returnNullIfVersionNotFound When true it will return null if the version is not found
|
|
79
89
|
* @param {String} token Authorization token
|
|
90
|
+
* @returns {Promise<Object>}
|
|
80
91
|
*/
|
|
81
|
-
|
|
82
|
-
id,
|
|
83
|
-
version,
|
|
84
|
-
returnNullIfVersionNotFound,
|
|
85
|
-
token
|
|
86
|
-
) => {
|
|
87
|
-
return new Promise(
|
|
92
|
+
const getSkillTemplateInformationById = (
|
|
93
|
+
id: string,
|
|
94
|
+
version: string,
|
|
95
|
+
returnNullIfVersionNotFound: boolean,
|
|
96
|
+
token: string
|
|
97
|
+
): Promise<object> => {
|
|
98
|
+
return new Promise((resolve, reject) => {
|
|
88
99
|
let confirmationRequest = client.get(
|
|
89
100
|
`api/v1/skilltemplates/${id}/${version}/${returnNullIfVersionNotFound}`,
|
|
90
101
|
{
|
|
@@ -108,16 +119,17 @@ export const getSkillTemplateInformationById = (
|
|
|
108
119
|
* @param {Boolean} includeDeleted When true it will return the deleted records as well
|
|
109
120
|
* @param {Boolean} namesOnly When true it will return only the names of the templates
|
|
110
121
|
* @param {String} token Authorization token
|
|
122
|
+
* @returns {Promise<Object>}
|
|
111
123
|
*/
|
|
112
|
-
|
|
113
|
-
filter,
|
|
114
|
-
version,
|
|
115
|
-
includeDeleted,
|
|
116
|
-
namesOnly,
|
|
117
|
-
token
|
|
118
|
-
) => {
|
|
119
|
-
return new Promise(
|
|
120
|
-
const requestData = {
|
|
124
|
+
const getSkillTemplateList = (
|
|
125
|
+
filter: string[],
|
|
126
|
+
version: string,
|
|
127
|
+
includeDeleted: boolean,
|
|
128
|
+
namesOnly: boolean,
|
|
129
|
+
token: string
|
|
130
|
+
): Promise<object> => {
|
|
131
|
+
return new Promise((resolve, reject) => {
|
|
132
|
+
const requestData: { includeDeleted: boolean; namesOnly: boolean; version: string; filter?: string[] } = {
|
|
121
133
|
includeDeleted: includeDeleted,
|
|
122
134
|
namesOnly: namesOnly,
|
|
123
135
|
version: version,
|
|
@@ -141,11 +153,12 @@ export const getSkillTemplateList = (
|
|
|
141
153
|
};
|
|
142
154
|
|
|
143
155
|
/**
|
|
144
|
-
* Get skill
|
|
156
|
+
* Get skill technology stacks template list
|
|
145
157
|
* @param {String} token Authorization token
|
|
158
|
+
* @returns {Promise<Object>}
|
|
146
159
|
*/
|
|
147
|
-
|
|
148
|
-
return new Promise(
|
|
160
|
+
const getTechnologyStacks = (token: string): Promise<object> => {
|
|
161
|
+
return new Promise((resolve, reject) => {
|
|
149
162
|
let confirmationRequest = client.get(`api/v1/skilltemplates/stacks`, {
|
|
150
163
|
headers: { authorization: token },
|
|
151
164
|
});
|
|
@@ -164,10 +177,15 @@ export const getTechnologyStacks = (token) => {
|
|
|
164
177
|
* @param {number} id The id of the template to be published
|
|
165
178
|
* @param {String} comments The comments to be include with the request
|
|
166
179
|
* @param {String} token Authorization token
|
|
180
|
+
* @returns {Promise<Object>}
|
|
167
181
|
*/
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
182
|
+
const publishTemplate = (
|
|
183
|
+
id: number,
|
|
184
|
+
comments: string,
|
|
185
|
+
token: string
|
|
186
|
+
): Promise<object> => {
|
|
187
|
+
return new Promise((resolve, reject) => {
|
|
188
|
+
let data: { comments?: string } = {};
|
|
171
189
|
if (comments) data.comments = comments;
|
|
172
190
|
let confirmationRequest = client.post(
|
|
173
191
|
`api/v1/skilltemplates/publish/${id}`,
|
|
@@ -191,9 +209,14 @@ export const publishTemplate = (id, comments, token) => {
|
|
|
191
209
|
* @param {String} id The id of the template to be updated
|
|
192
210
|
* @param {Object} data Data used to update the template
|
|
193
211
|
* @param {String} token Authorization token
|
|
212
|
+
* @returns {Promise<Object>}
|
|
194
213
|
*/
|
|
195
|
-
|
|
196
|
-
|
|
214
|
+
const setTemplateInformation = (
|
|
215
|
+
id: string,
|
|
216
|
+
data: object,
|
|
217
|
+
token: string
|
|
218
|
+
): Promise<object> => {
|
|
219
|
+
return new Promise((resolve, reject) => {
|
|
197
220
|
const requestData = {
|
|
198
221
|
data: data,
|
|
199
222
|
id: id,
|
|
@@ -220,9 +243,14 @@ export const setTemplateInformation = (id, data, token) => {
|
|
|
220
243
|
* @param {String} id The id of the template to be updated
|
|
221
244
|
* @param {Object} tags Updated template tags
|
|
222
245
|
* @param {String} token Authorization token
|
|
246
|
+
* @returns {Promise<Object>}
|
|
223
247
|
*/
|
|
224
|
-
|
|
225
|
-
|
|
248
|
+
const setTemplateTags = (
|
|
249
|
+
id: string,
|
|
250
|
+
tags: object,
|
|
251
|
+
token: string
|
|
252
|
+
): Promise<object> => {
|
|
253
|
+
return new Promise((resolve, reject) => {
|
|
226
254
|
const requestData = {
|
|
227
255
|
tags: tags,
|
|
228
256
|
id: id,
|
|
@@ -244,14 +272,14 @@ export const setTemplateTags = (id, tags, token) => {
|
|
|
244
272
|
});
|
|
245
273
|
};
|
|
246
274
|
|
|
247
|
-
|
|
275
|
+
/**
|
|
248
276
|
* Validate skill template information
|
|
249
277
|
* @param {String} id The id of the skill to be updated
|
|
250
278
|
* @param {String} token Authorization token
|
|
251
|
-
* @returns {Promise}
|
|
279
|
+
* @returns {Promise<Object>}
|
|
252
280
|
*/
|
|
253
|
-
|
|
254
|
-
return new Promise(
|
|
281
|
+
const validateTemplate = (id: string, token: string): Promise<object> => {
|
|
282
|
+
return new Promise((resolve, reject) => {
|
|
255
283
|
const requestData = {
|
|
256
284
|
id: id,
|
|
257
285
|
};
|
|
@@ -277,9 +305,14 @@ export const validateTemplate = (id, token) => {
|
|
|
277
305
|
* @param {String} id The id of the skill template to be updated
|
|
278
306
|
* @param {Boolean} watch Set to true or false
|
|
279
307
|
* @param {String} token Authorization token
|
|
308
|
+
* @returns {Promise<Object>}
|
|
280
309
|
*/
|
|
281
|
-
|
|
282
|
-
|
|
310
|
+
const watchSkillTemplate = (
|
|
311
|
+
id: string,
|
|
312
|
+
watch: boolean,
|
|
313
|
+
token: string
|
|
314
|
+
): Promise<object> => {
|
|
315
|
+
return new Promise((resolve, reject) => {
|
|
283
316
|
const requestData = {
|
|
284
317
|
id: id,
|
|
285
318
|
watch: watch,
|
|
@@ -301,7 +334,7 @@ export const watchSkillTemplate = (id, watch, token) => {
|
|
|
301
334
|
});
|
|
302
335
|
};
|
|
303
336
|
|
|
304
|
-
|
|
337
|
+
export default {
|
|
305
338
|
createSkillTemplate,
|
|
306
339
|
deleteSkillTemplate,
|
|
307
340
|
discardSkillTemplateChanges,
|
|
@@ -314,5 +347,3 @@ const skillTemplate = {
|
|
|
314
347
|
validateTemplate,
|
|
315
348
|
watchSkillTemplate,
|
|
316
349
|
};
|
|
317
|
-
|
|
318
|
-
export default skillTemplate;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { client } from "./axiosClient.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Get talent transformation steps for the current user
|
|
5
|
+
* @param {String} authToken The authentication token
|
|
6
|
+
* @returns {Promise<Object>}
|
|
7
|
+
*/
|
|
8
|
+
const getTalentTransformationStepsForCurrentUser = (
|
|
9
|
+
authToken: string
|
|
10
|
+
): Promise<object> => {
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
const request = client.get(
|
|
13
|
+
`api/v1/talenttransformation/getforcurrentuser`,
|
|
14
|
+
authToken
|
|
15
|
+
? {
|
|
16
|
+
headers: { authorization: authToken },
|
|
17
|
+
}
|
|
18
|
+
: {}
|
|
19
|
+
);
|
|
20
|
+
request
|
|
21
|
+
.then((response) => {
|
|
22
|
+
resolve(response.data);
|
|
23
|
+
})
|
|
24
|
+
.catch((error) => {
|
|
25
|
+
reject(error);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Get the talent transformation summary for the whole organization
|
|
32
|
+
* @param {String} authToken
|
|
33
|
+
* @returns {Promise<Object>} The talent transformation summary
|
|
34
|
+
*/
|
|
35
|
+
const getTalentTransformationSummary = (authToken: string): Promise<object> => {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
const request = client.get(
|
|
38
|
+
`api/v1/talenttransformation/summary`,
|
|
39
|
+
authToken
|
|
40
|
+
? {
|
|
41
|
+
headers: { authorization: authToken },
|
|
42
|
+
}
|
|
43
|
+
: {}
|
|
44
|
+
);
|
|
45
|
+
request
|
|
46
|
+
.then((response) => {
|
|
47
|
+
resolve(response.data);
|
|
48
|
+
})
|
|
49
|
+
.catch((error) => {
|
|
50
|
+
reject(error);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Get the talent transformation summary for the team
|
|
57
|
+
* @param {String} teamId
|
|
58
|
+
* @param {String} authToken
|
|
59
|
+
* @returns {Promise<Object>} The talent transformation summary
|
|
60
|
+
*/
|
|
61
|
+
const getTalentTransformationSummaryForTeam = (
|
|
62
|
+
teamId: string,
|
|
63
|
+
authToken: string
|
|
64
|
+
): Promise<object> => {
|
|
65
|
+
return new Promise((resolve, reject) => {
|
|
66
|
+
const request = client.get(
|
|
67
|
+
`api/v1/talenttransformation/summaryforteam/${teamId}`,
|
|
68
|
+
authToken
|
|
69
|
+
? {
|
|
70
|
+
headers: { authorization: authToken },
|
|
71
|
+
}
|
|
72
|
+
: {}
|
|
73
|
+
);
|
|
74
|
+
request
|
|
75
|
+
.then((response) => {
|
|
76
|
+
resolve(response.data);
|
|
77
|
+
})
|
|
78
|
+
.catch((error) => {
|
|
79
|
+
reject(error);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Set talent transformation step data
|
|
86
|
+
* @param {String} id The id of the talent transformation step to be updated
|
|
87
|
+
* @param {Object} data Data used to update the talent transformation step
|
|
88
|
+
* @param {Boolean} returnAllStepsStatuses If true, return all steps statuses
|
|
89
|
+
* @param {String} token Authorization token
|
|
90
|
+
* @returns {Promise<Object>}
|
|
91
|
+
*/
|
|
92
|
+
const setTalentTransformationStepData = (
|
|
93
|
+
id: string,
|
|
94
|
+
data: object,
|
|
95
|
+
returnAllStepsStatuses: boolean,
|
|
96
|
+
token: string
|
|
97
|
+
): Promise<object> => {
|
|
98
|
+
return new Promise((resolve, reject) => {
|
|
99
|
+
const requestData = {
|
|
100
|
+
data: data,
|
|
101
|
+
id: id,
|
|
102
|
+
returnAllStepsStatuses: returnAllStepsStatuses,
|
|
103
|
+
};
|
|
104
|
+
let confirmationRequest = client.post(
|
|
105
|
+
`api/v1/talenttransformation/setdata/`,
|
|
106
|
+
requestData,
|
|
107
|
+
{
|
|
108
|
+
headers: { authorization: token },
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
confirmationRequest
|
|
112
|
+
.then((response) => {
|
|
113
|
+
resolve(response.data);
|
|
114
|
+
})
|
|
115
|
+
.catch((error) => {
|
|
116
|
+
reject(error);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export default {
|
|
122
|
+
getTalentTransformationStepsForCurrentUser,
|
|
123
|
+
getTalentTransformationSummary,
|
|
124
|
+
getTalentTransformationSummaryForTeam,
|
|
125
|
+
setTalentTransformationStepData,
|
|
126
|
+
};
|