@docbrasil/api-systemmanager 1.1.66 → 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 +10 -4
- package/dist/bundle.cjs +10 -4
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +4 -2
- package/docs/Documents.html +67 -17
- package/docs/user_document.js.html +10 -4
- package/package.json +1 -1
package/doc/api.md
CHANGED
|
@@ -1702,14 +1702,16 @@ Updates a document
|
|
|
1702
1702
|
| Param | Type | Description |
|
|
1703
1703
|
| --- | --- | --- |
|
|
1704
1704
|
| ids | <code>array.<string></code> | array of document _id |
|
|
1705
|
-
| params | <code>object</code> | Object for document payload to update. It has
|
|
1705
|
+
| params | <code>object</code> | Object for document payload to update. It has the orgId and areaId (required) and the fields to update. Partial updates accepted, such as docTypeFieldsData.extraFieldName |
|
|
1706
|
+
| params.orgId | <code>string</code> | The orgId of the organization |
|
|
1707
|
+
| params.areaId | <code>string</code> | The areaId to update in batch |
|
|
1706
1708
|
| session | <code>string</code> | Session, token JWT |
|
|
1707
1709
|
|
|
1708
1710
|
**Example**
|
|
1709
1711
|
```js
|
|
1710
1712
|
const API = require('@docbrasil/api-systemmanager');
|
|
1711
1713
|
const api = new API();
|
|
1712
|
-
const params = {
|
|
1714
|
+
const params = { orgId: '5edf9f8ee896b817e45b8da7', areaId: '5edf9f8ee896b817e45b8da8', 'docTypeFieldsData.extraName': 'New name' };
|
|
1713
1715
|
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1714
1716
|
await api.user.document.findByIdsAndUpdate(['5edf9f8ee896b817e45b8dad'], params, session);
|
|
1715
1717
|
```
|
package/docs/Documents.html
CHANGED
|
@@ -1657,7 +1657,7 @@ Checks if a document can be added and it does not repeat its primary key</li>
|
|
|
1657
1657
|
<p class="tag-source">
|
|
1658
1658
|
<a href="user_document.js.html" class="button">View Source</a>
|
|
1659
1659
|
<span>
|
|
1660
|
-
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#
|
|
1660
|
+
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line834">line 834</a>
|
|
1661
1661
|
</span>
|
|
1662
1662
|
</p>
|
|
1663
1663
|
|
|
@@ -1950,7 +1950,7 @@ const retDocs = await api.user.document.checkPrimaryKeys(params, session);</code
|
|
|
1950
1950
|
<p class="tag-source">
|
|
1951
1951
|
<a href="user_document.js.html" class="button">View Source</a>
|
|
1952
1952
|
<span>
|
|
1953
|
-
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#
|
|
1953
|
+
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line922">line 922</a>
|
|
1954
1954
|
</span>
|
|
1955
1955
|
</p>
|
|
1956
1956
|
|
|
@@ -2222,7 +2222,7 @@ const retSearch = await api.user.document.exportExcelForAllPages(params, session
|
|
|
2222
2222
|
<p class="tag-source">
|
|
2223
2223
|
<a href="user_document.js.html" class="button">View Source</a>
|
|
2224
2224
|
<span>
|
|
2225
|
-
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#
|
|
2225
|
+
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line962">line 962</a>
|
|
2226
2226
|
</span>
|
|
2227
2227
|
</p>
|
|
2228
2228
|
|
|
@@ -2912,7 +2912,7 @@ const retSearch = await api.user.document.exportWmsExcelForAllPages(params, sess
|
|
|
2912
2912
|
<p class="tag-source">
|
|
2913
2913
|
<a href="user_document.js.html" class="button">View Source</a>
|
|
2914
2914
|
<span>
|
|
2915
|
-
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#
|
|
2915
|
+
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line381">line 381</a>
|
|
2916
2916
|
</span>
|
|
2917
2917
|
</p>
|
|
2918
2918
|
|
|
@@ -3138,7 +3138,7 @@ await api.user.document.findByIdAndRemove(params, session);</code></pre>
|
|
|
3138
3138
|
<p class="tag-source">
|
|
3139
3139
|
<a href="user_document.js.html" class="button">View Source</a>
|
|
3140
3140
|
<span>
|
|
3141
|
-
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#
|
|
3141
|
+
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line330">line 330</a>
|
|
3142
3142
|
</span>
|
|
3143
3143
|
</p>
|
|
3144
3144
|
|
|
@@ -3404,7 +3404,7 @@ await api.user.document.findById('5edf9f8ee896b817e45b8dad', session);</code></p
|
|
|
3404
3404
|
<p class="tag-source">
|
|
3405
3405
|
<a href="user_document.js.html" class="button">View Source</a>
|
|
3406
3406
|
<span>
|
|
3407
|
-
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#
|
|
3407
|
+
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line465">line 465</a>
|
|
3408
3408
|
</span>
|
|
3409
3409
|
</p>
|
|
3410
3410
|
|
|
@@ -4032,7 +4032,7 @@ await api.user.document.findByIdAndUpdate('5edf9f8ee896b817e45b8dad', params, se
|
|
|
4032
4032
|
<p class="tag-source">
|
|
4033
4033
|
<a href="user_document.js.html" class="button">View Source</a>
|
|
4034
4034
|
<span>
|
|
4035
|
-
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#
|
|
4035
|
+
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line510">line 510</a>
|
|
4036
4036
|
</span>
|
|
4037
4037
|
</p>
|
|
4038
4038
|
|
|
@@ -4290,9 +4290,59 @@ await api.user.document.findByIdsAndRemove(params, session);</code></pre>
|
|
|
4290
4290
|
|
|
4291
4291
|
|
|
4292
4292
|
|
|
4293
|
-
<td class="description last">Object for document payload to update. It has
|
|
4293
|
+
<td class="description last">Object for document payload to update. It has the orgId and areaId (required) and the fields to update.
|
|
4294
|
+
Partial updates accepted, such as docTypeFieldsData.extraFieldName</td>
|
|
4294
4295
|
</tr>
|
|
4295
4296
|
|
|
4297
|
+
|
|
4298
|
+
|
|
4299
|
+
|
|
4300
|
+
<tr class="deep-level-1">
|
|
4301
|
+
|
|
4302
|
+
<td class="name"><code>orgId</code></td>
|
|
4303
|
+
|
|
4304
|
+
|
|
4305
|
+
<td class="type">
|
|
4306
|
+
|
|
4307
|
+
|
|
4308
|
+
<code class="param-type">string</code>
|
|
4309
|
+
|
|
4310
|
+
|
|
4311
|
+
|
|
4312
|
+
</td>
|
|
4313
|
+
|
|
4314
|
+
|
|
4315
|
+
|
|
4316
|
+
|
|
4317
|
+
|
|
4318
|
+
<td class="description last">The orgId of the organization</td>
|
|
4319
|
+
</tr>
|
|
4320
|
+
|
|
4321
|
+
|
|
4322
|
+
|
|
4323
|
+
<tr class="deep-level-1">
|
|
4324
|
+
|
|
4325
|
+
<td class="name"><code>areaId</code></td>
|
|
4326
|
+
|
|
4327
|
+
|
|
4328
|
+
<td class="type">
|
|
4329
|
+
|
|
4330
|
+
|
|
4331
|
+
<code class="param-type">string</code>
|
|
4332
|
+
|
|
4333
|
+
|
|
4334
|
+
|
|
4335
|
+
</td>
|
|
4336
|
+
|
|
4337
|
+
|
|
4338
|
+
|
|
4339
|
+
|
|
4340
|
+
|
|
4341
|
+
<td class="description last">The areaId to update in batch</td>
|
|
4342
|
+
</tr>
|
|
4343
|
+
|
|
4344
|
+
|
|
4345
|
+
|
|
4296
4346
|
|
|
4297
4347
|
|
|
4298
4348
|
|
|
@@ -4370,7 +4420,7 @@ await api.user.document.findByIdsAndRemove(params, session);</code></pre>
|
|
|
4370
4420
|
<p class="tag-source">
|
|
4371
4421
|
<a href="user_document.js.html" class="button">View Source</a>
|
|
4372
4422
|
<span>
|
|
4373
|
-
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#
|
|
4423
|
+
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line294">line 294</a>
|
|
4374
4424
|
</span>
|
|
4375
4425
|
</p>
|
|
4376
4426
|
|
|
@@ -4424,7 +4474,7 @@ await api.user.document.findByIdsAndRemove(params, session);</code></pre>
|
|
|
4424
4474
|
|
|
4425
4475
|
<pre class="prettyprint"><code>const API = require('@docbrasil/api-systemmanager');
|
|
4426
4476
|
const api = new API();
|
|
4427
|
-
const params = {
|
|
4477
|
+
const params = { orgId: '5edf9f8ee896b817e45b8da7', areaId: '5edf9f8ee896b817e45b8da8', 'docTypeFieldsData.extraName': 'New name' };
|
|
4428
4478
|
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
4429
4479
|
await api.user.document.findByIdsAndUpdate(['5edf9f8ee896b817e45b8dad'], params, session);</code></pre>
|
|
4430
4480
|
|
|
@@ -4660,7 +4710,7 @@ await api.user.document.findByIdsAndUpdate(['5edf9f8ee896b817e45b8dad'], params,
|
|
|
4660
4710
|
<p class="tag-source">
|
|
4661
4711
|
<a href="user_document.js.html" class="button">View Source</a>
|
|
4662
4712
|
<span>
|
|
4663
|
-
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#
|
|
4713
|
+
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line1012">line 1012</a>
|
|
4664
4714
|
</span>
|
|
4665
4715
|
</p>
|
|
4666
4716
|
|
|
@@ -4941,7 +4991,7 @@ const retSearch = await api.user.document.performDownloadComplete(params, sessio
|
|
|
4941
4991
|
<p class="tag-source">
|
|
4942
4992
|
<a href="user_document.js.html" class="button">View Source</a>
|
|
4943
4993
|
<span>
|
|
4944
|
-
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#
|
|
4994
|
+
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line882">line 882</a>
|
|
4945
4995
|
</span>
|
|
4946
4996
|
</p>
|
|
4947
4997
|
|
|
@@ -5285,7 +5335,7 @@ const retSearch = await api.user.document.searchDocuments(params, session);</cod
|
|
|
5285
5335
|
<p class="tag-source">
|
|
5286
5336
|
<a href="user_document.js.html" class="button">View Source</a>
|
|
5287
5337
|
<span>
|
|
5288
|
-
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#
|
|
5338
|
+
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line1057">line 1057</a>
|
|
5289
5339
|
</span>
|
|
5290
5340
|
</p>
|
|
5291
5341
|
|
|
@@ -5744,7 +5794,7 @@ const retSearch = await api.user.document.searchDocumentsDirect(params, session)
|
|
|
5744
5794
|
<p class="tag-source">
|
|
5745
5795
|
<a href="user_document.js.html" class="button">View Source</a>
|
|
5746
5796
|
<span>
|
|
5747
|
-
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#
|
|
5797
|
+
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line576">line 576</a>
|
|
5748
5798
|
</span>
|
|
5749
5799
|
</p>
|
|
5750
5800
|
|
|
@@ -6260,7 +6310,7 @@ const base64Data = await api.user.document.signedUrl(params, session);</code></p
|
|
|
6260
6310
|
<p class="tag-source">
|
|
6261
6311
|
<a href="user_document.js.html" class="button">View Source</a>
|
|
6262
6312
|
<span>
|
|
6263
|
-
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#
|
|
6313
|
+
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line672">line 672</a>
|
|
6264
6314
|
</span>
|
|
6265
6315
|
</p>
|
|
6266
6316
|
|
|
@@ -6658,7 +6708,7 @@ const base64Data = await api.user.document.signedUrls(params, session);</code></
|
|
|
6658
6708
|
<p class="tag-source">
|
|
6659
6709
|
<a href="user_document.js.html" class="button">View Source</a>
|
|
6660
6710
|
<span>
|
|
6661
|
-
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#
|
|
6711
|
+
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line776">line 776</a>
|
|
6662
6712
|
</span>
|
|
6663
6713
|
</p>
|
|
6664
6714
|
|
|
@@ -6949,7 +6999,7 @@ onUploadProgress return the progressEvent
|
|
|
6949
6999
|
<p class="tag-source">
|
|
6950
7000
|
<a href="user_document.js.html" class="button">View Source</a>
|
|
6951
7001
|
<span>
|
|
6952
|
-
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#
|
|
7002
|
+
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line720">line 720</a>
|
|
6953
7003
|
</span>
|
|
6954
7004
|
</p>
|
|
6955
7005
|
|
|
@@ -362,7 +362,10 @@ class Documents {
|
|
|
362
362
|
* @author Myndware <augusto.pissarra@myndware.com>
|
|
363
363
|
* @description Updates a document
|
|
364
364
|
* @param {array<string>} ids array of document _id
|
|
365
|
-
* @param {object} params Object for document payload to update. It has
|
|
365
|
+
* @param {object} params Object for document payload to update. It has the orgId and areaId (required) and the fields to update.
|
|
366
|
+
* Partial updates accepted, such as docTypeFieldsData.extraFieldName
|
|
367
|
+
* @param {string} params.orgId The orgId of the organization
|
|
368
|
+
* @param {string} params.areaId The areaId to update in batch
|
|
366
369
|
* @param {string} session Session, token JWT
|
|
367
370
|
* @return {Promise}
|
|
368
371
|
* @public
|
|
@@ -371,7 +374,7 @@ class Documents {
|
|
|
371
374
|
*
|
|
372
375
|
* const API = require('@docbrasil/api-systemmanager');
|
|
373
376
|
* const api = new API();
|
|
374
|
-
* const params = {
|
|
377
|
+
* const params = { orgId: '5edf9f8ee896b817e45b8da7', areaId: '5edf9f8ee896b817e45b8da8', 'docTypeFieldsData.extraName': 'New name' };
|
|
375
378
|
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
376
379
|
* await api.user.document.findByIdsAndUpdate(['5edf9f8ee896b817e45b8dad'], params, session);
|
|
377
380
|
*/
|
|
@@ -380,11 +383,14 @@ class Documents {
|
|
|
380
383
|
try {
|
|
381
384
|
Joi.assert(ids, Joi.array().required().error(new Error('ids is required')));
|
|
382
385
|
Joi.assert(params, Joi.object().required().error(new Error('params is required')));
|
|
386
|
+
Joi.assert(params.orgId, Joi.string().required().error(new Error('orgId is required')));
|
|
387
|
+
Joi.assert(params.areaId, Joi.string().required().error(new Error('areaId is required')));
|
|
383
388
|
Joi.assert(session, Joi.string().required().error(new Error('session is required')));
|
|
384
389
|
const { areaId, orgId } = params;
|
|
385
|
-
params.
|
|
390
|
+
delete params.areaId;
|
|
391
|
+
delete params.orgId;
|
|
386
392
|
const apiCall = self._client
|
|
387
|
-
.put(`/organizations/${orgId}/areas/${areaId}/documents/batch`, params, self._setHeader(session));
|
|
393
|
+
.put(`/organizations/${orgId}/areas/${areaId}/documents/batch`, { ids, data: params }, self._setHeader(session));
|
|
388
394
|
|
|
389
395
|
return self._returnData(await apiCall);
|
|
390
396
|
} catch (ex) {
|
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.
|
|
4
|
+
"version": "1.1.67",
|
|
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",
|