@stackfactor/client-api 1.0.0
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/LICENSE +201 -0
- package/index.js +22 -0
- package/lib/actionNotifications.js +243 -0
- package/lib/address.js +29 -0
- package/lib/axios.js +216 -0
- package/lib/config.js +77 -0
- package/lib/dashboard.js +75 -0
- package/lib/departmentTrainingPlans.js +163 -0
- package/lib/groups.js +314 -0
- package/lib/integration.js +337 -0
- package/lib/integrationConfiguration.js +94 -0
- package/lib/integrations/contentgenerator.js +79 -0
- package/lib/logger.js +61 -0
- package/lib/role.js +266 -0
- package/lib/roleTemplate.js +243 -0
- package/lib/skill.js +338 -0
- package/lib/skillAssessmentTestingSession.js +143 -0
- package/lib/skillAssessments.js +139 -0
- package/lib/skillTemplate.js +248 -0
- package/lib/teams.js +277 -0
- package/lib/templateDocument.js +131 -0
- package/lib/templatePhase.js +134 -0
- package/lib/templateRelease.js +98 -0
- package/lib/templates.js +159 -0
- package/lib/tenants.js +60 -0
- package/lib/trainingPlanTemplate.js +215 -0
- package/lib/trainingPlans.js +267 -0
- package/lib/userInformation.js +89 -0
- package/lib/users.js +622 -0
- package/lib/utils.js +27 -0
- package/package.json +24 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import axios from "./axios";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
axios: axios,
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Create training plan template and set information
|
|
8
|
+
* @param {Object} data
|
|
9
|
+
* @param {String} token Authorization token
|
|
10
|
+
*/
|
|
11
|
+
createTrainingPlanTemplate(data, token) {
|
|
12
|
+
return new Promise(function (resolve, reject) {
|
|
13
|
+
let confirmationRequest = axios.put(
|
|
14
|
+
"api/v1/trainingplantemplates",
|
|
15
|
+
{ data: data },
|
|
16
|
+
{
|
|
17
|
+
headers: { authorization: token },
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
confirmationRequest
|
|
21
|
+
.then((response) => {
|
|
22
|
+
resolve(response.data);
|
|
23
|
+
})
|
|
24
|
+
.catch((error) => {
|
|
25
|
+
reject(error);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Delete training plan template
|
|
32
|
+
* @param {String} id The id of the template to be deleted
|
|
33
|
+
* @param {String} comment The comment for approver
|
|
34
|
+
* @param {String} token Authorization token
|
|
35
|
+
*/
|
|
36
|
+
deleteTrainingPlanTemplate(id, comment, token) {
|
|
37
|
+
return new Promise(function (resolve, reject) {
|
|
38
|
+
const data = {
|
|
39
|
+
id: id,
|
|
40
|
+
};
|
|
41
|
+
if (comment) data.comment = comment;
|
|
42
|
+
const request = axios.delete(`api/v1/trainingplantemplates/`, {
|
|
43
|
+
headers: { authorization: token },
|
|
44
|
+
data: data,
|
|
45
|
+
});
|
|
46
|
+
request
|
|
47
|
+
.then((response) => {
|
|
48
|
+
resolve(response.data);
|
|
49
|
+
})
|
|
50
|
+
.catch((error) => {
|
|
51
|
+
reject(error);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Discard the training plan draft changes
|
|
58
|
+
* @param {String} id The id of the training plan to be deleted
|
|
59
|
+
* @param {String} token Authorization token
|
|
60
|
+
*/
|
|
61
|
+
discardTrainingPlanChanges(id, token) {
|
|
62
|
+
return new Promise(function (resolve, reject) {
|
|
63
|
+
const data = {};
|
|
64
|
+
const request = axios.get(`api/v1/trainingplantemplates/discard/${id}`, {
|
|
65
|
+
headers: { authorization: token },
|
|
66
|
+
data: data,
|
|
67
|
+
});
|
|
68
|
+
request
|
|
69
|
+
.then((response) => {
|
|
70
|
+
resolve(response.data);
|
|
71
|
+
})
|
|
72
|
+
.catch((error) => {
|
|
73
|
+
reject(error);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Get traing plan template information
|
|
80
|
+
* @param {String} id The id of the template
|
|
81
|
+
* @param {String} token Authorization token
|
|
82
|
+
*/
|
|
83
|
+
getTrainingPlanTemplateInformationById(id, version, token) {
|
|
84
|
+
return new Promise(function (resolve, reject) {
|
|
85
|
+
let confirmationRequest = axios.get(
|
|
86
|
+
`api/v1/trainingplantemplates/${id}/${version}`,
|
|
87
|
+
{
|
|
88
|
+
headers: { authorization: token },
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
confirmationRequest
|
|
92
|
+
.then((response) => {
|
|
93
|
+
resolve(response.data);
|
|
94
|
+
})
|
|
95
|
+
.catch((error) => {
|
|
96
|
+
reject(error);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Get training plan template list
|
|
103
|
+
* @param {Array<String>} list The filter used to select the skill
|
|
104
|
+
* @param {String} version The version to be retrieved
|
|
105
|
+
* @param {String} token Authorization token
|
|
106
|
+
*/
|
|
107
|
+
getTrainingPlanTemplatesList(list, version, includeDeleted, token) {
|
|
108
|
+
return new Promise(function (resolve, reject) {
|
|
109
|
+
const requestData = {
|
|
110
|
+
version: version,
|
|
111
|
+
includeDeleted: includeDeleted,
|
|
112
|
+
};
|
|
113
|
+
if (list) requestData.list = list;
|
|
114
|
+
let confirmationRequest = axios.post(
|
|
115
|
+
`api/v1/trainingplantemplates`,
|
|
116
|
+
requestData,
|
|
117
|
+
{
|
|
118
|
+
headers: { authorization: token },
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
confirmationRequest
|
|
122
|
+
.then((response) => {
|
|
123
|
+
resolve(response.data);
|
|
124
|
+
})
|
|
125
|
+
.catch((error) => {
|
|
126
|
+
reject(error);
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Publish training pplan template
|
|
133
|
+
* @param {String} id The id of the template to be published
|
|
134
|
+
* @param {String} comment The comment to be include with the request
|
|
135
|
+
* @param {String} token Authorization token
|
|
136
|
+
*/
|
|
137
|
+
publishTrainingPlanTemplate(id, comment, token) {
|
|
138
|
+
return new Promise(function (resolve, reject) {
|
|
139
|
+
let data = {};
|
|
140
|
+
if (comment) data.comment = comment;
|
|
141
|
+
let confirmationRequest = axios.post(
|
|
142
|
+
`api/v1/trainingplantemplates/publish/${id}`,
|
|
143
|
+
data,
|
|
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
|
+
* Set training plan template profile information
|
|
160
|
+
* @param {String} id The id of the template to be updated
|
|
161
|
+
* @param {Object} data Data used to update the template
|
|
162
|
+
* @param {String} token Authorization token
|
|
163
|
+
*/
|
|
164
|
+
setTrainingPlanTemplateInformation(id, data, token) {
|
|
165
|
+
return new Promise(function (resolve, reject) {
|
|
166
|
+
const requestData = {
|
|
167
|
+
data: data,
|
|
168
|
+
id: id,
|
|
169
|
+
};
|
|
170
|
+
let confirmationRequest = axios.post(
|
|
171
|
+
`api/v1/trainingplantemplates/update/`,
|
|
172
|
+
requestData,
|
|
173
|
+
{
|
|
174
|
+
headers: { authorization: token },
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
confirmationRequest
|
|
178
|
+
.then((response) => {
|
|
179
|
+
resolve(response.data);
|
|
180
|
+
})
|
|
181
|
+
.catch((error) => {
|
|
182
|
+
reject(error);
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Update training plan template tags
|
|
189
|
+
* @param {String} id The id of the template to be updated
|
|
190
|
+
* @param {Object} tags The updated tags
|
|
191
|
+
* @param {String} token Authorization token
|
|
192
|
+
*/
|
|
193
|
+
setTrainingPlanTemplateTags(id, tags, token) {
|
|
194
|
+
return new Promise(function (resolve, reject) {
|
|
195
|
+
const requestData = {
|
|
196
|
+
tags: tags,
|
|
197
|
+
id: id,
|
|
198
|
+
};
|
|
199
|
+
let confirmationRequest = axios.post(
|
|
200
|
+
`api/v1/trainingplantemplates/updatetags/`,
|
|
201
|
+
requestData,
|
|
202
|
+
{
|
|
203
|
+
headers: { authorization: token },
|
|
204
|
+
}
|
|
205
|
+
);
|
|
206
|
+
confirmationRequest
|
|
207
|
+
.then((response) => {
|
|
208
|
+
resolve(response.data);
|
|
209
|
+
})
|
|
210
|
+
.catch((error) => {
|
|
211
|
+
reject(error);
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
},
|
|
215
|
+
};
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import axios from "./axios";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
axios: axios,
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Create training plan and set information
|
|
8
|
+
* @param {Object} data
|
|
9
|
+
* @param {Number} type
|
|
10
|
+
* @param {Boolean} saveAsDraft Save as draft flag
|
|
11
|
+
* @param {String} token Authorization token
|
|
12
|
+
*/
|
|
13
|
+
createTrainingPlan(data, type, saveAsDraft, token) {
|
|
14
|
+
return new Promise(function (resolve, reject) {
|
|
15
|
+
const requestData = {
|
|
16
|
+
data: {
|
|
17
|
+
...data,
|
|
18
|
+
},
|
|
19
|
+
saveAsDraft,
|
|
20
|
+
type,
|
|
21
|
+
};
|
|
22
|
+
let confirmationRequest = axios.put("api/v1/trainingplans", requestData, {
|
|
23
|
+
headers: { authorization: token },
|
|
24
|
+
});
|
|
25
|
+
confirmationRequest
|
|
26
|
+
.then((response) => {
|
|
27
|
+
resolve(response.data);
|
|
28
|
+
})
|
|
29
|
+
.catch((error) => {
|
|
30
|
+
reject(error);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Delete training plan
|
|
37
|
+
* @param {String} id The id of the training plan to be deleted
|
|
38
|
+
* @param {String} comment The comment for approver
|
|
39
|
+
* @param {String} token Authorization token
|
|
40
|
+
*/
|
|
41
|
+
deleteTrainingPlan(id, comment, token) {
|
|
42
|
+
return new Promise(function (resolve, reject) {
|
|
43
|
+
const data = {
|
|
44
|
+
id: id,
|
|
45
|
+
};
|
|
46
|
+
if (comment) data.comment = comment;
|
|
47
|
+
const request = axios.delete(`api/v1/trainingplans/`, {
|
|
48
|
+
headers: { authorization: token },
|
|
49
|
+
data: data,
|
|
50
|
+
});
|
|
51
|
+
request
|
|
52
|
+
.then((response) => {
|
|
53
|
+
resolve(response.data);
|
|
54
|
+
})
|
|
55
|
+
.catch((error) => {
|
|
56
|
+
reject(error);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Discard the training plan draft changes
|
|
63
|
+
* @param {String} id The id of the training plan to be deleted
|
|
64
|
+
* @param {String} token Authorization token
|
|
65
|
+
*/
|
|
66
|
+
discardTrainingPlanChanges(id, token) {
|
|
67
|
+
return new Promise(function (resolve, reject) {
|
|
68
|
+
const request = axios.get(`api/v1/trainingplans/discard/${id}`, {
|
|
69
|
+
headers: { authorization: token },
|
|
70
|
+
});
|
|
71
|
+
request
|
|
72
|
+
.then((response) => {
|
|
73
|
+
resolve(response.data);
|
|
74
|
+
})
|
|
75
|
+
.catch((error) => {
|
|
76
|
+
reject(error);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Create a new baselie
|
|
83
|
+
* @param {String} id The Id of the plan for which a new baseline is to be generated
|
|
84
|
+
* @param {Object} data The data
|
|
85
|
+
* @param {Boolean} returnMinimized If set to true just high level plan baseline information will be returned
|
|
86
|
+
* @param {Boolean} saveBaseline If set to true it will save the baseline
|
|
87
|
+
* @param {String} token Authorization token
|
|
88
|
+
*/
|
|
89
|
+
generateNewBaseline(id, data, returnMinimized, saveBaseline, token) {
|
|
90
|
+
return new Promise(function (resolve, reject) {
|
|
91
|
+
const requestData = {
|
|
92
|
+
data: data,
|
|
93
|
+
returnMinimized: returnMinimized,
|
|
94
|
+
saveBaseline: saveBaseline,
|
|
95
|
+
};
|
|
96
|
+
if (id) requestData.id = id;
|
|
97
|
+
let confirmationRequest = axios.post(
|
|
98
|
+
"api/v1/trainingplans/generatenewbaseline",
|
|
99
|
+
requestData,
|
|
100
|
+
{
|
|
101
|
+
headers: { authorization: token },
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
confirmationRequest
|
|
105
|
+
.then((response) => {
|
|
106
|
+
resolve(response.data);
|
|
107
|
+
})
|
|
108
|
+
.catch((error) => {
|
|
109
|
+
reject(error);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Get traing plan information
|
|
116
|
+
* @param {String} id The id of the training plan
|
|
117
|
+
* @param {String} token Authorization token
|
|
118
|
+
*/
|
|
119
|
+
getTrainingPlanById(id, version, token) {
|
|
120
|
+
return new Promise(function (resolve, reject) {
|
|
121
|
+
let confirmationRequest = axios.get(
|
|
122
|
+
`api/v1/trainingplans/${id}/${version}`,
|
|
123
|
+
{
|
|
124
|
+
headers: { authorization: token },
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
confirmationRequest
|
|
128
|
+
.then((response) => {
|
|
129
|
+
resolve(response.data);
|
|
130
|
+
})
|
|
131
|
+
.catch((error) => {
|
|
132
|
+
reject(error);
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Get training plans list
|
|
139
|
+
* @param {Array<ObjectId>} users The list of users for which the plans should be loaded
|
|
140
|
+
* @param {Array<Number>} types The types of plans to be loaded
|
|
141
|
+
* @param {String} version The version of the document to be retrieved
|
|
142
|
+
* @param {Array<String>} fields The fields to be selected
|
|
143
|
+
* @param {Boolean} includeDeleted If set true it will return deleted plans too
|
|
144
|
+
* @param {Boolean} returnDefaultIfVersionNotAvailable If set to true it will load the draft information if the plan was never published
|
|
145
|
+
* @param {String} token Authorization token
|
|
146
|
+
*/
|
|
147
|
+
getListOfTrainingPlans(
|
|
148
|
+
users,
|
|
149
|
+
types,
|
|
150
|
+
version,
|
|
151
|
+
fields,
|
|
152
|
+
includeDeleted,
|
|
153
|
+
includeDetailedInformation,
|
|
154
|
+
returnDefaultIfVersionNotAvailable,
|
|
155
|
+
token
|
|
156
|
+
) {
|
|
157
|
+
return new Promise(function (resolve, reject) {
|
|
158
|
+
const requestData = {
|
|
159
|
+
version: version,
|
|
160
|
+
includeDeleted: includeDeleted,
|
|
161
|
+
includeDetailedInformation: includeDetailedInformation,
|
|
162
|
+
returnDefaultIfVersionNotAvailable: returnDefaultIfVersionNotAvailable,
|
|
163
|
+
};
|
|
164
|
+
if (fields) requestData.fields = fields;
|
|
165
|
+
if (types) requestData.types = types;
|
|
166
|
+
if (users) requestData.users = users;
|
|
167
|
+
let confirmationRequest = axios.post(
|
|
168
|
+
`api/v1/trainingplans`,
|
|
169
|
+
requestData,
|
|
170
|
+
{
|
|
171
|
+
headers: { authorization: token },
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
confirmationRequest
|
|
175
|
+
.then((response) => {
|
|
176
|
+
resolve(response.data);
|
|
177
|
+
})
|
|
178
|
+
.catch((error) => {
|
|
179
|
+
reject(error);
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Publish training plan
|
|
186
|
+
* @param {String} id The id of the template to be published
|
|
187
|
+
* @param {String} comment The comment to be include with the request
|
|
188
|
+
* @param {String} token Authorization token
|
|
189
|
+
*/
|
|
190
|
+
publishTrainingPlan(id, comment, token) {
|
|
191
|
+
return new Promise(function (resolve, reject) {
|
|
192
|
+
let data = {};
|
|
193
|
+
if (comment) data.comment = comment;
|
|
194
|
+
let confirmationRequest = axios.post(
|
|
195
|
+
`api/v1/trainingplans/publish/${id}`,
|
|
196
|
+
data,
|
|
197
|
+
{
|
|
198
|
+
headers: { authorization: token },
|
|
199
|
+
}
|
|
200
|
+
);
|
|
201
|
+
confirmationRequest
|
|
202
|
+
.then((response) => {
|
|
203
|
+
resolve(response.data);
|
|
204
|
+
})
|
|
205
|
+
.catch((error) => {
|
|
206
|
+
reject(error);
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Update training plan
|
|
213
|
+
* @param {String} id The ID of the training plan
|
|
214
|
+
* @param {Object} data The updated data
|
|
215
|
+
* @param {String} token Authorization token
|
|
216
|
+
*/
|
|
217
|
+
updateTrainingPlan(planId, data, saveAsDraft, token) {
|
|
218
|
+
return new Promise(function (resolve, reject) {
|
|
219
|
+
const requestData = {
|
|
220
|
+
data: data,
|
|
221
|
+
id: planId,
|
|
222
|
+
saveAsDraft,
|
|
223
|
+
};
|
|
224
|
+
let confirmationRequest = axios.put(
|
|
225
|
+
`api/v1/trainingplans/update/${planId}`,
|
|
226
|
+
requestData,
|
|
227
|
+
{
|
|
228
|
+
headers: { authorization: token },
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
confirmationRequest
|
|
232
|
+
.then((response) => {
|
|
233
|
+
resolve(response.data);
|
|
234
|
+
})
|
|
235
|
+
.catch((error) => {
|
|
236
|
+
reject(error);
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
},
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Update a task
|
|
243
|
+
* @param {String} planId
|
|
244
|
+
* @param {Object} data Ordered array of objects containing the activity Id and the new status
|
|
245
|
+
* @param {Function} successCallBack
|
|
246
|
+
* @param {Function} failCallBack
|
|
247
|
+
* @returns {Object} An object containing the task information
|
|
248
|
+
*/
|
|
249
|
+
updateActivities(planId, data, token) {
|
|
250
|
+
return new Promise(function (resolve, reject) {
|
|
251
|
+
let confirmationRequest = axios.post(
|
|
252
|
+
`api/v1/trainingplans/${planId}/activities`,
|
|
253
|
+
data,
|
|
254
|
+
{
|
|
255
|
+
headers: { authorization: token },
|
|
256
|
+
}
|
|
257
|
+
);
|
|
258
|
+
confirmationRequest
|
|
259
|
+
.then(() => {
|
|
260
|
+
resolve();
|
|
261
|
+
})
|
|
262
|
+
.catch((error) => {
|
|
263
|
+
reject(error);
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
},
|
|
267
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import axios from "./axios";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
axios: axios,
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Add an entry to an array type business property such as experience, education or certifications
|
|
8
|
+
* @param {String} userId
|
|
9
|
+
* @param {String} property
|
|
10
|
+
* @param {Object} data
|
|
11
|
+
* @param {String} token Authorization token
|
|
12
|
+
*/
|
|
13
|
+
addEntryToArrayBusinessProperty(userId, property, data, token) {
|
|
14
|
+
return new Promise(function (resolve, reject) {
|
|
15
|
+
const requestData = {
|
|
16
|
+
data: data,
|
|
17
|
+
};
|
|
18
|
+
let confirmationRequest = axios.post(
|
|
19
|
+
`api/v1/user/arrayproperty/${userId}/${property}`,
|
|
20
|
+
requestData,
|
|
21
|
+
{
|
|
22
|
+
headers: { authorization: token },
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
confirmationRequest
|
|
26
|
+
.then((response) => {
|
|
27
|
+
resolve(response.data);
|
|
28
|
+
})
|
|
29
|
+
.catch((error) => {
|
|
30
|
+
reject(error);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Update an entry from an array type business property such as experience, education or certifications
|
|
37
|
+
* @param {String} userId
|
|
38
|
+
* @param {String} property
|
|
39
|
+
* @param {String} id
|
|
40
|
+
* @param {String} token Authorization token
|
|
41
|
+
*/
|
|
42
|
+
removeEntryFromArrayBusinessProperty(userId, property, id, token) {
|
|
43
|
+
return new Promise(function (resolve, reject) {
|
|
44
|
+
const confirmationRequest = axios.delete(
|
|
45
|
+
`api/v1/user/arrayproperty/${userId}/${property}/${id}`,
|
|
46
|
+
{
|
|
47
|
+
headers: { authorization: token },
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
confirmationRequest
|
|
51
|
+
.then((response) => {
|
|
52
|
+
resolve(response.data);
|
|
53
|
+
})
|
|
54
|
+
.catch((error) => {
|
|
55
|
+
reject(error);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Update an entry from an array type business property such as experience, education or certifications
|
|
62
|
+
* @param {String} userId
|
|
63
|
+
* @param {String} property
|
|
64
|
+
* @param {String} id
|
|
65
|
+
* @param {Object} data
|
|
66
|
+
* @param {String} token Authorization token
|
|
67
|
+
*/
|
|
68
|
+
updateEntryfromArrayBusinessProperty(userId, property, id, data, token) {
|
|
69
|
+
return new Promise(function (resolve, reject) {
|
|
70
|
+
const requestData = {
|
|
71
|
+
data: data,
|
|
72
|
+
};
|
|
73
|
+
let confirmationRequest = axios.patch(
|
|
74
|
+
`api/v1/user/arrayproperty/${userId}/${property}/${id}`,
|
|
75
|
+
requestData,
|
|
76
|
+
{
|
|
77
|
+
headers: { authorization: token },
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
confirmationRequest
|
|
81
|
+
.then((response) => {
|
|
82
|
+
resolve(response.data);
|
|
83
|
+
})
|
|
84
|
+
.catch((error) => {
|
|
85
|
+
reject(error);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
};
|