@docbrasil/api-systemmanager 1.1.28 → 1.1.30

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
@@ -1367,6 +1367,11 @@ API request, user permission level
1367
1367
  Class for Applications, permission user
1368
1368
 
1369
1369
  **Kind**: global class
1370
+
1371
+ * [Application](#Application)
1372
+ * [.list(params, session)](#Application+list) ⇒ <code>promise</code>
1373
+ * [.changeApplication(params, session)](#Application+changeApplication) ⇒ <code>promise</code>
1374
+
1370
1375
  <a name="Application+list"></a>
1371
1376
 
1372
1377
  ### application.list(params, session) ⇒ <code>promise</code>
@@ -1392,6 +1397,31 @@ const params = {
1392
1397
  const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1393
1398
  await api.user.application.list(params, session);
1394
1399
  ```
1400
+ <a name="Application+changeApplication"></a>
1401
+
1402
+ ### application.changeApplication(params, session) ⇒ <code>promise</code>
1403
+ Changes the application for a user in an organization
1404
+
1405
+ **Kind**: instance method of [<code>Application</code>](#Application)
1406
+ **Access**: public
1407
+ **Author**: Myndware <augusto.pissarra@myndware.com>
1408
+
1409
+ | Param | Type | Description |
1410
+ | --- | --- | --- |
1411
+ | params | <code>object</code> | Params to get task |
1412
+ | params.applicationId | <code>object</code> | The application id to change to |
1413
+ | session | <code>string</code> | Session, token JWT |
1414
+
1415
+ **Example**
1416
+ ```js
1417
+ const API = require('@docbrasil/api-systemmanager');
1418
+ const api = new API();
1419
+ const params = {
1420
+ applicationId: '55e4a3bd6be6b45210833fae',
1421
+ };
1422
+ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1423
+ await api.user.application.changeApplication(params, session);
1424
+ ```
1395
1425
  <a name="Chart"></a>
1396
1426
 
1397
1427
  ## Chart
@@ -1541,7 +1571,7 @@ Class for documents, permission user
1541
1571
  * [.exportExcelForAllPages(params, session)](#Documents+exportExcelForAllPages) ⇒ <code>promise</code>
1542
1572
  * [.exportWmsExcelForAllPages(params, session)](#Documents+exportWmsExcelForAllPages) ⇒ <code>promise</code>
1543
1573
  * [.performDownloadComplete(params, session)](#Documents+performDownloadComplete) ⇒ <code>promise</code>
1544
- * [.searchDocumentsMongo(params, session)](#Documents+searchDocumentsMongo) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.&lt;object&gt;</code> \| <code>number</code> \| <code>number</code>
1574
+ * [.searchDocumentsDirect(params, session)](#Documents+searchDocumentsDirect) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.&lt;object&gt;</code> \| <code>number</code> \| <code>number</code>
1545
1575
 
1546
1576
  <a name="Documents+add"></a>
1547
1577
 
@@ -2038,9 +2068,9 @@ const params = {
2038
2068
  const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
2039
2069
  const retSearch = await api.user.document.performDownloadComplete(params, session);
2040
2070
  ```
2041
- <a name="Documents+searchDocumentsMongo"></a>
2071
+ <a name="Documents+searchDocumentsDirect"></a>
2042
2072
 
2043
- ### documents.searchDocumentsMongo(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.&lt;object&gt;</code> \| <code>number</code> \| <code>number</code>
2073
+ ### documents.searchDocumentsDirect(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.&lt;object&gt;</code> \| <code>number</code> \| <code>number</code>
2044
2074
  Method to search documents direct on MongoDB (use carefully and only in cases you need to access direct data
2045
2075
 
2046
2076
  **Kind**: instance method of [<code>Documents</code>](#Documents)
@@ -2064,7 +2094,7 @@ const params = {
2064
2094
  orgId: '55e4a3bd6be6b45210833fae',
2065
2095
  };
2066
2096
  const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
2067
- const retSearch = await api.user.document.searchDocumentsMongo(params, session);
2097
+ const retSearch = await api.user.document.searchDocumentsDirect(params, session);
2068
2098
  ```
2069
2099
  <a name="Help"></a>
2070
2100
 
@@ -2463,6 +2493,7 @@ Class for user registration in a user
2463
2493
  * [.getNew(session)](#Notification+getNew)
2464
2494
  * [.getOld(session)](#Notification+getOld)
2465
2495
  * [.setRead(params, session)](#Notification+setRead) ⇒ <code>Promise</code>
2496
+ * [.setReadAll(session)](#Notification+setReadAll) ⇒ <code>Promise</code>
2466
2497
  * [.setUnread(params, session)](#Notification+setUnread) ⇒ <code>Promise</code>
2467
2498
 
2468
2499
  <a name="Notification+tokenTypes"></a>
@@ -2542,7 +2573,7 @@ await api.user.notification.getOld(session);
2542
2573
  <a name="Notification+setRead"></a>
2543
2574
 
2544
2575
  ### notification.setRead(params, session) ⇒ <code>Promise</code>
2545
- Set notification as readed
2576
+ Set notification as read
2546
2577
 
2547
2578
  **Kind**: instance method of [<code>Notification</code>](#Notification)
2548
2579
  **Access**: public
@@ -2564,6 +2595,26 @@ const params = {
2564
2595
  const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
2565
2596
  await api.user.notification.setRead(params, session);
2566
2597
  ```
2598
+ <a name="Notification+setReadAll"></a>
2599
+
2600
+ ### notification.setReadAll(session) ⇒ <code>Promise</code>
2601
+ Set all notification of the logged user as read
2602
+
2603
+ **Kind**: instance method of [<code>Notification</code>](#Notification)
2604
+ **Access**: public
2605
+ **Author**: Myndware <augusto.pissarra@myndware.com>
2606
+
2607
+ | Param | Type | Description |
2608
+ | --- | --- | --- |
2609
+ | session | <code>string</code> | JWT Token |
2610
+
2611
+ **Example**
2612
+ ```js
2613
+ const API = require('@docbrasil/api-systemmanager');
2614
+ const api = new API();
2615
+ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
2616
+ await api.user.notification.setReadAll(session);
2617
+ ```
2567
2618
  <a name="Notification+setUnread"></a>
2568
2619
 
2569
2620
  ### notification.setUnread(params, session) ⇒ <code>Promise</code>
@@ -224,6 +224,252 @@
224
224
 
225
225
 
226
226
 
227
+ <h4 class="name" id="changeApplication">
228
+ <a class="href-link" href="#changeApplication">#</a>
229
+
230
+
231
+ <span class='tag'>async</span>
232
+
233
+
234
+ <span class="code-name">
235
+
236
+ changeApplication<span class="signature">(params, session)</span><span class="type-signature"> &rarr; {promise}</span>
237
+
238
+ </span>
239
+ </h4>
240
+
241
+
242
+
243
+
244
+ <div class="description">
245
+ Changes the application for a user in an organization
246
+ </div>
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+
255
+
256
+
257
+ <h5>Parameters:</h5>
258
+
259
+ <div class="table-container">
260
+ <table class="params table">
261
+ <thead>
262
+ <tr>
263
+
264
+ <th>Name</th>
265
+
266
+
267
+ <th>Type</th>
268
+
269
+
270
+
271
+
272
+
273
+ <th class="last">Description</th>
274
+ </tr>
275
+ </thead>
276
+
277
+ <tbody>
278
+
279
+
280
+
281
+ <tr class="deep-level-0">
282
+
283
+ <td class="name"><code>params</code></td>
284
+
285
+
286
+ <td class="type">
287
+
288
+
289
+ <code class="param-type">object</code>
290
+
291
+
292
+
293
+ </td>
294
+
295
+
296
+
297
+
298
+
299
+ <td class="description last">Params to get task</td>
300
+ </tr>
301
+
302
+
303
+
304
+
305
+ <tr class="deep-level-1">
306
+
307
+ <td class="name"><code>applicationId</code></td>
308
+
309
+
310
+ <td class="type">
311
+
312
+
313
+ <code class="param-type">object</code>
314
+
315
+
316
+
317
+ </td>
318
+
319
+
320
+
321
+
322
+
323
+ <td class="description last">The application id to change to</td>
324
+ </tr>
325
+
326
+
327
+
328
+
329
+
330
+
331
+
332
+ <tr class="deep-level-0">
333
+
334
+ <td class="name"><code>session</code></td>
335
+
336
+
337
+ <td class="type">
338
+
339
+
340
+ <code class="param-type">string</code>
341
+
342
+
343
+
344
+ </td>
345
+
346
+
347
+
348
+
349
+
350
+ <td class="description last">Session, token JWT</td>
351
+ </tr>
352
+
353
+
354
+
355
+ </tbody>
356
+ </table>
357
+ </div>
358
+
359
+
360
+
361
+
362
+
363
+ <dl class="details">
364
+
365
+
366
+
367
+
368
+
369
+
370
+
371
+
372
+
373
+
374
+
375
+
376
+
377
+
378
+
379
+
380
+
381
+
382
+ <dt class="tag-author">Author:</dt>
383
+ <dd class="tag-author">
384
+ <ul>
385
+ <li><a href="mailto:augusto.pissarra@myndware.com">Myndware</a></li>
386
+ </ul>
387
+ </dd>
388
+
389
+
390
+
391
+
392
+
393
+
394
+
395
+
396
+
397
+
398
+
399
+
400
+
401
+
402
+ <p class="tag-source">
403
+ <a href="user_application.js.html" class="button">View Source</a>
404
+ <span>
405
+ <a href="user_application.js.html">user/application.js</a>, <a href="user_application.js.html#line106">line 106</a>
406
+ </span>
407
+ </p>
408
+
409
+ </dl>
410
+
411
+
412
+
413
+
414
+
415
+
416
+
417
+
418
+
419
+
420
+
421
+
422
+
423
+
424
+
425
+
426
+
427
+
428
+ <div class='columns method-parameter'>
429
+ <div class="column is-2"><label>Returns:</label></div>
430
+ <div class="column is-10">
431
+
432
+
433
+
434
+ <div class="columns">
435
+
436
+
437
+ <div class='column is-5 has-text-left'>
438
+ <label>Type: </label>
439
+
440
+ <code class="param-type">promise</code>
441
+
442
+
443
+ </div>
444
+
445
+ </div>
446
+
447
+
448
+ </div>
449
+ </div>
450
+
451
+
452
+
453
+
454
+ <h5>Example</h5>
455
+
456
+
457
+ <pre class="prettyprint"><code>const API = require('@docbrasil/api-systemmanager');
458
+ const api = new API();
459
+ const params = {
460
+ applicationId: '55e4a3bd6be6b45210833fae',
461
+ };
462
+ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
463
+ await api.user.application.changeApplication(params, session);</code></pre>
464
+
465
+
466
+
467
+ </div>
468
+
469
+ <div class="member">
470
+
471
+
472
+
227
473
  <h4 class="name" id="list">
228
474
  <a class="href-link" href="#list">#</a>
229
475
 
@@ -4841,8 +4841,8 @@ const retSearch = await api.user.document.searchDocuments(params, session);</cod
4841
4841
 
4842
4842
 
4843
4843
 
4844
- <h4 class="name" id="searchDocumentsMongo">
4845
- <a class="href-link" href="#searchDocumentsMongo">#</a>
4844
+ <h4 class="name" id="searchDocumentsDirect">
4845
+ <a class="href-link" href="#searchDocumentsDirect">#</a>
4846
4846
 
4847
4847
 
4848
4848
  <span class='tag'>async</span>
@@ -4850,7 +4850,7 @@ const retSearch = await api.user.document.searchDocuments(params, session);</cod
4850
4850
 
4851
4851
  <span class="code-name">
4852
4852
 
4853
- searchDocumentsMongo<span class="signature">(params, session)</span><span class="type-signature"> &rarr; {promise|number|array.&lt;object>|number|number}</span>
4853
+ searchDocumentsDirect<span class="signature">(params, session)</span><span class="type-signature"> &rarr; {promise|number|array.&lt;object>|number|number}</span>
4854
4854
 
4855
4855
  </span>
4856
4856
  </h4>
@@ -5175,7 +5175,7 @@ const params = {
5175
5175
  orgId: '55e4a3bd6be6b45210833fae',
5176
5176
  };
5177
5177
  const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
5178
- const retSearch = await api.user.document.searchDocumentsMongo(params, session);</code></pre>
5178
+ const retSearch = await api.user.document.searchDocumentsDirect(params, session);</code></pre>
5179
5179
 
5180
5180
 
5181
5181
 
@@ -946,7 +946,7 @@ await api.user.notification.getOld(session);</code></pre>
946
946
 
947
947
 
948
948
  <div class="description">
949
- Set notification as readed
949
+ Set notification as read
950
950
  </div>
951
951
 
952
952
 
@@ -1168,6 +1168,198 @@ await api.user.notification.setRead(params, session);</code></pre>
1168
1168
 
1169
1169
 
1170
1170
 
1171
+ </div>
1172
+
1173
+ <div class="member">
1174
+
1175
+
1176
+
1177
+ <h4 class="name" id="setReadAll">
1178
+ <a class="href-link" href="#setReadAll">#</a>
1179
+
1180
+
1181
+ <span class='tag'>async</span>
1182
+
1183
+
1184
+ <span class="code-name">
1185
+
1186
+ setReadAll<span class="signature">(session)</span><span class="type-signature"> &rarr; {Promise}</span>
1187
+
1188
+ </span>
1189
+ </h4>
1190
+
1191
+
1192
+
1193
+
1194
+ <div class="description">
1195
+ Set all notification of the logged user as read
1196
+ </div>
1197
+
1198
+
1199
+
1200
+
1201
+
1202
+
1203
+
1204
+
1205
+
1206
+
1207
+ <h5>Parameters:</h5>
1208
+
1209
+ <div class="table-container">
1210
+ <table class="params table">
1211
+ <thead>
1212
+ <tr>
1213
+
1214
+ <th>Name</th>
1215
+
1216
+
1217
+ <th>Type</th>
1218
+
1219
+
1220
+
1221
+
1222
+
1223
+ <th class="last">Description</th>
1224
+ </tr>
1225
+ </thead>
1226
+
1227
+ <tbody>
1228
+
1229
+
1230
+
1231
+ <tr class="deep-level-0">
1232
+
1233
+ <td class="name"><code>session</code></td>
1234
+
1235
+
1236
+ <td class="type">
1237
+
1238
+
1239
+ <code class="param-type">string</code>
1240
+
1241
+
1242
+
1243
+ </td>
1244
+
1245
+
1246
+
1247
+
1248
+
1249
+ <td class="description last">JWT Token</td>
1250
+ </tr>
1251
+
1252
+
1253
+
1254
+ </tbody>
1255
+ </table>
1256
+ </div>
1257
+
1258
+
1259
+
1260
+
1261
+
1262
+ <dl class="details">
1263
+
1264
+
1265
+
1266
+
1267
+
1268
+
1269
+
1270
+
1271
+
1272
+
1273
+
1274
+
1275
+
1276
+
1277
+
1278
+
1279
+
1280
+
1281
+ <dt class="tag-author">Author:</dt>
1282
+ <dd class="tag-author">
1283
+ <ul>
1284
+ <li><a href="mailto:augusto.pissarra@myndware.com">Myndware</a></li>
1285
+ </ul>
1286
+ </dd>
1287
+
1288
+
1289
+
1290
+
1291
+
1292
+
1293
+
1294
+
1295
+
1296
+
1297
+
1298
+
1299
+
1300
+
1301
+ <p class="tag-source">
1302
+ <a href="user_notification.js.html" class="button">View Source</a>
1303
+ <span>
1304
+ <a href="user_notification.js.html">user/notification.js</a>, <a href="user_notification.js.html#line202">line 202</a>
1305
+ </span>
1306
+ </p>
1307
+
1308
+ </dl>
1309
+
1310
+
1311
+
1312
+
1313
+
1314
+
1315
+
1316
+
1317
+
1318
+
1319
+
1320
+
1321
+
1322
+
1323
+
1324
+
1325
+
1326
+
1327
+ <div class='columns method-parameter'>
1328
+ <div class="column is-2"><label>Returns:</label></div>
1329
+ <div class="column is-10">
1330
+
1331
+
1332
+
1333
+ <div class="columns">
1334
+
1335
+
1336
+ <div class='column is-5 has-text-left'>
1337
+ <label>Type: </label>
1338
+
1339
+ <code class="param-type">Promise</code>
1340
+
1341
+
1342
+ </div>
1343
+
1344
+ </div>
1345
+
1346
+
1347
+ </div>
1348
+ </div>
1349
+
1350
+
1351
+
1352
+
1353
+ <h5>Example</h5>
1354
+
1355
+
1356
+ <pre class="prettyprint"><code>const API = require('@docbrasil/api-systemmanager');
1357
+ const api = new API();
1358
+ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1359
+ await api.user.notification.setReadAll(session);</code></pre>
1360
+
1361
+
1362
+
1171
1363
  </div>
1172
1364
 
1173
1365
  <div class="member">
@@ -1352,7 +1544,7 @@ await api.user.notification.setRead(params, session);</code></pre>
1352
1544
  <p class="tag-source">
1353
1545
  <a href="user_notification.js.html" class="button">View Source</a>
1354
1546
  <span>
1355
- <a href="user_notification.js.html">user/notification.js</a>, <a href="user_notification.js.html#line207">line 207</a>
1547
+ <a href="user_notification.js.html">user/notification.js</a>, <a href="user_notification.js.html#line238">line 238</a>
1356
1548
  </span>
1357
1549
  </p>
1358
1550
 
@@ -171,6 +171,42 @@ class Application {
171
171
  throw ex;
172
172
  }
173
173
  }
174
+
175
+ /**
176
+ * @author Myndware &lt;augusto.pissarra@myndware.com>
177
+ * @description Changes the application for a user in an organization
178
+ * @param {object} params Params to get task
179
+ * @param {object} params.applicationId The application id to change to
180
+ * @param {string} session Session, token JWT
181
+ * @returns {promise}
182
+ * @public
183
+ * @example
184
+ *
185
+ * const API = require('@docbrasil/api-systemmanager');
186
+ * const api = new API();
187
+ * const params = {
188
+ * applicationId: '55e4a3bd6be6b45210833fae',
189
+ * };
190
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
191
+ * await api.user.application.changeApplication(params, session);
192
+ */
193
+ async changeApplication(params, session) {
194
+ const self = this;
195
+
196
+ try {
197
+ Joi.assert(params, Joi.object().required(), 'Params to get task');
198
+ Joi.assert(params.applicationId, Joi.string().required(), 'The application id');
199
+ Joi.assert(session, Joi.string().required(), 'Session token JWT');
200
+
201
+ const { orgId} = params;
202
+ const apiCall = self._client
203
+ .put('/organizations/applications/change', { applicationId: params.applicationId }, self._setHeader(session));
204
+
205
+ return self._returnData(await apiCall);
206
+ } catch (ex) {
207
+ throw ex;
208
+ }
209
+ }
174
210
  }
175
211
 
176
212
  export default Application;
@@ -1043,9 +1043,9 @@ class Documents {
1043
1043
  * orgId: '55e4a3bd6be6b45210833fae',
1044
1044
  * };
1045
1045
  * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1046
- * const retSearch = await api.user.document.searchDocumentsMongo(params, session);
1046
+ * const retSearch = await api.user.document.searchDocumentsDirect(params, session);
1047
1047
  */
1048
- async searchDocumentsMongo(params, session) {
1048
+ async searchDocumentsDirect(params, session) {
1049
1049
  const self = this;
1050
1050
 
1051
1051
  try {