@docbrasil/api-systemmanager 1.1.65 → 1.1.66
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/document.js +34 -0
- package/api/user/kanban.js +5 -3
- package/dist/bundle.cjs +39 -3
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +28 -4
- package/docs/Documents.html +257 -14
- package/docs/Kanban.html +5 -5
- package/docs/user_document.js.html +34 -0
- package/docs/user_kanban.js.html +5 -3
- package/package.json +1 -1
package/api/user/document.js
CHANGED
|
@@ -271,6 +271,40 @@ class Documents {
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
+
/**
|
|
275
|
+
* @author Myndware <augusto.pissarra@myndware.com>
|
|
276
|
+
* @description Updates a document
|
|
277
|
+
* @param {array<string>} ids array of document _id
|
|
278
|
+
* @param {object} params Object for document payload to update. It has to be the FULL document data, that you can get with findById
|
|
279
|
+
* @param {string} session Session, token JWT
|
|
280
|
+
* @return {Promise}
|
|
281
|
+
* @public
|
|
282
|
+
* @async
|
|
283
|
+
* @example
|
|
284
|
+
*
|
|
285
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
286
|
+
* const api = new API();
|
|
287
|
+
* const params = { ... };
|
|
288
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
289
|
+
* await api.user.document.findByIdsAndUpdate(['5edf9f8ee896b817e45b8dad'], params, session);
|
|
290
|
+
*/
|
|
291
|
+
async findByIdsAndUpdate(ids, params, session) {
|
|
292
|
+
const self = this;
|
|
293
|
+
try {
|
|
294
|
+
Joi.assert(ids, Joi.array().required().error(new Error('ids is required')));
|
|
295
|
+
Joi.assert(params, Joi.object().required().error(new Error('params is required')));
|
|
296
|
+
Joi.assert(session, Joi.string().required().error(new Error('session is required')));
|
|
297
|
+
const { areaId, orgId } = params;
|
|
298
|
+
params.ids = ids;
|
|
299
|
+
const apiCall = self._client
|
|
300
|
+
.put(`/organizations/${orgId}/areas/${areaId}/documents/batch`, params, self._setHeader(session));
|
|
301
|
+
|
|
302
|
+
return self._returnData(await apiCall);
|
|
303
|
+
} catch (ex) {
|
|
304
|
+
throw ex;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
274
308
|
/**
|
|
275
309
|
* @author Myndware <augusto.pissarra@myndware.com>
|
|
276
310
|
* @description Updates a document.
|
package/api/user/kanban.js
CHANGED
|
@@ -574,18 +574,20 @@ class Kanban {
|
|
|
574
574
|
/**
|
|
575
575
|
* @author Myndware <augusto.pissarra@myndware.com>
|
|
576
576
|
* @description Starts a new task in the Kanban board for a specific organization process
|
|
577
|
+
* @description It will create the task, set the new order for all tasks (if you send them) and return the the task
|
|
578
|
+
* @description The new task is the full object of the task, like when you search the task
|
|
577
579
|
* @param {Object} params - Parameters object
|
|
578
580
|
* @param {string} params.orgId - Organization id (_id database)
|
|
579
581
|
* @param {string} params.orgProcessName - The name of the organization process
|
|
580
582
|
* @param {string} params.title - The title of the new task
|
|
581
583
|
* @param {string} params.status - The status id of the new task
|
|
582
584
|
* @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)
|
|
585
|
+
* @param {Array} [params.tasks] - The task ids, in their current order, of each task inside the same status (optional)
|
|
584
586
|
* @param {string} session - Session, token JWT
|
|
585
587
|
* @returns {promise} Promise that resolves to operation status
|
|
586
588
|
* @returns {Object} returns.data - The response data containing:
|
|
587
589
|
* @returns {boolean} returns.data.success - Indicates if the operation was successful
|
|
588
|
-
* @returns {string} [returns.data.
|
|
590
|
+
* @returns {string} [returns.data.task] - The created task and its properties
|
|
589
591
|
* @returns {string} [returns.data.error] - Error message if operation failed
|
|
590
592
|
* @public
|
|
591
593
|
* @example
|
|
@@ -606,7 +608,7 @@ class Kanban {
|
|
|
606
608
|
* Expected response structure (success):
|
|
607
609
|
* {
|
|
608
610
|
* success: true,
|
|
609
|
-
*
|
|
611
|
+
* task: { _id: '507f1f77bcf86cd799439013', ... }
|
|
610
612
|
* }
|
|
611
613
|
*
|
|
612
614
|
* Expected response structure (error):
|
package/dist/bundle.cjs
CHANGED
|
@@ -925,6 +925,40 @@ class Documents {
|
|
|
925
925
|
}
|
|
926
926
|
}
|
|
927
927
|
|
|
928
|
+
/**
|
|
929
|
+
* @author Myndware <augusto.pissarra@myndware.com>
|
|
930
|
+
* @description Updates a document
|
|
931
|
+
* @param {array<string>} ids array of document _id
|
|
932
|
+
* @param {object} params Object for document payload to update. It has to be the FULL document data, that you can get with findById
|
|
933
|
+
* @param {string} session Session, token JWT
|
|
934
|
+
* @return {Promise}
|
|
935
|
+
* @public
|
|
936
|
+
* @async
|
|
937
|
+
* @example
|
|
938
|
+
*
|
|
939
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
940
|
+
* const api = new API();
|
|
941
|
+
* const params = { ... };
|
|
942
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
943
|
+
* await api.user.document.findByIdsAndUpdate(['5edf9f8ee896b817e45b8dad'], params, session);
|
|
944
|
+
*/
|
|
945
|
+
async findByIdsAndUpdate(ids, params, session) {
|
|
946
|
+
const self = this;
|
|
947
|
+
try {
|
|
948
|
+
Joi__default["default"].assert(ids, Joi__default["default"].array().required().error(new Error('ids is required')));
|
|
949
|
+
Joi__default["default"].assert(params, Joi__default["default"].object().required().error(new Error('params is required')));
|
|
950
|
+
Joi__default["default"].assert(session, Joi__default["default"].string().required().error(new Error('session is required')));
|
|
951
|
+
const { areaId, orgId } = params;
|
|
952
|
+
params.ids = ids;
|
|
953
|
+
const apiCall = self._client
|
|
954
|
+
.put(`/organizations/${orgId}/areas/${areaId}/documents/batch`, params, self._setHeader(session));
|
|
955
|
+
|
|
956
|
+
return self._returnData(await apiCall);
|
|
957
|
+
} catch (ex) {
|
|
958
|
+
throw ex;
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
|
|
928
962
|
/**
|
|
929
963
|
* @author Myndware <augusto.pissarra@myndware.com>
|
|
930
964
|
* @description Updates a document.
|
|
@@ -12347,18 +12381,20 @@ class Kanban {
|
|
|
12347
12381
|
/**
|
|
12348
12382
|
* @author Myndware <augusto.pissarra@myndware.com>
|
|
12349
12383
|
* @description Starts a new task in the Kanban board for a specific organization process
|
|
12384
|
+
* @description It will create the task, set the new order for all tasks (if you send them) and return the the task
|
|
12385
|
+
* @description The new task is the full object of the task, like when you search the task
|
|
12350
12386
|
* @param {Object} params - Parameters object
|
|
12351
12387
|
* @param {string} params.orgId - Organization id (_id database)
|
|
12352
12388
|
* @param {string} params.orgProcessName - The name of the organization process
|
|
12353
12389
|
* @param {string} params.title - The title of the new task
|
|
12354
12390
|
* @param {string} params.status - The status id of the new task
|
|
12355
12391
|
* @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)
|
|
12392
|
+
* @param {Array} [params.tasks] - The task ids, in their current order, of each task inside the same status (optional)
|
|
12357
12393
|
* @param {string} session - Session, token JWT
|
|
12358
12394
|
* @returns {promise} Promise that resolves to operation status
|
|
12359
12395
|
* @returns {Object} returns.data - The response data containing:
|
|
12360
12396
|
* @returns {boolean} returns.data.success - Indicates if the operation was successful
|
|
12361
|
-
* @returns {string} [returns.data.
|
|
12397
|
+
* @returns {string} [returns.data.task] - The created task and its properties
|
|
12362
12398
|
* @returns {string} [returns.data.error] - Error message if operation failed
|
|
12363
12399
|
* @public
|
|
12364
12400
|
* @example
|
|
@@ -12379,7 +12415,7 @@ class Kanban {
|
|
|
12379
12415
|
* Expected response structure (success):
|
|
12380
12416
|
* {
|
|
12381
12417
|
* success: true,
|
|
12382
|
-
*
|
|
12418
|
+
* task: { _id: '507f1f77bcf86cd799439013', ... }
|
|
12383
12419
|
* }
|
|
12384
12420
|
*
|
|
12385
12421
|
* Expected response structure (error):
|