@docbrasil/api-systemmanager 1.1.63 → 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 +64 -0
- package/dist/bundle.cjs +64 -0
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +47 -0
- package/docs/Kanban.html +416 -6
- package/docs/user_kanban.js.html +64 -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
|
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
|