@docbrasil/api-systemmanager 1.1.64 → 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 +84 -0
- package/dist/bundle.cjs +84 -0
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +50 -0
- package/docs/Kanban.html +546 -1
- package/docs/user_kanban.js.html +84 -0
- package/package.json +1 -1
package/api/user/kanban.js
CHANGED
|
@@ -507,6 +507,7 @@ class Kanban {
|
|
|
507
507
|
* @param {string} params.flowId - The id of the organization process step flowId
|
|
508
508
|
* @param {Array} params.statusList - The status list with new order
|
|
509
509
|
* @param {Object} params.statusList[] - Status object configuration
|
|
510
|
+
* @param {string} params.statusList[].guid - The guid of the status (the id)
|
|
510
511
|
* @param {string} params.statusList[].value - The title of the status
|
|
511
512
|
* @param {boolean} params.statusList[].expanded - If the status column is expanded or not
|
|
512
513
|
* @param {string} params.statusList[].color - The hexadecimal color code for the status
|
|
@@ -569,6 +570,89 @@ class Kanban {
|
|
|
569
570
|
throw ex;
|
|
570
571
|
}
|
|
571
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
|
+
}
|
|
572
656
|
}
|
|
573
657
|
|
|
574
658
|
export default Kanban;
|
package/dist/bundle.cjs
CHANGED
|
@@ -12280,6 +12280,7 @@ class Kanban {
|
|
|
12280
12280
|
* @param {string} params.flowId - The id of the organization process step flowId
|
|
12281
12281
|
* @param {Array} params.statusList - The status list with new order
|
|
12282
12282
|
* @param {Object} params.statusList[] - Status object configuration
|
|
12283
|
+
* @param {string} params.statusList[].guid - The guid of the status (the id)
|
|
12283
12284
|
* @param {string} params.statusList[].value - The title of the status
|
|
12284
12285
|
* @param {boolean} params.statusList[].expanded - If the status column is expanded or not
|
|
12285
12286
|
* @param {string} params.statusList[].color - The hexadecimal color code for the status
|
|
@@ -12342,6 +12343,89 @@ class Kanban {
|
|
|
12342
12343
|
throw ex;
|
|
12343
12344
|
}
|
|
12344
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
|
+
}
|
|
12345
12429
|
}
|
|
12346
12430
|
|
|
12347
12431
|
/**
|