@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/doc/api.md
CHANGED
|
@@ -2260,6 +2260,7 @@ Class for task, permission user
|
|
|
2260
2260
|
|
|
2261
2261
|
* [Kanban](#Kanban)
|
|
2262
2262
|
* [.get(params, session)](#Kanban+get) ⇒ <code>promise</code> \| <code>Object</code> \| <code>boolean</code> \| <code>Array</code> \| <code>string</code> \| <code>string</code> \| <code>boolean</code> \| <code>Array</code> \| <code>Array</code>
|
|
2263
|
+
* [.update(params, session)](#Kanban+update) ⇒ <code>promise</code> \| <code>Object</code> \| <code>boolean</code> \| <code>string</code>
|
|
2263
2264
|
* [.updateTaskOrder(params, session)](#Kanban+updateTaskOrder) ⇒ <code>promise</code> \| <code>Object</code> \| <code>boolean</code> \| <code>string</code>
|
|
2264
2265
|
* [.updateTasksOrder(params, session)](#Kanban+updateTasksOrder) ⇒ <code>promise</code> \| <code>Object</code> \| <code>boolean</code> \| <code>string</code>
|
|
2265
2266
|
* [.updateTaskStatus(params, session)](#Kanban+updateTaskStatus) ⇒ <code>promise</code> \| <code>Object</code> \| <code>boolean</code> \| <code>string</code>
|
|
@@ -2321,6 +2322,52 @@ Expected response structure:
|
|
|
2321
2322
|
]
|
|
2322
2323
|
}
|
|
2323
2324
|
```
|
|
2325
|
+
<a name="Kanban+update"></a>
|
|
2326
|
+
|
|
2327
|
+
### kanban.update(params, session) ⇒ <code>promise</code> \| <code>Object</code> \| <code>boolean</code> \| <code>string</code>
|
|
2328
|
+
Updates the tasks order and status
|
|
2329
|
+
|
|
2330
|
+
**Kind**: instance method of [<code>Kanban</code>](#Kanban)
|
|
2331
|
+
**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.error] - Error message if operation failed
|
|
2332
|
+
**Access**: public
|
|
2333
|
+
**Author**: Myndware <augusto.pissarra@myndware.com>
|
|
2334
|
+
|
|
2335
|
+
| Param | Type | Description |
|
|
2336
|
+
| --- | --- | --- |
|
|
2337
|
+
| params | <code>Object</code> | Parameters object |
|
|
2338
|
+
| params.orgId | <code>string</code> | Organization id (_id database) |
|
|
2339
|
+
| params.tasks | <code>Array</code> | Array of task objects containing taskId and order |
|
|
2340
|
+
| params.tasks[].taskId | <code>string</code> | The unique identifier of the task to update |
|
|
2341
|
+
| params.tasks[].order | <code>number</code> | The new order position for the task |
|
|
2342
|
+
| params.tasks[].status | <code>string</code> | The status of the task |
|
|
2343
|
+
| session | <code>string</code> | Session, token JWT |
|
|
2344
|
+
|
|
2345
|
+
**Example**
|
|
2346
|
+
```js
|
|
2347
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2348
|
+
const api = new API();
|
|
2349
|
+
const params = {
|
|
2350
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2351
|
+
tasks: [
|
|
2352
|
+
{ taskId: '507f1f77bcf86cd799439011', order: 0, status: '507f1f77bcf86cd799439012' },
|
|
2353
|
+
{ taskId: '507f1f77bcf86cd799439012', order: 1, status: '507f1f77bcf86cd799439012' },
|
|
2354
|
+
{ taskId: '507f1f77bcf86cd799439013', order: 0, status: '507f1f77bcf86cd799439013' }
|
|
2355
|
+
]
|
|
2356
|
+
};
|
|
2357
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2358
|
+
const result = await api.user.kanban.updateTasksOrder(params, session);
|
|
2359
|
+
|
|
2360
|
+
Expected response structure (success):
|
|
2361
|
+
{
|
|
2362
|
+
success: true
|
|
2363
|
+
}
|
|
2364
|
+
|
|
2365
|
+
Expected response structure (error):
|
|
2366
|
+
{
|
|
2367
|
+
success: false,
|
|
2368
|
+
error: "One or more tasks not found"
|
|
2369
|
+
}
|
|
2370
|
+
```
|
|
2324
2371
|
<a name="Kanban+updateTaskOrder"></a>
|
|
2325
2372
|
|
|
2326
2373
|
### kanban.updateTaskOrder(params, session) ⇒ <code>promise</code> \| <code>Object</code> \| <code>boolean</code> \| <code>string</code>
|
package/docs/Kanban.html
CHANGED
|
@@ -448,7 +448,7 @@
|
|
|
448
448
|
<p class="tag-source">
|
|
449
449
|
<a href="user_kanban.js.html" class="button">View Source</a>
|
|
450
450
|
<span>
|
|
451
|
-
<a href="user_kanban.js.html">user/kanban.js</a>, <a href="user_kanban.js.html#
|
|
451
|
+
<a href="user_kanban.js.html">user/kanban.js</a>, <a href="user_kanban.js.html#line415">line 415</a>
|
|
452
452
|
</span>
|
|
453
453
|
</p>
|
|
454
454
|
|
|
@@ -1273,7 +1273,7 @@ Expected response structure:
|
|
|
1273
1273
|
<p class="tag-source">
|
|
1274
1274
|
<a href="user_kanban.js.html" class="button">View Source</a>
|
|
1275
1275
|
<span>
|
|
1276
|
-
<a href="user_kanban.js.html">user/kanban.js</a>, <a href="user_kanban.js.html#
|
|
1276
|
+
<a href="user_kanban.js.html">user/kanban.js</a>, <a href="user_kanban.js.html#line475">line 475</a>
|
|
1277
1277
|
</span>
|
|
1278
1278
|
</p>
|
|
1279
1279
|
|
|
@@ -1404,6 +1404,416 @@ Expected response structure (error):
|
|
|
1404
1404
|
|
|
1405
1405
|
|
|
1406
1406
|
|
|
1407
|
+
</div>
|
|
1408
|
+
|
|
1409
|
+
<div class="member">
|
|
1410
|
+
|
|
1411
|
+
|
|
1412
|
+
|
|
1413
|
+
<h4 class="name" id="update">
|
|
1414
|
+
<a class="href-link" href="#update">#</a>
|
|
1415
|
+
|
|
1416
|
+
|
|
1417
|
+
<span class='tag'>async</span>
|
|
1418
|
+
|
|
1419
|
+
|
|
1420
|
+
<span class="code-name">
|
|
1421
|
+
|
|
1422
|
+
update<span class="signature">(params, session)</span><span class="type-signature"> → {promise|Object|boolean|string}</span>
|
|
1423
|
+
|
|
1424
|
+
</span>
|
|
1425
|
+
</h4>
|
|
1426
|
+
|
|
1427
|
+
|
|
1428
|
+
|
|
1429
|
+
|
|
1430
|
+
<div class="description">
|
|
1431
|
+
Updates the tasks order and status
|
|
1432
|
+
</div>
|
|
1433
|
+
|
|
1434
|
+
|
|
1435
|
+
|
|
1436
|
+
|
|
1437
|
+
|
|
1438
|
+
|
|
1439
|
+
|
|
1440
|
+
|
|
1441
|
+
|
|
1442
|
+
|
|
1443
|
+
<h5>Parameters:</h5>
|
|
1444
|
+
|
|
1445
|
+
<div class="table-container">
|
|
1446
|
+
<table class="params table">
|
|
1447
|
+
<thead>
|
|
1448
|
+
<tr>
|
|
1449
|
+
|
|
1450
|
+
<th>Name</th>
|
|
1451
|
+
|
|
1452
|
+
|
|
1453
|
+
<th>Type</th>
|
|
1454
|
+
|
|
1455
|
+
|
|
1456
|
+
|
|
1457
|
+
|
|
1458
|
+
|
|
1459
|
+
<th class="last">Description</th>
|
|
1460
|
+
</tr>
|
|
1461
|
+
</thead>
|
|
1462
|
+
|
|
1463
|
+
<tbody>
|
|
1464
|
+
|
|
1465
|
+
|
|
1466
|
+
|
|
1467
|
+
<tr class="deep-level-0">
|
|
1468
|
+
|
|
1469
|
+
<td class="name"><code>params</code></td>
|
|
1470
|
+
|
|
1471
|
+
|
|
1472
|
+
<td class="type">
|
|
1473
|
+
|
|
1474
|
+
|
|
1475
|
+
<code class="param-type">Object</code>
|
|
1476
|
+
|
|
1477
|
+
|
|
1478
|
+
|
|
1479
|
+
</td>
|
|
1480
|
+
|
|
1481
|
+
|
|
1482
|
+
|
|
1483
|
+
|
|
1484
|
+
|
|
1485
|
+
<td class="description last">Parameters object</td>
|
|
1486
|
+
</tr>
|
|
1487
|
+
|
|
1488
|
+
|
|
1489
|
+
|
|
1490
|
+
|
|
1491
|
+
<tr class="deep-level-1">
|
|
1492
|
+
|
|
1493
|
+
<td class="name"><code>orgId</code></td>
|
|
1494
|
+
|
|
1495
|
+
|
|
1496
|
+
<td class="type">
|
|
1497
|
+
|
|
1498
|
+
|
|
1499
|
+
<code class="param-type">string</code>
|
|
1500
|
+
|
|
1501
|
+
|
|
1502
|
+
|
|
1503
|
+
</td>
|
|
1504
|
+
|
|
1505
|
+
|
|
1506
|
+
|
|
1507
|
+
|
|
1508
|
+
|
|
1509
|
+
<td class="description last">Organization id (_id database)</td>
|
|
1510
|
+
</tr>
|
|
1511
|
+
|
|
1512
|
+
|
|
1513
|
+
|
|
1514
|
+
<tr class="deep-level-1">
|
|
1515
|
+
|
|
1516
|
+
<td class="name"><code>tasks</code></td>
|
|
1517
|
+
|
|
1518
|
+
|
|
1519
|
+
<td class="type">
|
|
1520
|
+
|
|
1521
|
+
|
|
1522
|
+
<code class="param-type">Array</code>
|
|
1523
|
+
|
|
1524
|
+
|
|
1525
|
+
|
|
1526
|
+
</td>
|
|
1527
|
+
|
|
1528
|
+
|
|
1529
|
+
|
|
1530
|
+
|
|
1531
|
+
|
|
1532
|
+
<td class="description last">Array of task objects containing taskId and order</td>
|
|
1533
|
+
</tr>
|
|
1534
|
+
|
|
1535
|
+
|
|
1536
|
+
|
|
1537
|
+
<tr class="deep-level-1">
|
|
1538
|
+
|
|
1539
|
+
<td class="name"><code>tasks[].taskId</code></td>
|
|
1540
|
+
|
|
1541
|
+
|
|
1542
|
+
<td class="type">
|
|
1543
|
+
|
|
1544
|
+
|
|
1545
|
+
<code class="param-type">string</code>
|
|
1546
|
+
|
|
1547
|
+
|
|
1548
|
+
|
|
1549
|
+
</td>
|
|
1550
|
+
|
|
1551
|
+
|
|
1552
|
+
|
|
1553
|
+
|
|
1554
|
+
|
|
1555
|
+
<td class="description last">The unique identifier of the task to update</td>
|
|
1556
|
+
</tr>
|
|
1557
|
+
|
|
1558
|
+
|
|
1559
|
+
|
|
1560
|
+
<tr class="deep-level-1">
|
|
1561
|
+
|
|
1562
|
+
<td class="name"><code>tasks[].order</code></td>
|
|
1563
|
+
|
|
1564
|
+
|
|
1565
|
+
<td class="type">
|
|
1566
|
+
|
|
1567
|
+
|
|
1568
|
+
<code class="param-type">number</code>
|
|
1569
|
+
|
|
1570
|
+
|
|
1571
|
+
|
|
1572
|
+
</td>
|
|
1573
|
+
|
|
1574
|
+
|
|
1575
|
+
|
|
1576
|
+
|
|
1577
|
+
|
|
1578
|
+
<td class="description last">The new order position for the task</td>
|
|
1579
|
+
</tr>
|
|
1580
|
+
|
|
1581
|
+
|
|
1582
|
+
|
|
1583
|
+
<tr class="deep-level-1">
|
|
1584
|
+
|
|
1585
|
+
<td class="name"><code>tasks[].status</code></td>
|
|
1586
|
+
|
|
1587
|
+
|
|
1588
|
+
<td class="type">
|
|
1589
|
+
|
|
1590
|
+
|
|
1591
|
+
<code class="param-type">string</code>
|
|
1592
|
+
|
|
1593
|
+
|
|
1594
|
+
|
|
1595
|
+
</td>
|
|
1596
|
+
|
|
1597
|
+
|
|
1598
|
+
|
|
1599
|
+
|
|
1600
|
+
|
|
1601
|
+
<td class="description last">The status of the task</td>
|
|
1602
|
+
</tr>
|
|
1603
|
+
|
|
1604
|
+
|
|
1605
|
+
|
|
1606
|
+
|
|
1607
|
+
|
|
1608
|
+
|
|
1609
|
+
|
|
1610
|
+
<tr class="deep-level-0">
|
|
1611
|
+
|
|
1612
|
+
<td class="name"><code>session</code></td>
|
|
1613
|
+
|
|
1614
|
+
|
|
1615
|
+
<td class="type">
|
|
1616
|
+
|
|
1617
|
+
|
|
1618
|
+
<code class="param-type">string</code>
|
|
1619
|
+
|
|
1620
|
+
|
|
1621
|
+
|
|
1622
|
+
</td>
|
|
1623
|
+
|
|
1624
|
+
|
|
1625
|
+
|
|
1626
|
+
|
|
1627
|
+
|
|
1628
|
+
<td class="description last">Session, token JWT</td>
|
|
1629
|
+
</tr>
|
|
1630
|
+
|
|
1631
|
+
|
|
1632
|
+
|
|
1633
|
+
</tbody>
|
|
1634
|
+
</table>
|
|
1635
|
+
</div>
|
|
1636
|
+
|
|
1637
|
+
|
|
1638
|
+
|
|
1639
|
+
|
|
1640
|
+
|
|
1641
|
+
<dl class="details">
|
|
1642
|
+
|
|
1643
|
+
|
|
1644
|
+
|
|
1645
|
+
|
|
1646
|
+
|
|
1647
|
+
|
|
1648
|
+
|
|
1649
|
+
|
|
1650
|
+
|
|
1651
|
+
|
|
1652
|
+
|
|
1653
|
+
|
|
1654
|
+
|
|
1655
|
+
|
|
1656
|
+
|
|
1657
|
+
|
|
1658
|
+
|
|
1659
|
+
|
|
1660
|
+
<dt class="tag-author">Author:</dt>
|
|
1661
|
+
<dd class="tag-author">
|
|
1662
|
+
<ul>
|
|
1663
|
+
<li><a href="mailto:augusto.pissarra@myndware.com">Myndware</a></li>
|
|
1664
|
+
</ul>
|
|
1665
|
+
</dd>
|
|
1666
|
+
|
|
1667
|
+
|
|
1668
|
+
|
|
1669
|
+
|
|
1670
|
+
|
|
1671
|
+
|
|
1672
|
+
|
|
1673
|
+
|
|
1674
|
+
|
|
1675
|
+
|
|
1676
|
+
|
|
1677
|
+
|
|
1678
|
+
|
|
1679
|
+
|
|
1680
|
+
<p class="tag-source">
|
|
1681
|
+
<a href="user_kanban.js.html" class="button">View Source</a>
|
|
1682
|
+
<span>
|
|
1683
|
+
<a href="user_kanban.js.html">user/kanban.js</a>, <a href="user_kanban.js.html#line173">line 173</a>
|
|
1684
|
+
</span>
|
|
1685
|
+
</p>
|
|
1686
|
+
|
|
1687
|
+
</dl>
|
|
1688
|
+
|
|
1689
|
+
|
|
1690
|
+
|
|
1691
|
+
|
|
1692
|
+
|
|
1693
|
+
|
|
1694
|
+
|
|
1695
|
+
|
|
1696
|
+
|
|
1697
|
+
|
|
1698
|
+
|
|
1699
|
+
|
|
1700
|
+
|
|
1701
|
+
|
|
1702
|
+
|
|
1703
|
+
|
|
1704
|
+
|
|
1705
|
+
|
|
1706
|
+
<div class='columns method-parameter'>
|
|
1707
|
+
<div class="column is-2"><label>Returns:</label></div>
|
|
1708
|
+
<div class="column is-10">
|
|
1709
|
+
|
|
1710
|
+
|
|
1711
|
+
|
|
1712
|
+
<div class="columns">
|
|
1713
|
+
|
|
1714
|
+
<div class='param-desc column is-7'>Promise that resolves to operation status</div>
|
|
1715
|
+
|
|
1716
|
+
|
|
1717
|
+
<div class='column is-5 has-text-left'>
|
|
1718
|
+
<label>Type: </label>
|
|
1719
|
+
|
|
1720
|
+
<code class="param-type">promise</code>
|
|
1721
|
+
|
|
1722
|
+
|
|
1723
|
+
</div>
|
|
1724
|
+
|
|
1725
|
+
</div>
|
|
1726
|
+
|
|
1727
|
+
|
|
1728
|
+
|
|
1729
|
+
|
|
1730
|
+
<div class="columns">
|
|
1731
|
+
|
|
1732
|
+
<div class='param-desc column is-7'>returns.data - The response data containing:</div>
|
|
1733
|
+
|
|
1734
|
+
|
|
1735
|
+
<div class='column is-5 has-text-left'>
|
|
1736
|
+
<label>Type: </label>
|
|
1737
|
+
|
|
1738
|
+
<code class="param-type">Object</code>
|
|
1739
|
+
|
|
1740
|
+
|
|
1741
|
+
</div>
|
|
1742
|
+
|
|
1743
|
+
</div>
|
|
1744
|
+
|
|
1745
|
+
|
|
1746
|
+
|
|
1747
|
+
|
|
1748
|
+
<div class="columns">
|
|
1749
|
+
|
|
1750
|
+
<div class='param-desc column is-7'>returns.data.success - Indicates if the operation was successful</div>
|
|
1751
|
+
|
|
1752
|
+
|
|
1753
|
+
<div class='column is-5 has-text-left'>
|
|
1754
|
+
<label>Type: </label>
|
|
1755
|
+
|
|
1756
|
+
<code class="param-type">boolean</code>
|
|
1757
|
+
|
|
1758
|
+
|
|
1759
|
+
</div>
|
|
1760
|
+
|
|
1761
|
+
</div>
|
|
1762
|
+
|
|
1763
|
+
|
|
1764
|
+
|
|
1765
|
+
|
|
1766
|
+
<div class="columns">
|
|
1767
|
+
|
|
1768
|
+
<div class='param-desc column is-7'>[returns.data.error] - Error message if operation failed</div>
|
|
1769
|
+
|
|
1770
|
+
|
|
1771
|
+
<div class='column is-5 has-text-left'>
|
|
1772
|
+
<label>Type: </label>
|
|
1773
|
+
|
|
1774
|
+
<code class="param-type">string</code>
|
|
1775
|
+
|
|
1776
|
+
|
|
1777
|
+
</div>
|
|
1778
|
+
|
|
1779
|
+
</div>
|
|
1780
|
+
|
|
1781
|
+
|
|
1782
|
+
</div>
|
|
1783
|
+
</div>
|
|
1784
|
+
|
|
1785
|
+
|
|
1786
|
+
|
|
1787
|
+
|
|
1788
|
+
<h5>Example</h5>
|
|
1789
|
+
|
|
1790
|
+
|
|
1791
|
+
<pre class="prettyprint"><code>const API = require('@docbrasil/api-systemmanager');
|
|
1792
|
+
const api = new API();
|
|
1793
|
+
const params = {
|
|
1794
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
1795
|
+
tasks: [
|
|
1796
|
+
{ taskId: '507f1f77bcf86cd799439011', order: 0, status: '507f1f77bcf86cd799439012' },
|
|
1797
|
+
{ taskId: '507f1f77bcf86cd799439012', order: 1, status: '507f1f77bcf86cd799439012' },
|
|
1798
|
+
{ taskId: '507f1f77bcf86cd799439013', order: 0, status: '507f1f77bcf86cd799439013' }
|
|
1799
|
+
]
|
|
1800
|
+
};
|
|
1801
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1802
|
+
const result = await api.user.kanban.updateTasksOrder(params, session);
|
|
1803
|
+
|
|
1804
|
+
Expected response structure (success):
|
|
1805
|
+
{
|
|
1806
|
+
success: true
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
Expected response structure (error):
|
|
1810
|
+
{
|
|
1811
|
+
success: false,
|
|
1812
|
+
error: "One or more tasks not found"
|
|
1813
|
+
}</code></pre>
|
|
1814
|
+
|
|
1815
|
+
|
|
1816
|
+
|
|
1407
1817
|
</div>
|
|
1408
1818
|
|
|
1409
1819
|
<div class="member">
|
|
@@ -1751,7 +2161,7 @@ Expected response structure (error):
|
|
|
1751
2161
|
<p class="tag-source">
|
|
1752
2162
|
<a href="user_kanban.js.html" class="button">View Source</a>
|
|
1753
2163
|
<span>
|
|
1754
|
-
<a href="user_kanban.js.html">user/kanban.js</a>, <a href="user_kanban.js.html#
|
|
2164
|
+
<a href="user_kanban.js.html">user/kanban.js</a>, <a href="user_kanban.js.html#line548">line 548</a>
|
|
1755
2165
|
</span>
|
|
1756
2166
|
</p>
|
|
1757
2167
|
|
|
@@ -2118,7 +2528,7 @@ Expected response structure (error):
|
|
|
2118
2528
|
<p class="tag-source">
|
|
2119
2529
|
<a href="user_kanban.js.html" class="button">View Source</a>
|
|
2120
2530
|
<span>
|
|
2121
|
-
<a href="user_kanban.js.html">user/kanban.js</a>, <a href="user_kanban.js.html#
|
|
2531
|
+
<a href="user_kanban.js.html">user/kanban.js</a>, <a href="user_kanban.js.html#line232">line 232</a>
|
|
2122
2532
|
</span>
|
|
2123
2533
|
</p>
|
|
2124
2534
|
|
|
@@ -2479,7 +2889,7 @@ Expected response structure (error):
|
|
|
2479
2889
|
<p class="tag-source">
|
|
2480
2890
|
<a href="user_kanban.js.html" class="button">View Source</a>
|
|
2481
2891
|
<span>
|
|
2482
|
-
<a href="user_kanban.js.html">user/kanban.js</a>, <a href="user_kanban.js.html#
|
|
2892
|
+
<a href="user_kanban.js.html">user/kanban.js</a>, <a href="user_kanban.js.html#line355">line 355</a>
|
|
2483
2893
|
</span>
|
|
2484
2894
|
</p>
|
|
2485
2895
|
|
|
@@ -2863,7 +3273,7 @@ Expected response structure (error):
|
|
|
2863
3273
|
<p class="tag-source">
|
|
2864
3274
|
<a href="user_kanban.js.html" class="button">View Source</a>
|
|
2865
3275
|
<span>
|
|
2866
|
-
<a href="user_kanban.js.html">user/kanban.js</a>, <a href="user_kanban.js.html#
|
|
3276
|
+
<a href="user_kanban.js.html">user/kanban.js</a>, <a href="user_kanban.js.html#line296">line 296</a>
|
|
2867
3277
|
</span>
|
|
2868
3278
|
</p>
|
|
2869
3279
|
|
package/docs/user_kanban.js.html
CHANGED
|
@@ -216,6 +216,70 @@ class Kanban {
|
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
+
/**
|
|
220
|
+
* @author Myndware <augusto.pissarra@myndware.com>
|
|
221
|
+
* @description Updates the tasks order and status
|
|
222
|
+
* @param {Object} params - Parameters object
|
|
223
|
+
* @param {string} params.orgId - Organization id (_id database)
|
|
224
|
+
* @param {Array} params.tasks - Array of task objects containing taskId and order
|
|
225
|
+
* @param {string} params.tasks[].taskId - The unique identifier of the task to update
|
|
226
|
+
* @param {number} params.tasks[].order - The new order position for the task
|
|
227
|
+
* @param {string} params.tasks[].status - The status of the task
|
|
228
|
+
* @param {string} session - Session, token JWT
|
|
229
|
+
* @returns {promise} Promise that resolves to operation status
|
|
230
|
+
* @returns {Object} returns.data - The response data containing:
|
|
231
|
+
* @returns {boolean} returns.data.success - Indicates if the operation was successful
|
|
232
|
+
* @returns {string} [returns.data.error] - Error message if operation failed
|
|
233
|
+
* @public
|
|
234
|
+
* @example
|
|
235
|
+
*
|
|
236
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
237
|
+
* const api = new API();
|
|
238
|
+
* const params = {
|
|
239
|
+
* orgId: '55e4a3bd6be6b45210833fae',
|
|
240
|
+
* tasks: [
|
|
241
|
+
* { taskId: '507f1f77bcf86cd799439011', order: 0, status: '507f1f77bcf86cd799439012' },
|
|
242
|
+
* { taskId: '507f1f77bcf86cd799439012', order: 1, status: '507f1f77bcf86cd799439012' },
|
|
243
|
+
* { taskId: '507f1f77bcf86cd799439013', order: 0, status: '507f1f77bcf86cd799439013' }
|
|
244
|
+
* ]
|
|
245
|
+
* };
|
|
246
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
247
|
+
* const result = await api.user.kanban.updateTasksOrder(params, session);
|
|
248
|
+
*
|
|
249
|
+
* Expected response structure (success):
|
|
250
|
+
* {
|
|
251
|
+
* success: true
|
|
252
|
+
* }
|
|
253
|
+
*
|
|
254
|
+
* Expected response structure (error):
|
|
255
|
+
* {
|
|
256
|
+
* success: false,
|
|
257
|
+
* error: "One or more tasks not found"
|
|
258
|
+
* }
|
|
259
|
+
*/
|
|
260
|
+
async update(params, session) {
|
|
261
|
+
const self = this;
|
|
262
|
+
|
|
263
|
+
try {
|
|
264
|
+
Joi.assert(params, Joi.object().required(), 'Params to update tasks order');
|
|
265
|
+
Joi.assert(params.orgId, Joi.string().required(), 'Organization id (_id database)');
|
|
266
|
+
Joi.assert(params.tasks, Joi.array().required(), 'Array of task objects containing taskId and order');
|
|
267
|
+
Joi.assert(session, Joi.string().required(), 'Session token JWT');
|
|
268
|
+
|
|
269
|
+
const { orgId, tasks } = params;
|
|
270
|
+
|
|
271
|
+
// Build API endpoint for updating multiple tasks order
|
|
272
|
+
const endpoint = `/organization/${orgId}/kanban/tasks`;
|
|
273
|
+
|
|
274
|
+
const apiCall = self._client
|
|
275
|
+
.put(endpoint, { tasks }, self._setHeader(session));
|
|
276
|
+
|
|
277
|
+
return self._returnData(await apiCall);
|
|
278
|
+
} catch (ex) {
|
|
279
|
+
throw ex;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
219
283
|
/**
|
|
220
284
|
* @author Myndware <augusto.pissarra@myndware.com>
|
|
221
285
|
* @description Updates the order of a task in its status column on the Kanban board
|
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.64",
|
|
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",
|