@docbrasil/api-systemmanager 1.1.65 → 1.1.67
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 +40 -0
- package/api/user/kanban.js +5 -3
- package/dist/bundle.cjs +45 -3
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +30 -4
- package/docs/Documents.html +307 -14
- package/docs/Kanban.html +5 -5
- package/docs/user_document.js.html +40 -0
- package/docs/user_kanban.js.html +5 -3
- package/package.json +1 -1
package/api/user/document.js
CHANGED
|
@@ -271,6 +271,46 @@ 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 the orgId and areaId (required) and the fields to update.
|
|
279
|
+
* Partial updates accepted, such as docTypeFieldsData.extraFieldName
|
|
280
|
+
* @param {string} params.orgId The orgId of the organization
|
|
281
|
+
* @param {string} params.areaId The areaId to update in batch
|
|
282
|
+
* @param {string} session Session, token JWT
|
|
283
|
+
* @return {Promise}
|
|
284
|
+
* @public
|
|
285
|
+
* @async
|
|
286
|
+
* @example
|
|
287
|
+
*
|
|
288
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
289
|
+
* const api = new API();
|
|
290
|
+
* const params = { orgId: '5edf9f8ee896b817e45b8da7', areaId: '5edf9f8ee896b817e45b8da8', 'docTypeFieldsData.extraName': 'New name' };
|
|
291
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
292
|
+
* await api.user.document.findByIdsAndUpdate(['5edf9f8ee896b817e45b8dad'], params, session);
|
|
293
|
+
*/
|
|
294
|
+
async findByIdsAndUpdate(ids, params, session) {
|
|
295
|
+
const self = this;
|
|
296
|
+
try {
|
|
297
|
+
Joi.assert(ids, Joi.array().required().error(new Error('ids is required')));
|
|
298
|
+
Joi.assert(params, Joi.object().required().error(new Error('params is required')));
|
|
299
|
+
Joi.assert(params.orgId, Joi.string().required().error(new Error('orgId is required')));
|
|
300
|
+
Joi.assert(params.areaId, Joi.string().required().error(new Error('areaId is required')));
|
|
301
|
+
Joi.assert(session, Joi.string().required().error(new Error('session is required')));
|
|
302
|
+
const { areaId, orgId } = params;
|
|
303
|
+
delete params.areaId;
|
|
304
|
+
delete params.orgId;
|
|
305
|
+
const apiCall = self._client
|
|
306
|
+
.put(`/organizations/${orgId}/areas/${areaId}/documents/batch`, { ids, data: params }, self._setHeader(session));
|
|
307
|
+
|
|
308
|
+
return self._returnData(await apiCall);
|
|
309
|
+
} catch (ex) {
|
|
310
|
+
throw ex;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
274
314
|
/**
|
|
275
315
|
* @author Myndware <augusto.pissarra@myndware.com>
|
|
276
316
|
* @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,46 @@ 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 the orgId and areaId (required) and the fields to update.
|
|
933
|
+
* Partial updates accepted, such as docTypeFieldsData.extraFieldName
|
|
934
|
+
* @param {string} params.orgId The orgId of the organization
|
|
935
|
+
* @param {string} params.areaId The areaId to update in batch
|
|
936
|
+
* @param {string} session Session, token JWT
|
|
937
|
+
* @return {Promise}
|
|
938
|
+
* @public
|
|
939
|
+
* @async
|
|
940
|
+
* @example
|
|
941
|
+
*
|
|
942
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
943
|
+
* const api = new API();
|
|
944
|
+
* const params = { orgId: '5edf9f8ee896b817e45b8da7', areaId: '5edf9f8ee896b817e45b8da8', 'docTypeFieldsData.extraName': 'New name' };
|
|
945
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
946
|
+
* await api.user.document.findByIdsAndUpdate(['5edf9f8ee896b817e45b8dad'], params, session);
|
|
947
|
+
*/
|
|
948
|
+
async findByIdsAndUpdate(ids, params, session) {
|
|
949
|
+
const self = this;
|
|
950
|
+
try {
|
|
951
|
+
Joi__default["default"].assert(ids, Joi__default["default"].array().required().error(new Error('ids is required')));
|
|
952
|
+
Joi__default["default"].assert(params, Joi__default["default"].object().required().error(new Error('params is required')));
|
|
953
|
+
Joi__default["default"].assert(params.orgId, Joi__default["default"].string().required().error(new Error('orgId is required')));
|
|
954
|
+
Joi__default["default"].assert(params.areaId, Joi__default["default"].string().required().error(new Error('areaId is required')));
|
|
955
|
+
Joi__default["default"].assert(session, Joi__default["default"].string().required().error(new Error('session is required')));
|
|
956
|
+
const { areaId, orgId } = params;
|
|
957
|
+
delete params.areaId;
|
|
958
|
+
delete params.orgId;
|
|
959
|
+
const apiCall = self._client
|
|
960
|
+
.put(`/organizations/${orgId}/areas/${areaId}/documents/batch`, { ids, data: params }, self._setHeader(session));
|
|
961
|
+
|
|
962
|
+
return self._returnData(await apiCall);
|
|
963
|
+
} catch (ex) {
|
|
964
|
+
throw ex;
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
|
|
928
968
|
/**
|
|
929
969
|
* @author Myndware <augusto.pissarra@myndware.com>
|
|
930
970
|
* @description Updates a document.
|
|
@@ -12347,18 +12387,20 @@ class Kanban {
|
|
|
12347
12387
|
/**
|
|
12348
12388
|
* @author Myndware <augusto.pissarra@myndware.com>
|
|
12349
12389
|
* @description Starts a new task in the Kanban board for a specific organization process
|
|
12390
|
+
* @description It will create the task, set the new order for all tasks (if you send them) and return the the task
|
|
12391
|
+
* @description The new task is the full object of the task, like when you search the task
|
|
12350
12392
|
* @param {Object} params - Parameters object
|
|
12351
12393
|
* @param {string} params.orgId - Organization id (_id database)
|
|
12352
12394
|
* @param {string} params.orgProcessName - The name of the organization process
|
|
12353
12395
|
* @param {string} params.title - The title of the new task
|
|
12354
12396
|
* @param {string} params.status - The status id of the new task
|
|
12355
12397
|
* @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)
|
|
12398
|
+
* @param {Array} [params.tasks] - The task ids, in their current order, of each task inside the same status (optional)
|
|
12357
12399
|
* @param {string} session - Session, token JWT
|
|
12358
12400
|
* @returns {promise} Promise that resolves to operation status
|
|
12359
12401
|
* @returns {Object} returns.data - The response data containing:
|
|
12360
12402
|
* @returns {boolean} returns.data.success - Indicates if the operation was successful
|
|
12361
|
-
* @returns {string} [returns.data.
|
|
12403
|
+
* @returns {string} [returns.data.task] - The created task and its properties
|
|
12362
12404
|
* @returns {string} [returns.data.error] - Error message if operation failed
|
|
12363
12405
|
* @public
|
|
12364
12406
|
* @example
|
|
@@ -12379,7 +12421,7 @@ class Kanban {
|
|
|
12379
12421
|
* Expected response structure (success):
|
|
12380
12422
|
* {
|
|
12381
12423
|
* success: true,
|
|
12382
|
-
*
|
|
12424
|
+
* task: { _id: '507f1f77bcf86cd799439013', ... }
|
|
12383
12425
|
* }
|
|
12384
12426
|
*
|
|
12385
12427
|
* Expected response structure (error):
|