@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/doc/api.md CHANGED
@@ -1593,6 +1593,7 @@ Class for documents, permission user
1593
1593
  * [Documents](#Documents)
1594
1594
  * [.add(params, session)](#Documents+add) ⇒ <code>Promise</code>
1595
1595
  * [.findByIdAndUpdate(id, params, session)](#Documents+findByIdAndUpdate) ⇒ <code>Promise</code>
1596
+ * [.findByIdsAndUpdate(ids, params, session)](#Documents+findByIdsAndUpdate) ⇒ <code>Promise</code>
1596
1597
  * [.findById(id, session)](#Documents+findById) ⇒ <code>Promise</code>
1597
1598
  * [.find(params, session)](#Documents+find) ⇒ <code>Promise</code>
1598
1599
  * [.findByIdAndRemove(params, session)](#Documents+findByIdAndRemove) ⇒ <code>Promise.&lt;object&gt;</code> \| <code>number</code> \| <code>array.&lt;object&gt;</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
@@ -1689,6 +1690,29 @@ const params = { ... };
1689
1690
  const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1690
1691
  await api.user.document.findByIdAndUpdate('5edf9f8ee896b817e45b8dad', params, session);
1691
1692
  ```
1693
+ <a name="Documents+findByIdsAndUpdate"></a>
1694
+
1695
+ ### documents.findByIdsAndUpdate(ids, params, session) ⇒ <code>Promise</code>
1696
+ Updates a document
1697
+
1698
+ **Kind**: instance method of [<code>Documents</code>](#Documents)
1699
+ **Access**: public
1700
+ **Author**: Myndware <augusto.pissarra@myndware.com>
1701
+
1702
+ | Param | Type | Description |
1703
+ | --- | --- | --- |
1704
+ | ids | <code>array.&lt;string&gt;</code> | array of document _id |
1705
+ | params | <code>object</code> | Object for document payload to update. It has to be the FULL document data, that you can get with findById |
1706
+ | session | <code>string</code> | Session, token JWT |
1707
+
1708
+ **Example**
1709
+ ```js
1710
+ const API = require('@docbrasil/api-systemmanager');
1711
+ const api = new API();
1712
+ const params = { ... };
1713
+ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1714
+ await api.user.document.findByIdsAndUpdate(['5edf9f8ee896b817e45b8dad'], params, session);
1715
+ ```
1692
1716
  <a name="Documents+findById"></a>
1693
1717
 
1694
1718
  ### documents.findById(id, session) ⇒ <code>Promise</code>
@@ -2636,10 +2660,10 @@ Expected response structure (error):
2636
2660
  <a name="Kanban+startTask"></a>
2637
2661
 
2638
2662
  ### kanban.startTask(params, session) ⇒ <code>promise</code> \| <code>Object</code> \| <code>boolean</code> \| <code>string</code> \| <code>string</code>
2639
- Starts a new task in the Kanban board for a specific organization process
2663
+ The new task is the full object of the task, like when you search the task
2640
2664
 
2641
2665
  **Kind**: instance method of [<code>Kanban</code>](#Kanban)
2642
- **Returns**: <code>promise</code> - Promise that resolves to operation status<code>Object</code> - returns.data - The response data containing:<code>boolean</code> - returns.data.success - Indicates if the operation was successful<code>string</code> - [returns.data.taskId] - The ID of the newly created task<code>string</code> - [returns.data.error] - Error message if operation failed
2666
+ **Returns**: <code>promise</code> - Promise that resolves to operation status<code>Object</code> - returns.data - The response data containing:<code>boolean</code> - returns.data.success - Indicates if the operation was successful<code>string</code> - [returns.data.task] - The created task and its properties<code>string</code> - [returns.data.error] - Error message if operation failed
2643
2667
  **Access**: public
2644
2668
  **Author**: Myndware <augusto.pissarra@myndware.com>
2645
2669
 
@@ -2651,7 +2675,7 @@ Starts a new task in the Kanban board for a specific organization process
2651
2675
  | params.title | <code>string</code> | The title of the new task |
2652
2676
  | params.status | <code>string</code> | The status id of the new task |
2653
2677
  | [params.tags] | <code>Array</code> | Array of tag ids for the new task (optional) |
2654
- | [params.tasks] | <code>Array</code> | The task ids of each task inside the same status (optional) |
2678
+ | [params.tasks] | <code>Array</code> | The task ids, in their current order, of each task inside the same status (optional) |
2655
2679
  | session | <code>string</code> | Session, token JWT |
2656
2680
 
2657
2681
  **Example**
@@ -2672,7 +2696,7 @@ const result = await api.user.kanban.startTask(params, session);
2672
2696
  Expected response structure (success):
2673
2697
  {
2674
2698
  success: true,
2675
- taskId: '507f1f77bcf86cd799439013'
2699
+ task: { _id: '507f1f77bcf86cd799439013', ... }
2676
2700
  }
2677
2701
 
2678
2702
  Expected response structure (error):
@@ -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#line794">line 794</a>
1660
+ <a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line828">line 828</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#line882">line 882</a>
1953
+ <a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line916">line 916</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#line922">line 922</a>
2225
+ <a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line956">line 956</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#line341">line 341</a>
2915
+ <a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line375">line 375</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#line290">line 290</a>
3141
+ <a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line324">line 324</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#line425">line 425</a>
3407
+ <a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line459">line 459</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#line470">line 470</a>
4035
+ <a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line504">line 504</a>
4036
4036
  </span>
4037
4037
  </p>
4038
4038
 
@@ -4187,6 +4187,249 @@ await api.user.document.findByIdsAndRemove(params, session);</code></pre>
4187
4187
 
4188
4188
 
4189
4189
 
4190
+ </div>
4191
+
4192
+ <div class="member">
4193
+
4194
+
4195
+
4196
+ <h4 class="name" id="findByIdsAndUpdate">
4197
+ <a class="href-link" href="#findByIdsAndUpdate">#</a>
4198
+
4199
+
4200
+ <span class='tag'>async</span>
4201
+
4202
+
4203
+ <span class="code-name">
4204
+
4205
+ findByIdsAndUpdate<span class="signature">(ids, params, session)</span><span class="type-signature"> &rarr; {Promise}</span>
4206
+
4207
+ </span>
4208
+ </h4>
4209
+
4210
+
4211
+
4212
+
4213
+ <div class="description">
4214
+ Updates a document
4215
+ </div>
4216
+
4217
+
4218
+
4219
+
4220
+
4221
+
4222
+
4223
+
4224
+
4225
+
4226
+ <h5>Parameters:</h5>
4227
+
4228
+ <div class="table-container">
4229
+ <table class="params table">
4230
+ <thead>
4231
+ <tr>
4232
+
4233
+ <th>Name</th>
4234
+
4235
+
4236
+ <th>Type</th>
4237
+
4238
+
4239
+
4240
+
4241
+
4242
+ <th class="last">Description</th>
4243
+ </tr>
4244
+ </thead>
4245
+
4246
+ <tbody>
4247
+
4248
+
4249
+
4250
+ <tr class="deep-level-0">
4251
+
4252
+ <td class="name"><code>ids</code></td>
4253
+
4254
+
4255
+ <td class="type">
4256
+
4257
+
4258
+ <code class="param-type">array.&lt;string></code>
4259
+
4260
+
4261
+
4262
+ </td>
4263
+
4264
+
4265
+
4266
+
4267
+
4268
+ <td class="description last">array of document _id</td>
4269
+ </tr>
4270
+
4271
+
4272
+
4273
+
4274
+
4275
+ <tr class="deep-level-0">
4276
+
4277
+ <td class="name"><code>params</code></td>
4278
+
4279
+
4280
+ <td class="type">
4281
+
4282
+
4283
+ <code class="param-type">object</code>
4284
+
4285
+
4286
+
4287
+ </td>
4288
+
4289
+
4290
+
4291
+
4292
+
4293
+ <td class="description last">Object for document payload to update. It has to be the FULL document data, that you can get with findById</td>
4294
+ </tr>
4295
+
4296
+
4297
+
4298
+
4299
+
4300
+ <tr class="deep-level-0">
4301
+
4302
+ <td class="name"><code>session</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">Session, token JWT</td>
4319
+ </tr>
4320
+
4321
+
4322
+
4323
+ </tbody>
4324
+ </table>
4325
+ </div>
4326
+
4327
+
4328
+
4329
+
4330
+
4331
+ <dl class="details">
4332
+
4333
+
4334
+
4335
+
4336
+
4337
+
4338
+
4339
+
4340
+
4341
+
4342
+
4343
+
4344
+
4345
+
4346
+
4347
+
4348
+
4349
+
4350
+ <dt class="tag-author">Author:</dt>
4351
+ <dd class="tag-author">
4352
+ <ul>
4353
+ <li><a href="mailto:augusto.pissarra@myndware.com">Myndware</a></li>
4354
+ </ul>
4355
+ </dd>
4356
+
4357
+
4358
+
4359
+
4360
+
4361
+
4362
+
4363
+
4364
+
4365
+
4366
+
4367
+
4368
+
4369
+
4370
+ <p class="tag-source">
4371
+ <a href="user_document.js.html" class="button">View Source</a>
4372
+ <span>
4373
+ <a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line291">line 291</a>
4374
+ </span>
4375
+ </p>
4376
+
4377
+ </dl>
4378
+
4379
+
4380
+
4381
+
4382
+
4383
+
4384
+
4385
+
4386
+
4387
+
4388
+
4389
+
4390
+
4391
+
4392
+
4393
+
4394
+
4395
+
4396
+ <div class='columns method-parameter'>
4397
+ <div class="column is-2"><label>Returns:</label></div>
4398
+ <div class="column is-10">
4399
+
4400
+
4401
+
4402
+ <div class="columns">
4403
+
4404
+
4405
+ <div class='column is-5 has-text-left'>
4406
+ <label>Type: </label>
4407
+
4408
+ <code class="param-type">Promise</code>
4409
+
4410
+
4411
+ </div>
4412
+
4413
+ </div>
4414
+
4415
+
4416
+ </div>
4417
+ </div>
4418
+
4419
+
4420
+
4421
+
4422
+ <h5>Example</h5>
4423
+
4424
+
4425
+ <pre class="prettyprint"><code>const API = require('@docbrasil/api-systemmanager');
4426
+ const api = new API();
4427
+ const params = { ... };
4428
+ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
4429
+ await api.user.document.findByIdsAndUpdate(['5edf9f8ee896b817e45b8dad'], params, session);</code></pre>
4430
+
4431
+
4432
+
4190
4433
  </div>
4191
4434
 
4192
4435
  <div class="member">
@@ -4417,7 +4660,7 @@ await api.user.document.findByIdsAndRemove(params, session);</code></pre>
4417
4660
  <p class="tag-source">
4418
4661
  <a href="user_document.js.html" class="button">View Source</a>
4419
4662
  <span>
4420
- <a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line972">line 972</a>
4663
+ <a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line1006">line 1006</a>
4421
4664
  </span>
4422
4665
  </p>
4423
4666
 
@@ -4698,7 +4941,7 @@ const retSearch = await api.user.document.performDownloadComplete(params, sessio
4698
4941
  <p class="tag-source">
4699
4942
  <a href="user_document.js.html" class="button">View Source</a>
4700
4943
  <span>
4701
- <a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line842">line 842</a>
4944
+ <a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line876">line 876</a>
4702
4945
  </span>
4703
4946
  </p>
4704
4947
 
@@ -5042,7 +5285,7 @@ const retSearch = await api.user.document.searchDocuments(params, session);</cod
5042
5285
  <p class="tag-source">
5043
5286
  <a href="user_document.js.html" class="button">View Source</a>
5044
5287
  <span>
5045
- <a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line1017">line 1017</a>
5288
+ <a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line1051">line 1051</a>
5046
5289
  </span>
5047
5290
  </p>
5048
5291
 
@@ -5501,7 +5744,7 @@ const retSearch = await api.user.document.searchDocumentsDirect(params, session)
5501
5744
  <p class="tag-source">
5502
5745
  <a href="user_document.js.html" class="button">View Source</a>
5503
5746
  <span>
5504
- <a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line536">line 536</a>
5747
+ <a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line570">line 570</a>
5505
5748
  </span>
5506
5749
  </p>
5507
5750
 
@@ -6017,7 +6260,7 @@ const base64Data = await api.user.document.signedUrl(params, session);</code></p
6017
6260
  <p class="tag-source">
6018
6261
  <a href="user_document.js.html" class="button">View Source</a>
6019
6262
  <span>
6020
- <a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line632">line 632</a>
6263
+ <a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line666">line 666</a>
6021
6264
  </span>
6022
6265
  </p>
6023
6266
 
@@ -6415,7 +6658,7 @@ const base64Data = await api.user.document.signedUrls(params, session);</code></
6415
6658
  <p class="tag-source">
6416
6659
  <a href="user_document.js.html" class="button">View Source</a>
6417
6660
  <span>
6418
- <a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line736">line 736</a>
6661
+ <a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line770">line 770</a>
6419
6662
  </span>
6420
6663
  </p>
6421
6664
 
@@ -6706,7 +6949,7 @@ onUploadProgress return the progressEvent
6706
6949
  <p class="tag-source">
6707
6950
  <a href="user_document.js.html" class="button">View Source</a>
6708
6951
  <span>
6709
- <a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line680">line 680</a>
6952
+ <a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line714">line 714</a>
6710
6953
  </span>
6711
6954
  </p>
6712
6955
 
package/docs/Kanban.html CHANGED
@@ -1428,7 +1428,7 @@ Expected response structure (error):
1428
1428
 
1429
1429
 
1430
1430
  <div class="description">
1431
- Starts a new task in the Kanban board for a specific organization process
1431
+ The new task is the full object of the task, like when you search the task
1432
1432
  </div>
1433
1433
 
1434
1434
 
@@ -1683,7 +1683,7 @@ Expected response structure (error):
1683
1683
 
1684
1684
 
1685
1685
 
1686
- <td class="description last">The task ids of each task inside the same status (optional)</td>
1686
+ <td class="description last">The task ids, in their current order, of each task inside the same status (optional)</td>
1687
1687
  </tr>
1688
1688
 
1689
1689
 
@@ -1773,7 +1773,7 @@ Expected response structure (error):
1773
1773
  <p class="tag-source">
1774
1774
  <a href="user_kanban.js.html" class="button">View Source</a>
1775
1775
  <span>
1776
- <a href="user_kanban.js.html">user/kanban.js</a>, <a href="user_kanban.js.html#line618">line 618</a>
1776
+ <a href="user_kanban.js.html">user/kanban.js</a>, <a href="user_kanban.js.html#line620">line 620</a>
1777
1777
  </span>
1778
1778
  </p>
1779
1779
 
@@ -1858,7 +1858,7 @@ Expected response structure (error):
1858
1858
 
1859
1859
  <div class="columns">
1860
1860
 
1861
- <div class='param-desc column is-7'>[returns.data.taskId] - The ID of the newly created task</div>
1861
+ <div class='param-desc column is-7'>[returns.data.task] - The created task and its properties</div>
1862
1862
 
1863
1863
 
1864
1864
  <div class='column is-5 has-text-left'>
@@ -1915,7 +1915,7 @@ const result = await api.user.kanban.startTask(params, session);
1915
1915
  Expected response structure (success):
1916
1916
  {
1917
1917
  success: true,
1918
- taskId: '507f1f77bcf86cd799439013'
1918
+ task: { _id: '507f1f77bcf86cd799439013', ... }
1919
1919
  }
1920
1920
 
1921
1921
  Expected response structure (error):
@@ -358,6 +358,40 @@ class Documents {
358
358
  }
359
359
  }
360
360
 
361
+ /**
362
+ * @author Myndware &lt;augusto.pissarra@myndware.com>
363
+ * @description Updates a document
364
+ * @param {array&lt;string>} ids array of document _id
365
+ * @param {object} params Object for document payload to update. It has to be the FULL document data, that you can get with findById
366
+ * @param {string} session Session, token JWT
367
+ * @return {Promise}
368
+ * @public
369
+ * @async
370
+ * @example
371
+ *
372
+ * const API = require('@docbrasil/api-systemmanager');
373
+ * const api = new API();
374
+ * const params = { ... };
375
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
376
+ * await api.user.document.findByIdsAndUpdate(['5edf9f8ee896b817e45b8dad'], params, session);
377
+ */
378
+ async findByIdsAndUpdate(ids, params, session) {
379
+ const self = this;
380
+ try {
381
+ Joi.assert(ids, Joi.array().required().error(new Error('ids is required')));
382
+ Joi.assert(params, Joi.object().required().error(new Error('params is required')));
383
+ Joi.assert(session, Joi.string().required().error(new Error('session is required')));
384
+ const { areaId, orgId } = params;
385
+ params.ids = ids;
386
+ const apiCall = self._client
387
+ .put(`/organizations/${orgId}/areas/${areaId}/documents/batch`, params, self._setHeader(session));
388
+
389
+ return self._returnData(await apiCall);
390
+ } catch (ex) {
391
+ throw ex;
392
+ }
393
+ }
394
+
361
395
  /**
362
396
  * @author Myndware &lt;augusto.pissarra@myndware.com>
363
397
  * @description Updates a document.
@@ -661,18 +661,20 @@ class Kanban {
661
661
  /**
662
662
  * @author Myndware &lt;augusto.pissarra@myndware.com>
663
663
  * @description Starts a new task in the Kanban board for a specific organization process
664
+ * @description It will create the task, set the new order for all tasks (if you send them) and return the the task
665
+ * @description The new task is the full object of the task, like when you search the task
664
666
  * @param {Object} params - Parameters object
665
667
  * @param {string} params.orgId - Organization id (_id database)
666
668
  * @param {string} params.orgProcessName - The name of the organization process
667
669
  * @param {string} params.title - The title of the new task
668
670
  * @param {string} params.status - The status id of the new task
669
671
  * @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)
672
+ * @param {Array} [params.tasks] - The task ids, in their current order, of each task inside the same status (optional)
671
673
  * @param {string} session - Session, token JWT
672
674
  * @returns {promise} Promise that resolves to operation status
673
675
  * @returns {Object} returns.data - The response data containing:
674
676
  * @returns {boolean} returns.data.success - Indicates if the operation was successful
675
- * @returns {string} [returns.data.taskId] - The ID of the newly created task
677
+ * @returns {string} [returns.data.task] - The created task and its properties
676
678
  * @returns {string} [returns.data.error] - Error message if operation failed
677
679
  * @public
678
680
  * @example
@@ -693,7 +695,7 @@ class Kanban {
693
695
  * Expected response structure (success):
694
696
  * {
695
697
  * success: true,
696
- * taskId: '507f1f77bcf86cd799439013'
698
+ * task: { _id: '507f1f77bcf86cd799439013', ... }
697
699
  * }
698
700
  *
699
701
  * Expected response structure (error):
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.65",
4
+ "version": "1.1.66",
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",