@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.
@@ -594,6 +594,7 @@ class Kanban {
594
594
  * @param {string} params.flowId - The id of the organization process step flowId
595
595
  * @param {Array} params.statusList - The status list with new order
596
596
  * @param {Object} params.statusList[] - Status object configuration
597
+ * @param {string} params.statusList[].guid - The guid of the status (the id)
597
598
  * @param {string} params.statusList[].value - The title of the status
598
599
  * @param {boolean} params.statusList[].expanded - If the status column is expanded or not
599
600
  * @param {string} params.statusList[].color - The hexadecimal color code for the status
@@ -656,6 +657,89 @@ class Kanban {
656
657
  throw ex;
657
658
  }
658
659
  }
660
+
661
+ /**
662
+ * @author Myndware <augusto.pissarra@myndware.com>
663
+ * @description Starts a new task in the Kanban board for a specific organization process
664
+ * @param {Object} params - Parameters object
665
+ * @param {string} params.orgId - Organization id (_id database)
666
+ * @param {string} params.orgProcessName - The name of the organization process
667
+ * @param {string} params.title - The title of the new task
668
+ * @param {string} params.status - The status id of the new task
669
+ * @param {Array} [params.tags] - Array of tag ids for the new task (optional)
670
+ * @param {Array} [params.tasks] - The task ids of each task inside the same status (optional)
671
+ * @param {string} session - Session, token JWT
672
+ * @returns {promise} Promise that resolves to operation status
673
+ * @returns {Object} returns.data - The response data containing:
674
+ * @returns {boolean} returns.data.success - Indicates if the operation was successful
675
+ * @returns {string} [returns.data.taskId] - The ID of the newly created task
676
+ * @returns {string} [returns.data.error] - Error message if operation failed
677
+ * @public
678
+ * @example
679
+ *
680
+ * const API = require('@docbrasil/api-systemmanager');
681
+ * const api = new API();
682
+ * const params = {
683
+ * orgId: '55e4a3bd6be6b45210833fae',
684
+ * orgProcessName: 'employee-onboarding',
685
+ * title: 'Complete employee documentation',
686
+ * status: '507f1f77bcf86cd799439014',
687
+ * tags: ['507f1f77bcf86cd799439015', '507f1f77bcf86cd799439016'],
688
+ * tasks: ['507f1f77bcf86cd799439011', '507f1f77bcf86cd799439012']
689
+ * };
690
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
691
+ * const result = await api.user.kanban.startTask(params, session);
692
+ *
693
+ * Expected response structure (success):
694
+ * {
695
+ * success: true,
696
+ * taskId: '507f1f77bcf86cd799439013'
697
+ * }
698
+ *
699
+ * Expected response structure (error):
700
+ * {
701
+ * success: false,
702
+ * error: "Organization process not found"
703
+ * }
704
+ */
705
+ async startTask(params, session) {
706
+ const self = this;
707
+
708
+ try {
709
+ Joi.assert(params, Joi.object().required(), 'Params to start task');
710
+ Joi.assert(params.orgId, Joi.string().required(), 'Organization id (_id database)');
711
+ Joi.assert(params.orgProcessName, Joi.string().required(), 'The name of the organization process');
712
+ Joi.assert(params.title, Joi.string().required(), 'The title of the new task');
713
+ Joi.assert(params.status, Joi.string().required(), 'The status id of the new task');
714
+ Joi.assert(session, Joi.string().required(), 'Session token JWT');
715
+
716
+ const {
717
+ orgId,
718
+ orgProcessName,
719
+ title,
720
+ status,
721
+ tags = [],
722
+ tasks = []
723
+ } = params;
724
+
725
+ // Build API endpoint for starting a new task
726
+ const endpoint = `/organization/${orgId}/kanban/${orgProcessName}/tasks`;
727
+
728
+ const payload = {
729
+ title,
730
+ status,
731
+ tags,
732
+ tasks
733
+ };
734
+
735
+ const apiCall = self._client
736
+ .put(endpoint, payload, self._setHeader(session));
737
+
738
+ return self._returnData(await apiCall);
739
+ } catch (ex) {
740
+ throw ex;
741
+ }
742
+ }
659
743
  }
660
744
 
661
745
  export default Kanban;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@docbrasil/api-systemmanager",
3
3
  "description": "Module API System Manager",
4
- "version": "1.1.64",
4
+ "version": "1.1.65",
5
5
  "scripts": {
6
6
  "htmldoc": "rm -rf docs && jsdoc api/** -d docs -t ./node_modules/better-docs",
7
7
  "doc": "rm -rf doc && mkdir doc && jsdoc2md api/**/* api/* > doc/api.md",