@docbrasil/api-systemmanager 1.1.62 → 1.1.64
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/user/kanban.js +70 -6
- package/dist/bundle.cjs +70 -6
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +49 -2
- package/docs/Kanban.html +419 -9
- package/docs/user_kanban.js.html +70 -6
- package/package.json +1 -1
package/api/user/kanban.js
CHANGED
|
@@ -117,7 +117,7 @@ class Kanban {
|
|
|
117
117
|
|
|
118
118
|
const { orgId, orgProcessName, flowId } = params;
|
|
119
119
|
|
|
120
|
-
// Build API endpoint with
|
|
120
|
+
// Build API endpoint with flowId as part of the path
|
|
121
121
|
const endpoint = `/organization/${orgId}/kanban/${orgProcessName}/flow/${flowId}`;
|
|
122
122
|
|
|
123
123
|
const apiCall = self._client
|
|
@@ -129,6 +129,70 @@ class Kanban {
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
/**
|
|
133
|
+
* @author Myndware <augusto.pissarra@myndware.com>
|
|
134
|
+
* @description Updates the tasks order and status
|
|
135
|
+
* @param {Object} params - Parameters object
|
|
136
|
+
* @param {string} params.orgId - Organization id (_id database)
|
|
137
|
+
* @param {Array} params.tasks - Array of task objects containing taskId and order
|
|
138
|
+
* @param {string} params.tasks[].taskId - The unique identifier of the task to update
|
|
139
|
+
* @param {number} params.tasks[].order - The new order position for the task
|
|
140
|
+
* @param {string} params.tasks[].status - The status of the task
|
|
141
|
+
* @param {string} session - Session, token JWT
|
|
142
|
+
* @returns {promise} Promise that resolves to operation status
|
|
143
|
+
* @returns {Object} returns.data - The response data containing:
|
|
144
|
+
* @returns {boolean} returns.data.success - Indicates if the operation was successful
|
|
145
|
+
* @returns {string} [returns.data.error] - Error message if operation failed
|
|
146
|
+
* @public
|
|
147
|
+
* @example
|
|
148
|
+
*
|
|
149
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
150
|
+
* const api = new API();
|
|
151
|
+
* const params = {
|
|
152
|
+
* orgId: '55e4a3bd6be6b45210833fae',
|
|
153
|
+
* tasks: [
|
|
154
|
+
* { taskId: '507f1f77bcf86cd799439011', order: 0, status: '507f1f77bcf86cd799439012' },
|
|
155
|
+
* { taskId: '507f1f77bcf86cd799439012', order: 1, status: '507f1f77bcf86cd799439012' },
|
|
156
|
+
* { taskId: '507f1f77bcf86cd799439013', order: 0, status: '507f1f77bcf86cd799439013' }
|
|
157
|
+
* ]
|
|
158
|
+
* };
|
|
159
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
160
|
+
* const result = await api.user.kanban.updateTasksOrder(params, session);
|
|
161
|
+
*
|
|
162
|
+
* Expected response structure (success):
|
|
163
|
+
* {
|
|
164
|
+
* success: true
|
|
165
|
+
* }
|
|
166
|
+
*
|
|
167
|
+
* Expected response structure (error):
|
|
168
|
+
* {
|
|
169
|
+
* success: false,
|
|
170
|
+
* error: "One or more tasks not found"
|
|
171
|
+
* }
|
|
172
|
+
*/
|
|
173
|
+
async update(params, session) {
|
|
174
|
+
const self = this;
|
|
175
|
+
|
|
176
|
+
try {
|
|
177
|
+
Joi.assert(params, Joi.object().required(), 'Params to update tasks order');
|
|
178
|
+
Joi.assert(params.orgId, Joi.string().required(), 'Organization id (_id database)');
|
|
179
|
+
Joi.assert(params.tasks, Joi.array().required(), 'Array of task objects containing taskId and order');
|
|
180
|
+
Joi.assert(session, Joi.string().required(), 'Session token JWT');
|
|
181
|
+
|
|
182
|
+
const { orgId, tasks } = params;
|
|
183
|
+
|
|
184
|
+
// Build API endpoint for updating multiple tasks order
|
|
185
|
+
const endpoint = `/organization/${orgId}/kanban/tasks`;
|
|
186
|
+
|
|
187
|
+
const apiCall = self._client
|
|
188
|
+
.put(endpoint, { tasks }, self._setHeader(session));
|
|
189
|
+
|
|
190
|
+
return self._returnData(await apiCall);
|
|
191
|
+
} catch (ex) {
|
|
192
|
+
throw ex;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
132
196
|
/**
|
|
133
197
|
* @author Myndware <augusto.pissarra@myndware.com>
|
|
134
198
|
* @description Updates the order of a task in its status column on the Kanban board
|
|
@@ -440,7 +504,7 @@ class Kanban {
|
|
|
440
504
|
* @param {Object} params - Parameters object
|
|
441
505
|
* @param {string} params.orgId - Organization id (_id database)
|
|
442
506
|
* @param {string} params.orgProcessName - The name of the organization process
|
|
443
|
-
* @param {string} params.
|
|
507
|
+
* @param {string} params.flowId - The id of the organization process step flowId
|
|
444
508
|
* @param {Array} params.statusList - The status list with new order
|
|
445
509
|
* @param {Object} params.statusList[] - Status object configuration
|
|
446
510
|
* @param {string} params.statusList[].value - The title of the status
|
|
@@ -459,7 +523,7 @@ class Kanban {
|
|
|
459
523
|
* const params = {
|
|
460
524
|
* orgId: '55e4a3bd6be6b45210833fae',
|
|
461
525
|
* orgProcessName: 'employee-onboarding',
|
|
462
|
-
*
|
|
526
|
+
* flowId: 'Task_16888el',
|
|
463
527
|
* statusList: [
|
|
464
528
|
* { value: 'Pending', expanded: true, color: '#FF6B6B' },
|
|
465
529
|
* { value: 'In Progress', expanded: true, color: '#4ECDC4' },
|
|
@@ -488,14 +552,14 @@ class Kanban {
|
|
|
488
552
|
Joi.assert(params, Joi.object().required(), 'Params to update status list');
|
|
489
553
|
Joi.assert(params.orgId, Joi.string().required(), 'Organization id (_id database)');
|
|
490
554
|
Joi.assert(params.orgProcessName, Joi.string().required(), 'The name of the organization process');
|
|
491
|
-
Joi.assert(params.
|
|
555
|
+
Joi.assert(params.flowId, Joi.string().required(), 'The id of the organization process step flowId');
|
|
492
556
|
Joi.assert(params.statusList, Joi.array().required(), 'The status list with new order');
|
|
493
557
|
Joi.assert(session, Joi.string().required(), 'Session token JWT');
|
|
494
558
|
|
|
495
|
-
const { orgId, orgProcessName,
|
|
559
|
+
const { orgId, orgProcessName, flowId, statusList } = params;
|
|
496
560
|
|
|
497
561
|
// Build API endpoint for updating status list
|
|
498
|
-
const endpoint = `/organization/${orgId}/kanban/${orgProcessName}/flow/${
|
|
562
|
+
const endpoint = `/organization/${orgId}/kanban/${orgProcessName}/flow/${flowId}`;
|
|
499
563
|
|
|
500
564
|
const apiCall = self._client
|
|
501
565
|
.put(endpoint, { statusList }, self._setHeader(session));
|
package/dist/bundle.cjs
CHANGED
|
@@ -11890,7 +11890,7 @@ class Kanban {
|
|
|
11890
11890
|
|
|
11891
11891
|
const { orgId, orgProcessName, flowId } = params;
|
|
11892
11892
|
|
|
11893
|
-
// Build API endpoint with
|
|
11893
|
+
// Build API endpoint with flowId as part of the path
|
|
11894
11894
|
const endpoint = `/organization/${orgId}/kanban/${orgProcessName}/flow/${flowId}`;
|
|
11895
11895
|
|
|
11896
11896
|
const apiCall = self._client
|
|
@@ -11902,6 +11902,70 @@ class Kanban {
|
|
|
11902
11902
|
}
|
|
11903
11903
|
}
|
|
11904
11904
|
|
|
11905
|
+
/**
|
|
11906
|
+
* @author Myndware <augusto.pissarra@myndware.com>
|
|
11907
|
+
* @description Updates the tasks order and status
|
|
11908
|
+
* @param {Object} params - Parameters object
|
|
11909
|
+
* @param {string} params.orgId - Organization id (_id database)
|
|
11910
|
+
* @param {Array} params.tasks - Array of task objects containing taskId and order
|
|
11911
|
+
* @param {string} params.tasks[].taskId - The unique identifier of the task to update
|
|
11912
|
+
* @param {number} params.tasks[].order - The new order position for the task
|
|
11913
|
+
* @param {string} params.tasks[].status - The status of the task
|
|
11914
|
+
* @param {string} session - Session, token JWT
|
|
11915
|
+
* @returns {promise} Promise that resolves to operation status
|
|
11916
|
+
* @returns {Object} returns.data - The response data containing:
|
|
11917
|
+
* @returns {boolean} returns.data.success - Indicates if the operation was successful
|
|
11918
|
+
* @returns {string} [returns.data.error] - Error message if operation failed
|
|
11919
|
+
* @public
|
|
11920
|
+
* @example
|
|
11921
|
+
*
|
|
11922
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
11923
|
+
* const api = new API();
|
|
11924
|
+
* const params = {
|
|
11925
|
+
* orgId: '55e4a3bd6be6b45210833fae',
|
|
11926
|
+
* tasks: [
|
|
11927
|
+
* { taskId: '507f1f77bcf86cd799439011', order: 0, status: '507f1f77bcf86cd799439012' },
|
|
11928
|
+
* { taskId: '507f1f77bcf86cd799439012', order: 1, status: '507f1f77bcf86cd799439012' },
|
|
11929
|
+
* { taskId: '507f1f77bcf86cd799439013', order: 0, status: '507f1f77bcf86cd799439013' }
|
|
11930
|
+
* ]
|
|
11931
|
+
* };
|
|
11932
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
11933
|
+
* const result = await api.user.kanban.updateTasksOrder(params, session);
|
|
11934
|
+
*
|
|
11935
|
+
* Expected response structure (success):
|
|
11936
|
+
* {
|
|
11937
|
+
* success: true
|
|
11938
|
+
* }
|
|
11939
|
+
*
|
|
11940
|
+
* Expected response structure (error):
|
|
11941
|
+
* {
|
|
11942
|
+
* success: false,
|
|
11943
|
+
* error: "One or more tasks not found"
|
|
11944
|
+
* }
|
|
11945
|
+
*/
|
|
11946
|
+
async update(params, session) {
|
|
11947
|
+
const self = this;
|
|
11948
|
+
|
|
11949
|
+
try {
|
|
11950
|
+
Joi__default["default"].assert(params, Joi__default["default"].object().required(), 'Params to update tasks order');
|
|
11951
|
+
Joi__default["default"].assert(params.orgId, Joi__default["default"].string().required(), 'Organization id (_id database)');
|
|
11952
|
+
Joi__default["default"].assert(params.tasks, Joi__default["default"].array().required(), 'Array of task objects containing taskId and order');
|
|
11953
|
+
Joi__default["default"].assert(session, Joi__default["default"].string().required(), 'Session token JWT');
|
|
11954
|
+
|
|
11955
|
+
const { orgId, tasks } = params;
|
|
11956
|
+
|
|
11957
|
+
// Build API endpoint for updating multiple tasks order
|
|
11958
|
+
const endpoint = `/organization/${orgId}/kanban/tasks`;
|
|
11959
|
+
|
|
11960
|
+
const apiCall = self._client
|
|
11961
|
+
.put(endpoint, { tasks }, self._setHeader(session));
|
|
11962
|
+
|
|
11963
|
+
return self._returnData(await apiCall);
|
|
11964
|
+
} catch (ex) {
|
|
11965
|
+
throw ex;
|
|
11966
|
+
}
|
|
11967
|
+
}
|
|
11968
|
+
|
|
11905
11969
|
/**
|
|
11906
11970
|
* @author Myndware <augusto.pissarra@myndware.com>
|
|
11907
11971
|
* @description Updates the order of a task in its status column on the Kanban board
|
|
@@ -12213,7 +12277,7 @@ class Kanban {
|
|
|
12213
12277
|
* @param {Object} params - Parameters object
|
|
12214
12278
|
* @param {string} params.orgId - Organization id (_id database)
|
|
12215
12279
|
* @param {string} params.orgProcessName - The name of the organization process
|
|
12216
|
-
* @param {string} params.
|
|
12280
|
+
* @param {string} params.flowId - The id of the organization process step flowId
|
|
12217
12281
|
* @param {Array} params.statusList - The status list with new order
|
|
12218
12282
|
* @param {Object} params.statusList[] - Status object configuration
|
|
12219
12283
|
* @param {string} params.statusList[].value - The title of the status
|
|
@@ -12232,7 +12296,7 @@ class Kanban {
|
|
|
12232
12296
|
* const params = {
|
|
12233
12297
|
* orgId: '55e4a3bd6be6b45210833fae',
|
|
12234
12298
|
* orgProcessName: 'employee-onboarding',
|
|
12235
|
-
*
|
|
12299
|
+
* flowId: 'Task_16888el',
|
|
12236
12300
|
* statusList: [
|
|
12237
12301
|
* { value: 'Pending', expanded: true, color: '#FF6B6B' },
|
|
12238
12302
|
* { value: 'In Progress', expanded: true, color: '#4ECDC4' },
|
|
@@ -12261,14 +12325,14 @@ class Kanban {
|
|
|
12261
12325
|
Joi__default["default"].assert(params, Joi__default["default"].object().required(), 'Params to update status list');
|
|
12262
12326
|
Joi__default["default"].assert(params.orgId, Joi__default["default"].string().required(), 'Organization id (_id database)');
|
|
12263
12327
|
Joi__default["default"].assert(params.orgProcessName, Joi__default["default"].string().required(), 'The name of the organization process');
|
|
12264
|
-
Joi__default["default"].assert(params.
|
|
12328
|
+
Joi__default["default"].assert(params.flowId, Joi__default["default"].string().required(), 'The id of the organization process step flowId');
|
|
12265
12329
|
Joi__default["default"].assert(params.statusList, Joi__default["default"].array().required(), 'The status list with new order');
|
|
12266
12330
|
Joi__default["default"].assert(session, Joi__default["default"].string().required(), 'Session token JWT');
|
|
12267
12331
|
|
|
12268
|
-
const { orgId, orgProcessName,
|
|
12332
|
+
const { orgId, orgProcessName, flowId, statusList } = params;
|
|
12269
12333
|
|
|
12270
12334
|
// Build API endpoint for updating status list
|
|
12271
|
-
const endpoint = `/organization/${orgId}/kanban/${orgProcessName}/flow/${
|
|
12335
|
+
const endpoint = `/organization/${orgId}/kanban/${orgProcessName}/flow/${flowId}`;
|
|
12272
12336
|
|
|
12273
12337
|
const apiCall = self._client
|
|
12274
12338
|
.put(endpoint, { statusList }, self._setHeader(session));
|