@docbrasil/api-systemmanager 1.1.63 → 1.1.65
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 +148 -0
- package/dist/bundle.cjs +148 -0
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +97 -0
- package/docs/Kanban.html +961 -6
- package/docs/user_kanban.js.html +148 -0
- package/package.json +1 -1
package/api/user/kanban.js
CHANGED
|
@@ -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
|
|
@@ -443,6 +507,7 @@ class Kanban {
|
|
|
443
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
|
|
510
|
+
* @param {string} params.statusList[].guid - The guid of the status (the id)
|
|
446
511
|
* @param {string} params.statusList[].value - The title of the status
|
|
447
512
|
* @param {boolean} params.statusList[].expanded - If the status column is expanded or not
|
|
448
513
|
* @param {string} params.statusList[].color - The hexadecimal color code for the status
|
|
@@ -505,6 +570,89 @@ class Kanban {
|
|
|
505
570
|
throw ex;
|
|
506
571
|
}
|
|
507
572
|
}
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* @author Myndware <augusto.pissarra@myndware.com>
|
|
576
|
+
* @description Starts a new task in the Kanban board for a specific organization process
|
|
577
|
+
* @param {Object} params - Parameters object
|
|
578
|
+
* @param {string} params.orgId - Organization id (_id database)
|
|
579
|
+
* @param {string} params.orgProcessName - The name of the organization process
|
|
580
|
+
* @param {string} params.title - The title of the new task
|
|
581
|
+
* @param {string} params.status - The status id of the new task
|
|
582
|
+
* @param {Array} [params.tags] - Array of tag ids for the new task (optional)
|
|
583
|
+
* @param {Array} [params.tasks] - The task ids of each task inside the same status (optional)
|
|
584
|
+
* @param {string} session - Session, token JWT
|
|
585
|
+
* @returns {promise} Promise that resolves to operation status
|
|
586
|
+
* @returns {Object} returns.data - The response data containing:
|
|
587
|
+
* @returns {boolean} returns.data.success - Indicates if the operation was successful
|
|
588
|
+
* @returns {string} [returns.data.taskId] - The ID of the newly created task
|
|
589
|
+
* @returns {string} [returns.data.error] - Error message if operation failed
|
|
590
|
+
* @public
|
|
591
|
+
* @example
|
|
592
|
+
*
|
|
593
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
594
|
+
* const api = new API();
|
|
595
|
+
* const params = {
|
|
596
|
+
* orgId: '55e4a3bd6be6b45210833fae',
|
|
597
|
+
* orgProcessName: 'employee-onboarding',
|
|
598
|
+
* title: 'Complete employee documentation',
|
|
599
|
+
* status: '507f1f77bcf86cd799439014',
|
|
600
|
+
* tags: ['507f1f77bcf86cd799439015', '507f1f77bcf86cd799439016'],
|
|
601
|
+
* tasks: ['507f1f77bcf86cd799439011', '507f1f77bcf86cd799439012']
|
|
602
|
+
* };
|
|
603
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
604
|
+
* const result = await api.user.kanban.startTask(params, session);
|
|
605
|
+
*
|
|
606
|
+
* Expected response structure (success):
|
|
607
|
+
* {
|
|
608
|
+
* success: true,
|
|
609
|
+
* taskId: '507f1f77bcf86cd799439013'
|
|
610
|
+
* }
|
|
611
|
+
*
|
|
612
|
+
* Expected response structure (error):
|
|
613
|
+
* {
|
|
614
|
+
* success: false,
|
|
615
|
+
* error: "Organization process not found"
|
|
616
|
+
* }
|
|
617
|
+
*/
|
|
618
|
+
async startTask(params, session) {
|
|
619
|
+
const self = this;
|
|
620
|
+
|
|
621
|
+
try {
|
|
622
|
+
Joi.assert(params, Joi.object().required(), 'Params to start task');
|
|
623
|
+
Joi.assert(params.orgId, Joi.string().required(), 'Organization id (_id database)');
|
|
624
|
+
Joi.assert(params.orgProcessName, Joi.string().required(), 'The name of the organization process');
|
|
625
|
+
Joi.assert(params.title, Joi.string().required(), 'The title of the new task');
|
|
626
|
+
Joi.assert(params.status, Joi.string().required(), 'The status id of the new task');
|
|
627
|
+
Joi.assert(session, Joi.string().required(), 'Session token JWT');
|
|
628
|
+
|
|
629
|
+
const {
|
|
630
|
+
orgId,
|
|
631
|
+
orgProcessName,
|
|
632
|
+
title,
|
|
633
|
+
status,
|
|
634
|
+
tags = [],
|
|
635
|
+
tasks = []
|
|
636
|
+
} = params;
|
|
637
|
+
|
|
638
|
+
// Build API endpoint for starting a new task
|
|
639
|
+
const endpoint = `/organization/${orgId}/kanban/${orgProcessName}/tasks`;
|
|
640
|
+
|
|
641
|
+
const payload = {
|
|
642
|
+
title,
|
|
643
|
+
status,
|
|
644
|
+
tags,
|
|
645
|
+
tasks
|
|
646
|
+
};
|
|
647
|
+
|
|
648
|
+
const apiCall = self._client
|
|
649
|
+
.put(endpoint, payload, self._setHeader(session));
|
|
650
|
+
|
|
651
|
+
return self._returnData(await apiCall);
|
|
652
|
+
} catch (ex) {
|
|
653
|
+
throw ex;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
508
656
|
}
|
|
509
657
|
|
|
510
658
|
export default Kanban;
|
package/dist/bundle.cjs
CHANGED
|
@@ -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
|
|
@@ -12216,6 +12280,7 @@ class Kanban {
|
|
|
12216
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
|
|
12283
|
+
* @param {string} params.statusList[].guid - The guid of the status (the id)
|
|
12219
12284
|
* @param {string} params.statusList[].value - The title of the status
|
|
12220
12285
|
* @param {boolean} params.statusList[].expanded - If the status column is expanded or not
|
|
12221
12286
|
* @param {string} params.statusList[].color - The hexadecimal color code for the status
|
|
@@ -12278,6 +12343,89 @@ class Kanban {
|
|
|
12278
12343
|
throw ex;
|
|
12279
12344
|
}
|
|
12280
12345
|
}
|
|
12346
|
+
|
|
12347
|
+
/**
|
|
12348
|
+
* @author Myndware <augusto.pissarra@myndware.com>
|
|
12349
|
+
* @description Starts a new task in the Kanban board for a specific organization process
|
|
12350
|
+
* @param {Object} params - Parameters object
|
|
12351
|
+
* @param {string} params.orgId - Organization id (_id database)
|
|
12352
|
+
* @param {string} params.orgProcessName - The name of the organization process
|
|
12353
|
+
* @param {string} params.title - The title of the new task
|
|
12354
|
+
* @param {string} params.status - The status id of the new task
|
|
12355
|
+
* @param {Array} [params.tags] - Array of tag ids for the new task (optional)
|
|
12356
|
+
* @param {Array} [params.tasks] - The task ids of each task inside the same status (optional)
|
|
12357
|
+
* @param {string} session - Session, token JWT
|
|
12358
|
+
* @returns {promise} Promise that resolves to operation status
|
|
12359
|
+
* @returns {Object} returns.data - The response data containing:
|
|
12360
|
+
* @returns {boolean} returns.data.success - Indicates if the operation was successful
|
|
12361
|
+
* @returns {string} [returns.data.taskId] - The ID of the newly created task
|
|
12362
|
+
* @returns {string} [returns.data.error] - Error message if operation failed
|
|
12363
|
+
* @public
|
|
12364
|
+
* @example
|
|
12365
|
+
*
|
|
12366
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
12367
|
+
* const api = new API();
|
|
12368
|
+
* const params = {
|
|
12369
|
+
* orgId: '55e4a3bd6be6b45210833fae',
|
|
12370
|
+
* orgProcessName: 'employee-onboarding',
|
|
12371
|
+
* title: 'Complete employee documentation',
|
|
12372
|
+
* status: '507f1f77bcf86cd799439014',
|
|
12373
|
+
* tags: ['507f1f77bcf86cd799439015', '507f1f77bcf86cd799439016'],
|
|
12374
|
+
* tasks: ['507f1f77bcf86cd799439011', '507f1f77bcf86cd799439012']
|
|
12375
|
+
* };
|
|
12376
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
12377
|
+
* const result = await api.user.kanban.startTask(params, session);
|
|
12378
|
+
*
|
|
12379
|
+
* Expected response structure (success):
|
|
12380
|
+
* {
|
|
12381
|
+
* success: true,
|
|
12382
|
+
* taskId: '507f1f77bcf86cd799439013'
|
|
12383
|
+
* }
|
|
12384
|
+
*
|
|
12385
|
+
* Expected response structure (error):
|
|
12386
|
+
* {
|
|
12387
|
+
* success: false,
|
|
12388
|
+
* error: "Organization process not found"
|
|
12389
|
+
* }
|
|
12390
|
+
*/
|
|
12391
|
+
async startTask(params, session) {
|
|
12392
|
+
const self = this;
|
|
12393
|
+
|
|
12394
|
+
try {
|
|
12395
|
+
Joi__default["default"].assert(params, Joi__default["default"].object().required(), 'Params to start task');
|
|
12396
|
+
Joi__default["default"].assert(params.orgId, Joi__default["default"].string().required(), 'Organization id (_id database)');
|
|
12397
|
+
Joi__default["default"].assert(params.orgProcessName, Joi__default["default"].string().required(), 'The name of the organization process');
|
|
12398
|
+
Joi__default["default"].assert(params.title, Joi__default["default"].string().required(), 'The title of the new task');
|
|
12399
|
+
Joi__default["default"].assert(params.status, Joi__default["default"].string().required(), 'The status id of the new task');
|
|
12400
|
+
Joi__default["default"].assert(session, Joi__default["default"].string().required(), 'Session token JWT');
|
|
12401
|
+
|
|
12402
|
+
const {
|
|
12403
|
+
orgId,
|
|
12404
|
+
orgProcessName,
|
|
12405
|
+
title,
|
|
12406
|
+
status,
|
|
12407
|
+
tags = [],
|
|
12408
|
+
tasks = []
|
|
12409
|
+
} = params;
|
|
12410
|
+
|
|
12411
|
+
// Build API endpoint for starting a new task
|
|
12412
|
+
const endpoint = `/organization/${orgId}/kanban/${orgProcessName}/tasks`;
|
|
12413
|
+
|
|
12414
|
+
const payload = {
|
|
12415
|
+
title,
|
|
12416
|
+
status,
|
|
12417
|
+
tags,
|
|
12418
|
+
tasks
|
|
12419
|
+
};
|
|
12420
|
+
|
|
12421
|
+
const apiCall = self._client
|
|
12422
|
+
.put(endpoint, payload, self._setHeader(session));
|
|
12423
|
+
|
|
12424
|
+
return self._returnData(await apiCall);
|
|
12425
|
+
} catch (ex) {
|
|
12426
|
+
throw ex;
|
|
12427
|
+
}
|
|
12428
|
+
}
|
|
12281
12429
|
}
|
|
12282
12430
|
|
|
12283
12431
|
/**
|