@docbrasil/api-systemmanager 1.0.89 → 1.0.91
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/api/admin/doctypes.js +76 -76
- package/api/admin/document.js +332 -332
- package/api/admin/form.js +151 -151
- package/api/admin/index.js +46 -46
- package/api/admin/list.js +133 -133
- package/api/admin/message.js +194 -194
- package/api/admin/notification.js +233 -233
- package/api/admin/organization.js +124 -124
- package/api/admin/plugin.js +116 -116
- package/api/admin/policy.js +78 -78
- package/api/admin/processes.js +370 -370
- package/api/admin/task.js +125 -125
- package/api/admin/user.js +185 -185
- package/api/dispatch.js +101 -101
- package/api/general/geoLocation.js +88 -88
- package/api/general/index.js +22 -22
- package/api/login.js +267 -267
- package/api/session.js +85 -85
- package/api/user/datasource.js +144 -144
- package/api/user/document.js +730 -730
- package/api/user/index.js +39 -39
- package/api/user/notification.js +101 -101
- package/api/user/organization.js +230 -230
- package/api/user/process.js +191 -191
- package/api/user/register.js +205 -205
- package/api/user/task.js +201 -201
- package/api/user/task_available.js +135 -135
- package/api/user/user.js +287 -287
- package/api/utils/cypher.js +37 -37
- package/api/utils/promises.js +118 -118
- package/bundleRollup.js +158 -158
- package/dist/bundle.cjs +4875 -4875
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +674 -336
- package/doc.md +653 -653
- package/helper/boom.js +487 -487
- package/helper/cryptojs.js +6067 -6067
- package/index.js +85 -85
- package/package-lock.json +4635 -4635
- package/package.json +68 -68
- package/readme.md +25 -25
- package/tests/admin/document.spec.js +45 -45
- package/tests/admin/form.spec.js +74 -74
- package/tests/admin/list.spec.js +86 -86
- package/tests/admin/message.js +92 -92
- package/tests/admin/notification.spec.js +174 -174
- package/tests/admin/pluginspec..js +71 -71
- package/tests/admin/policy.spec.js +71 -71
- package/tests/admin/processes.spec.js +119 -119
- package/tests/admin/users.spec.js +127 -127
- package/tests/documents.spec.js +164 -164
- package/tests/login.spec.js +91 -91
- package/tests/session.spec..js +58 -58
- package/tests/user/documents.js +164 -164
- package/tests/user/organization.js +122 -122
- package/tests/user/process.js +71 -71
- package/tests/user/user.js +88 -88
package/api/user/task.js
CHANGED
|
@@ -1,201 +1,201 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
import Boom from '@hapi/boom';
|
|
3
|
-
import Joi from 'joi';
|
|
4
|
-
import TaskAvailable from './task_available';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Class for task, permission user
|
|
8
|
-
* @class
|
|
9
|
-
*/
|
|
10
|
-
class Task {
|
|
11
|
-
|
|
12
|
-
constructor(options) {
|
|
13
|
-
Joi.assert(options, Joi.object().required());
|
|
14
|
-
Joi.assert(options.parent, Joi.object().required());
|
|
15
|
-
|
|
16
|
-
const self = this;
|
|
17
|
-
self.parent = options.parent;
|
|
18
|
-
self._client = self.parent.dispatch.getClient();
|
|
19
|
-
self.available = new TaskAvailable(options);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @author Augusto Pissarra <abernardo.br@gmail.com>
|
|
24
|
-
* @description Get the return data and check for errors
|
|
25
|
-
* @param {object} retData Response HTTP
|
|
26
|
-
* @return {*}
|
|
27
|
-
* @private
|
|
28
|
-
*/
|
|
29
|
-
_returnData(retData, def = {}) {
|
|
30
|
-
if (retData.status !== 200) {
|
|
31
|
-
return Boom.badRequest(_.get(retData, 'message', 'No error message reported!'))
|
|
32
|
-
} else {
|
|
33
|
-
return _.get(retData, 'data', def);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
39
|
-
* @description Set header with new session
|
|
40
|
-
* @param {string} session Session, token JWT
|
|
41
|
-
* @return {object} header with new session
|
|
42
|
-
* @private
|
|
43
|
-
*/
|
|
44
|
-
_setHeader(session) {
|
|
45
|
-
return {
|
|
46
|
-
headers: {
|
|
47
|
-
authorization: session,
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
54
|
-
* @description Method to find task by id
|
|
55
|
-
* @param {object} params Params to get task
|
|
56
|
-
* @param {object} params.processId Proccess id (_id database)
|
|
57
|
-
* @param {object} params.taskId Task id (_id database)
|
|
58
|
-
* @param {object} params.orgId Organization id (_id database)
|
|
59
|
-
* @param {string} session Session, token JWT
|
|
60
|
-
* @returns {promise}
|
|
61
|
-
* @public
|
|
62
|
-
* @example
|
|
63
|
-
*
|
|
64
|
-
* const API = require('@docbrasil/api-systemmanager');
|
|
65
|
-
* const api = new API();
|
|
66
|
-
* const params = {
|
|
67
|
-
* processId: '5dadd01dc4af3941d42f8c5c',
|
|
68
|
-
* taskId: '5df7f19618430c89a41a19d2',
|
|
69
|
-
* orgId: '55e4a3bd6be6b45210833fae',
|
|
70
|
-
* };
|
|
71
|
-
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
72
|
-
* await api.user.task.findById(params, session);
|
|
73
|
-
*/
|
|
74
|
-
async findById(params, session) {
|
|
75
|
-
const self = this;
|
|
76
|
-
|
|
77
|
-
try {
|
|
78
|
-
Joi.assert(params, Joi.object().required(), 'Params to get task');
|
|
79
|
-
Joi.assert(params.processId, Joi.string().required(), ' Proccess id (_id database)');
|
|
80
|
-
Joi.assert(params.taskId, Joi.string().required(), ' Task id (_id database)');
|
|
81
|
-
Joi.assert(params.orgId, Joi.string().required(), 'Organization id (_id database)');
|
|
82
|
-
Joi.assert(session, Joi.string().required(), 'Session token JWT');
|
|
83
|
-
|
|
84
|
-
const {processId, taskId, orgId} = params;
|
|
85
|
-
const apiCall = self._client
|
|
86
|
-
.get(`/organizations/${orgId}/process/${processId}/execute/${taskId}`, self._setHeader(session));
|
|
87
|
-
|
|
88
|
-
return self._returnData(await apiCall);
|
|
89
|
-
} catch (ex) {
|
|
90
|
-
throw ex;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
96
|
-
* @description Find task by id and update
|
|
97
|
-
* @param {object} params Params to update task
|
|
98
|
-
* @param {object} params.userId User id (_id database)
|
|
99
|
-
* @param {string} params.processId Proccess id (_id database)
|
|
100
|
-
* @param {string} params.taskId Task id (_id database)
|
|
101
|
-
* @param {string} params.flowName Flow name
|
|
102
|
-
* @param {string} params.action Button action
|
|
103
|
-
* @param {object} params.formData Data to update task
|
|
104
|
-
* @param {string=} params.actionGuid GUID of the action
|
|
105
|
-
* @param {string} params.orgId Organization id (_id database)
|
|
106
|
-
* @param {string} session Session, token JWT
|
|
107
|
-
* @return {Promise}
|
|
108
|
-
* @public
|
|
109
|
-
* @async
|
|
110
|
-
* @example
|
|
111
|
-
*
|
|
112
|
-
* const API = require('@docbrasil/api-systemmanager');
|
|
113
|
-
* const api = new API();
|
|
114
|
-
* const params = {
|
|
115
|
-
* userId: '5739d4c6ccb0ebc61f2a9557',
|
|
116
|
-
* processId: '5dadd01dc4af3941d42f8c5c',
|
|
117
|
-
* taskId: '5df7f19618430c89a41a19d2',
|
|
118
|
-
* action: 1,
|
|
119
|
-
* formData: {name: 'CloudBrasil'},
|
|
120
|
-
* };
|
|
121
|
-
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
122
|
-
* await api.user.task.findByIdAndUpdate(params, session);
|
|
123
|
-
*/
|
|
124
|
-
async findByIdAndUpdate(params, session) {
|
|
125
|
-
const self = this;
|
|
126
|
-
|
|
127
|
-
try {
|
|
128
|
-
Joi.assert(params, Joi.object().required());
|
|
129
|
-
Joi.assert(params.userId, Joi.string().required(), 'User id (_id database)');
|
|
130
|
-
Joi.assert(params.processId, Joi.string().required(), 'Proccess id (_id database)');
|
|
131
|
-
Joi.assert(params.taskId, Joi.string().required(), 'Task id (_id database)');
|
|
132
|
-
Joi.assert(params.flowName, Joi.string().required(), 'Flow name');
|
|
133
|
-
Joi.assert(params.action, Joi.number().required(), 'Button action');
|
|
134
|
-
Joi.assert(params.formData, Joi.object().required(), 'Data to update task');
|
|
135
|
-
Joi.assert(params.actionGuid, Joi.string(), 'GUID of the action');
|
|
136
|
-
Joi.assert(params.orgId, Joi.string().required(), 'Organization id (_id database)');
|
|
137
|
-
Joi.assert(params.contextToBody, Joi.string(), 'Context to body');
|
|
138
|
-
|
|
139
|
-
const {processId, taskId, flowName, action, actionGuid, formData, orgId, contextToBody} = params;
|
|
140
|
-
const body = contextToBody ? {[contextToBody]: formData} : {...formData};
|
|
141
|
-
|
|
142
|
-
const getUrl = {
|
|
143
|
-
0: () => `organizations/${orgId}/users/tasks/${taskId}/action/${actionGuid}`,
|
|
144
|
-
1: () => `organizations/${orgId}/adhoc/${processId}/save/${taskId}/${flowName}`,
|
|
145
|
-
2: () => `organizations/${orgId}/adhoc/${processId}/endprocess/${taskId}/${flowName}`
|
|
146
|
-
};
|
|
147
|
-
const url = getUrl[action]();
|
|
148
|
-
const apiCall = self._client.put(url, body, self._setHeader(session));
|
|
149
|
-
return self._returnData(await apiCall);
|
|
150
|
-
} catch (ex) {
|
|
151
|
-
throw ex;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
157
|
-
* @description Find task by id and update
|
|
158
|
-
* @param {!object} params Params - to update task
|
|
159
|
-
* @param {!string} params.taskId - Task id (_id database)
|
|
160
|
-
* @param {!string} params.actionGuid - GUID of the action
|
|
161
|
-
* @param {!string} params.orgId - Organization id (_id database)
|
|
162
|
-
* @param {any} params.orgId={} - Payload to send in action
|
|
163
|
-
* @param {string} session Session, token JWT
|
|
164
|
-
* @return {Promise}
|
|
165
|
-
* @public
|
|
166
|
-
* @async
|
|
167
|
-
* @example
|
|
168
|
-
*
|
|
169
|
-
* const API = require('@docbrasil/api-systemmanager');
|
|
170
|
-
* const api = new API();
|
|
171
|
-
* const params = {
|
|
172
|
-
* taskId: '5df7f19618430c89a41a19d2',
|
|
173
|
-
* actionGuid: 'b3823a2ae52c7a05bfb9590fe427038d'
|
|
174
|
-
* orgId: '5df7f19618430c89a41a1bc3',
|
|
175
|
-
* body: {}',
|
|
176
|
-
* };
|
|
177
|
-
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
178
|
-
* await api.user.task.executeActionFinalize(params, session);
|
|
179
|
-
*/
|
|
180
|
-
async executeActionFinalize(params, session) {
|
|
181
|
-
const self = this;
|
|
182
|
-
|
|
183
|
-
try {
|
|
184
|
-
Joi.assert(params, Joi.object().required());
|
|
185
|
-
Joi.assert(params.taskId, Joi.string().required(), 'Task id (_id database)');
|
|
186
|
-
Joi.assert(params.actionGuid, Joi.string(), 'GUID of the action');
|
|
187
|
-
Joi.assert(params.orgId, Joi.string().required(), 'Organization id (_id database)');
|
|
188
|
-
Joi.assert(params.payload, Joi.any(), 'Payload to send in action');
|
|
189
|
-
|
|
190
|
-
const {taskId, actionGuid, orgId, payload = {}} = params;
|
|
191
|
-
const url = `organizations/${orgId}/users/tasks/${taskId}/action/${actionGuid}`;
|
|
192
|
-
const apiCall = self._client.put(url, payload, self._setHeader(session));
|
|
193
|
-
|
|
194
|
-
return self._returnData(await apiCall);
|
|
195
|
-
} catch (ex) {
|
|
196
|
-
throw ex;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
export default Task;
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import Boom from '@hapi/boom';
|
|
3
|
+
import Joi from 'joi';
|
|
4
|
+
import TaskAvailable from './task_available';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Class for task, permission user
|
|
8
|
+
* @class
|
|
9
|
+
*/
|
|
10
|
+
class Task {
|
|
11
|
+
|
|
12
|
+
constructor(options) {
|
|
13
|
+
Joi.assert(options, Joi.object().required());
|
|
14
|
+
Joi.assert(options.parent, Joi.object().required());
|
|
15
|
+
|
|
16
|
+
const self = this;
|
|
17
|
+
self.parent = options.parent;
|
|
18
|
+
self._client = self.parent.dispatch.getClient();
|
|
19
|
+
self.available = new TaskAvailable(options);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @author Augusto Pissarra <abernardo.br@gmail.com>
|
|
24
|
+
* @description Get the return data and check for errors
|
|
25
|
+
* @param {object} retData Response HTTP
|
|
26
|
+
* @return {*}
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
29
|
+
_returnData(retData, def = {}) {
|
|
30
|
+
if (retData.status !== 200) {
|
|
31
|
+
return Boom.badRequest(_.get(retData, 'message', 'No error message reported!'))
|
|
32
|
+
} else {
|
|
33
|
+
return _.get(retData, 'data', def);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
39
|
+
* @description Set header with new session
|
|
40
|
+
* @param {string} session Session, token JWT
|
|
41
|
+
* @return {object} header with new session
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
_setHeader(session) {
|
|
45
|
+
return {
|
|
46
|
+
headers: {
|
|
47
|
+
authorization: session,
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
54
|
+
* @description Method to find task by id
|
|
55
|
+
* @param {object} params Params to get task
|
|
56
|
+
* @param {object} params.processId Proccess id (_id database)
|
|
57
|
+
* @param {object} params.taskId Task id (_id database)
|
|
58
|
+
* @param {object} params.orgId Organization id (_id database)
|
|
59
|
+
* @param {string} session Session, token JWT
|
|
60
|
+
* @returns {promise}
|
|
61
|
+
* @public
|
|
62
|
+
* @example
|
|
63
|
+
*
|
|
64
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
65
|
+
* const api = new API();
|
|
66
|
+
* const params = {
|
|
67
|
+
* processId: '5dadd01dc4af3941d42f8c5c',
|
|
68
|
+
* taskId: '5df7f19618430c89a41a19d2',
|
|
69
|
+
* orgId: '55e4a3bd6be6b45210833fae',
|
|
70
|
+
* };
|
|
71
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
72
|
+
* await api.user.task.findById(params, session);
|
|
73
|
+
*/
|
|
74
|
+
async findById(params, session) {
|
|
75
|
+
const self = this;
|
|
76
|
+
|
|
77
|
+
try {
|
|
78
|
+
Joi.assert(params, Joi.object().required(), 'Params to get task');
|
|
79
|
+
Joi.assert(params.processId, Joi.string().required(), ' Proccess id (_id database)');
|
|
80
|
+
Joi.assert(params.taskId, Joi.string().required(), ' Task id (_id database)');
|
|
81
|
+
Joi.assert(params.orgId, Joi.string().required(), 'Organization id (_id database)');
|
|
82
|
+
Joi.assert(session, Joi.string().required(), 'Session token JWT');
|
|
83
|
+
|
|
84
|
+
const {processId, taskId, orgId} = params;
|
|
85
|
+
const apiCall = self._client
|
|
86
|
+
.get(`/organizations/${orgId}/process/${processId}/execute/${taskId}`, self._setHeader(session));
|
|
87
|
+
|
|
88
|
+
return self._returnData(await apiCall);
|
|
89
|
+
} catch (ex) {
|
|
90
|
+
throw ex;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
96
|
+
* @description Find task by id and update
|
|
97
|
+
* @param {object} params Params to update task
|
|
98
|
+
* @param {object} params.userId User id (_id database)
|
|
99
|
+
* @param {string} params.processId Proccess id (_id database)
|
|
100
|
+
* @param {string} params.taskId Task id (_id database)
|
|
101
|
+
* @param {string} params.flowName Flow name
|
|
102
|
+
* @param {string} params.action Button action
|
|
103
|
+
* @param {object} params.formData Data to update task
|
|
104
|
+
* @param {string=} params.actionGuid GUID of the action
|
|
105
|
+
* @param {string} params.orgId Organization id (_id database)
|
|
106
|
+
* @param {string} session Session, token JWT
|
|
107
|
+
* @return {Promise}
|
|
108
|
+
* @public
|
|
109
|
+
* @async
|
|
110
|
+
* @example
|
|
111
|
+
*
|
|
112
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
113
|
+
* const api = new API();
|
|
114
|
+
* const params = {
|
|
115
|
+
* userId: '5739d4c6ccb0ebc61f2a9557',
|
|
116
|
+
* processId: '5dadd01dc4af3941d42f8c5c',
|
|
117
|
+
* taskId: '5df7f19618430c89a41a19d2',
|
|
118
|
+
* action: 1,
|
|
119
|
+
* formData: {name: 'CloudBrasil'},
|
|
120
|
+
* };
|
|
121
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
122
|
+
* await api.user.task.findByIdAndUpdate(params, session);
|
|
123
|
+
*/
|
|
124
|
+
async findByIdAndUpdate(params, session) {
|
|
125
|
+
const self = this;
|
|
126
|
+
|
|
127
|
+
try {
|
|
128
|
+
Joi.assert(params, Joi.object().required());
|
|
129
|
+
Joi.assert(params.userId, Joi.string().required(), 'User id (_id database)');
|
|
130
|
+
Joi.assert(params.processId, Joi.string().required(), 'Proccess id (_id database)');
|
|
131
|
+
Joi.assert(params.taskId, Joi.string().required(), 'Task id (_id database)');
|
|
132
|
+
Joi.assert(params.flowName, Joi.string().required(), 'Flow name');
|
|
133
|
+
Joi.assert(params.action, Joi.number().required(), 'Button action');
|
|
134
|
+
Joi.assert(params.formData, Joi.object().required(), 'Data to update task');
|
|
135
|
+
Joi.assert(params.actionGuid, Joi.string(), 'GUID of the action');
|
|
136
|
+
Joi.assert(params.orgId, Joi.string().required(), 'Organization id (_id database)');
|
|
137
|
+
Joi.assert(params.contextToBody, Joi.string(), 'Context to body');
|
|
138
|
+
|
|
139
|
+
const {processId, taskId, flowName, action, actionGuid, formData, orgId, contextToBody} = params;
|
|
140
|
+
const body = contextToBody ? {[contextToBody]: formData} : {...formData};
|
|
141
|
+
|
|
142
|
+
const getUrl = {
|
|
143
|
+
0: () => `organizations/${orgId}/users/tasks/${taskId}/action/${actionGuid}`,
|
|
144
|
+
1: () => `organizations/${orgId}/adhoc/${processId}/save/${taskId}/${flowName}`,
|
|
145
|
+
2: () => `organizations/${orgId}/adhoc/${processId}/endprocess/${taskId}/${flowName}`
|
|
146
|
+
};
|
|
147
|
+
const url = getUrl[action]();
|
|
148
|
+
const apiCall = self._client.put(url, body, self._setHeader(session));
|
|
149
|
+
return self._returnData(await apiCall);
|
|
150
|
+
} catch (ex) {
|
|
151
|
+
throw ex;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
157
|
+
* @description Find task by id and update
|
|
158
|
+
* @param {!object} params Params - to update task
|
|
159
|
+
* @param {!string} params.taskId - Task id (_id database)
|
|
160
|
+
* @param {!string} params.actionGuid - GUID of the action
|
|
161
|
+
* @param {!string} params.orgId - Organization id (_id database)
|
|
162
|
+
* @param {any} params.orgId={} - Payload to send in action
|
|
163
|
+
* @param {string} session Session, token JWT
|
|
164
|
+
* @return {Promise}
|
|
165
|
+
* @public
|
|
166
|
+
* @async
|
|
167
|
+
* @example
|
|
168
|
+
*
|
|
169
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
170
|
+
* const api = new API();
|
|
171
|
+
* const params = {
|
|
172
|
+
* taskId: '5df7f19618430c89a41a19d2',
|
|
173
|
+
* actionGuid: 'b3823a2ae52c7a05bfb9590fe427038d'
|
|
174
|
+
* orgId: '5df7f19618430c89a41a1bc3',
|
|
175
|
+
* body: {}',
|
|
176
|
+
* };
|
|
177
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
178
|
+
* await api.user.task.executeActionFinalize(params, session);
|
|
179
|
+
*/
|
|
180
|
+
async executeActionFinalize(params, session) {
|
|
181
|
+
const self = this;
|
|
182
|
+
|
|
183
|
+
try {
|
|
184
|
+
Joi.assert(params, Joi.object().required());
|
|
185
|
+
Joi.assert(params.taskId, Joi.string().required(), 'Task id (_id database)');
|
|
186
|
+
Joi.assert(params.actionGuid, Joi.string(), 'GUID of the action');
|
|
187
|
+
Joi.assert(params.orgId, Joi.string().required(), 'Organization id (_id database)');
|
|
188
|
+
Joi.assert(params.payload, Joi.any(), 'Payload to send in action');
|
|
189
|
+
|
|
190
|
+
const {taskId, actionGuid, orgId, payload = {}} = params;
|
|
191
|
+
const url = `organizations/${orgId}/users/tasks/${taskId}/action/${actionGuid}`;
|
|
192
|
+
const apiCall = self._client.put(url, payload, self._setHeader(session));
|
|
193
|
+
|
|
194
|
+
return self._returnData(await apiCall);
|
|
195
|
+
} catch (ex) {
|
|
196
|
+
throw ex;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export default Task;
|