@docbrasil/api-systemmanager 1.0.93 → 1.0.94

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.
Files changed (58) hide show
  1. package/api/admin/doctypes.js +76 -76
  2. package/api/admin/document.js +332 -332
  3. package/api/admin/form.js +151 -151
  4. package/api/admin/index.js +46 -46
  5. package/api/admin/list.js +133 -133
  6. package/api/admin/message.js +194 -194
  7. package/api/admin/notification.js +233 -233
  8. package/api/admin/organization.js +124 -124
  9. package/api/admin/plugin.js +116 -116
  10. package/api/admin/policy.js +78 -78
  11. package/api/admin/processes.js +370 -370
  12. package/api/admin/task.js +125 -125
  13. package/api/admin/user.js +185 -185
  14. package/api/dispatch.js +101 -101
  15. package/api/general/geoLocation.js +88 -88
  16. package/api/general/index.js +23 -23
  17. package/api/login.js +267 -267
  18. package/api/session.js +85 -85
  19. package/api/user/datasource.js +144 -144
  20. package/api/user/document.js +730 -730
  21. package/api/user/index.js +39 -39
  22. package/api/user/notification.js +101 -101
  23. package/api/user/organization.js +230 -230
  24. package/api/user/process.js +191 -191
  25. package/api/user/register.js +205 -205
  26. package/api/user/task.js +201 -201
  27. package/api/user/task_available.js +135 -135
  28. package/api/user/user.js +287 -287
  29. package/api/utils/cypher.js +37 -37
  30. package/api/utils/promises.js +118 -118
  31. package/bundleRollup.js +158 -158
  32. package/dist/bundle.cjs +4875 -4875
  33. package/dist/bundle.mjs +1 -1
  34. package/doc/api.md +336 -674
  35. package/doc.md +653 -653
  36. package/helper/boom.js +487 -487
  37. package/helper/cryptojs.js +6067 -6067
  38. package/index.js +85 -85
  39. package/package-lock.json +4635 -4635
  40. package/package.json +68 -68
  41. package/readme.md +25 -25
  42. package/tests/admin/document.spec.js +45 -45
  43. package/tests/admin/form.spec.js +74 -74
  44. package/tests/admin/list.spec.js +86 -86
  45. package/tests/admin/message.js +92 -92
  46. package/tests/admin/notification.spec.js +174 -174
  47. package/tests/admin/pluginspec..js +71 -71
  48. package/tests/admin/policy.spec.js +71 -71
  49. package/tests/admin/processes.spec.js +119 -119
  50. package/tests/admin/users.spec.js +127 -127
  51. package/tests/documents.spec.js +164 -164
  52. package/tests/login.spec.js +91 -91
  53. package/tests/session.spec..js +58 -58
  54. package/tests/user/documents.js +164 -164
  55. package/tests/user/organization.js +122 -122
  56. package/tests/user/process.js +71 -71
  57. package/tests/user/task_available.js +75 -75
  58. package/tests/user/user.js +88 -88
package/doc/api.md CHANGED
@@ -37,12 +37,21 @@
37
37
  <dt><a href="#AdminUser">AdminUser</a></dt>
38
38
  <dd><p>Admin Class for user, permission admin</p>
39
39
  </dd>
40
+ <dt><a href="#Dispatch">Dispatch</a></dt>
41
+ <dd><p>Api dispatch manager</p>
42
+ </dd>
40
43
  <dt><a href="#GeoLocation">GeoLocation</a></dt>
41
44
  <dd><p>General Class for user, permission organization</p>
42
45
  </dd>
43
46
  <dt><a href="#Users">Users</a></dt>
44
47
  <dd><p>API request, user permission level</p>
45
48
  </dd>
49
+ <dt><a href="#Login">Login</a></dt>
50
+ <dd><p>Login manager</p>
51
+ </dd>
52
+ <dt><a href="#Session">Session</a></dt>
53
+ <dd><p>Session manager of the API</p>
54
+ </dd>
46
55
  <dt><a href="#Datasource">Datasource</a></dt>
47
56
  <dd><p>Class for user datasource access, to be used with when creating new documents</p>
48
57
  </dd>
@@ -64,12 +73,12 @@
64
73
  <dt><a href="#Register">Register</a></dt>
65
74
  <dd><p>Class for user registration in a user</p>
66
75
  </dd>
67
- <dt><a href="#Task">Task</a></dt>
68
- <dd><p>Class for task, permission user</p>
69
- </dd>
70
76
  <dt><a href="#TaskAvailable">TaskAvailable</a></dt>
71
77
  <dd><p>Class for available tasks, permission user</p>
72
78
  </dd>
79
+ <dt><a href="#Task">Task</a></dt>
80
+ <dd><p>Class for task, permission user</p>
81
+ </dd>
73
82
  <dt><a href="#User">User</a></dt>
74
83
  <dd><p>Class for user, permission user</p>
75
84
  </dd>
@@ -108,33 +117,7 @@ Advanced search of document in elastic search ussing system manager
108
117
 
109
118
  **Example**
110
119
  ```js
111
- const API = require('@docbrasil/api-systemmanager');
112
- const api = new API();
113
- const params = {
114
- docId: '5edd11c46b6ce9729c2c297c',
115
- query: {
116
- "query": {
117
- "bool": {
118
- "minimum_should_match": 1,
119
- "should": [
120
- {
121
- "match": {
122
- "locationText.keyword": {
123
- "query": "sao pau"
124
- }
125
- }
126
- },
127
- {
128
- "wildcard": {
129
- "locationText.normalized": "*sao pau*"
130
- }
131
- }
132
- ]
133
- }
134
- }
135
- }
136
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
137
- await api.admin.document.advancedSearch(params, session);
120
+ const API = require('@docbrasil/api-systemmanager');
138
121
  docId: '5edd11c46b6ce9729c2c297c',
139
122
  query: {
140
123
  "query": {
141
124
  "bool": {
142
125
  "minimum_should_match": 1,
143
126
  "should": [
144
127
  {
145
128
  "match": {
146
129
  "locationText.keyword": {
147
130
  "query": "sao pau"
148
131
  }
149
132
  }
150
133
  },
151
134
  {
152
135
  "wildcard": {
153
136
  "locationText.normalized": "*sao pau*"
154
137
  }
155
138
  }
156
139
  ]
157
140
  }
158
141
  }
159
142
  }
160
143
  ```
161
144
  <a name="AdminDocuments+findById"></a>
162
145
 
@@ -154,14 +137,7 @@ Get document by id
154
137
 
155
138
  **Example**
156
139
  ```js
157
- const API = require('@docbrasil/api-systemmanager');
158
- const api = new API();
159
- const params = {
160
- docId: '5edd11c46b6ce9729c2c297c',
161
- orgId: '55e4a3bd6be6b45210833fae'
162
- };
163
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
164
- await api.admin.document.findById(params, session);
140
+ const API = require('@docbrasil/api-systemmanager');
165
141
  docId: '5edd11c46b6ce9729c2c297c',
166
142
  orgId: '55e4a3bd6be6b45210833fae'
167
143
  ```
168
144
  <a name="AdminDocuments+signedUrl"></a>
169
145
 
@@ -182,25 +158,11 @@ Request signed url url to put or get
182
158
 
183
159
  **Example**
184
160
  ```js
185
- const API = require('@docbrasil/api-systemmanager');
186
- const api = new API();
187
- const params - {
188
- methodType: 'put',
189
- docId: '5dadd01dc4af3941d42f8c5c'
190
- };
191
- const apiKey: '...';
192
- const { docId, name, areaId, type, signedUrl } = await api.admin.document.signedUrl(params, apiKey);
161
+ const API = require('@docbrasil/api-systemmanager');
193
162
  methodType: 'put',
194
163
  docId: '5dadd01dc4af3941d42f8c5c'
195
164
  ```
196
165
  **Example**
197
166
  ```js
198
- const API = require('@docbrasil/api-systemmanager');
199
- const api = new API();
200
- const params - {
201
- methodType: 'get',
202
- docId: '5dadd01dc4af3941d42f8c5c'
203
- };
204
- const apiKey: '...';
205
- const { signedUrl, imageType } = await api.admin.document.signedUrl(params, apiKey);
167
+ const API = require('@docbrasil/api-systemmanager');
206
168
  methodType: 'get',
207
169
  docId: '5dadd01dc4af3941d42f8c5c'
208
170
  ```
209
171
  <a name="AdminDocuments+updateContent"></a>
210
172
 
@@ -221,14 +183,7 @@ Update a document content
221
183
 
222
184
  **Example**
223
185
  ```js
224
- const API = require('@docbrasil/api-systemmanager');
225
- const api = new API();
226
- const params - {
227
- content: 'some text...',
228
- docId: '5dadd01dc4af3941d42f8c5c'
229
- };
230
- const apiKey: '...';
231
- await api.admin.document.updateContent(params, apiKey);
186
+ const API = require('@docbrasil/api-systemmanager');
232
187
  content: 'some text...',
233
188
  docId: '5dadd01dc4af3941d42f8c5c'
234
189
  ```
235
190
  <a name="AdminDocuments+updateAI"></a>
236
191
 
@@ -255,14 +210,7 @@ Update a document content
255
210
 
256
211
  **Example**
257
212
  ```js
258
- const API = require('@docbrasil/api-systemmanager');
259
- const api = new API();
260
- const params - {
261
- content: 'some text...',
262
- docId: '5dadd01dc4af3941d42f8c5c'
263
- };
264
- const apiKey: '...';
265
- await api.admin.document.updateContent(params, apiKey);
213
+ const API = require('@docbrasil/api-systemmanager');
266
214
  content: 'some text...',
267
215
  docId: '5dadd01dc4af3941d42f8c5c'
268
216
  ```
269
217
  <a name="AdminDocuments+getContent"></a>
270
218
 
@@ -283,14 +231,7 @@ Get the content of a document
283
231
 
284
232
  **Example**
285
233
  ```js
286
- const API = require('@docbrasil/api-systemmanager');
287
- const api = new API();
288
- const params - {
289
- page: '0',
290
- docId: '5dadd01dc4af3941d42f8c5c'
291
- };
292
- const apiKey: '...';
293
- await api.admin.document.getContent(params, apiKey);
234
+ const API = require('@docbrasil/api-systemmanager');
294
235
  page: '0',
295
236
  docId: '5dadd01dc4af3941d42f8c5c'
296
237
  ```
297
238
  <a name="AdminForm"></a>
298
239
 
@@ -321,14 +262,7 @@ Get advance form by ID
321
262
 
322
263
  **Example**
323
264
  ```js
324
- const API = require('@docbrasil/api-systemmanager');
325
- const api = new API();
326
- const params = {
327
- id: '55e4a3bd6be6b45210833fae',
328
- orgId: '5edd11c46b6ce9729c2c297c',
329
- };
330
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
331
- await api.admin.form.findById(params, session);
265
+ const API = require('@docbrasil/api-systemmanager');
332
266
  id: '55e4a3bd6be6b45210833fae',
333
267
  orgId: '5edd11c46b6ce9729c2c297c',
334
268
  ```
335
269
  <a name="AdminForm+getFormList"></a>
336
270
 
@@ -352,13 +286,7 @@ Request signed url url to put or get
352
286
 
353
287
  **Example**
354
288
  ```js
355
- const API = require('@docbrasil/api-systemmanager');
356
- const api = new API();
357
- const params - {
358
- orgId: '5dadd01dc4af3941d42f8c5c',
359
- };
360
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
361
- await api.user.form.getFormList(params, session);
289
+ const API = require('@docbrasil/api-systemmanager');
362
290
  orgId: '5dadd01dc4af3941d42f8c5c',
363
291
  ```
364
292
  <a name="Admin"></a>
365
293
 
@@ -405,14 +333,7 @@ Get list by ID
405
333
 
406
334
  **Example**
407
335
  ```js
408
- const API = require('@docbrasil/api-systemmanager');
409
- const api = new API();
410
- const params = {
411
- id: '55e4a3bd6be6b45210833fae',
412
- orgId: '5edd11c46b6ce9729c2c297c',
413
- };
414
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
415
- await api.admin.list.findById(params, session);
336
+ const API = require('@docbrasil/api-systemmanager');
416
337
  id: '55e4a3bd6be6b45210833fae',
417
338
  orgId: '5edd11c46b6ce9729c2c297c',
418
339
  ```
419
340
  <a name="AdminLists+find"></a>
420
341
 
@@ -433,13 +354,7 @@ Get all lists
433
354
 
434
355
  **Example**
435
356
  ```js
436
- const API = require('@docbrasil/api-systemmanager');
437
- const api = new API();
438
- const params = {
439
- orgId: '55e4a3bd6be6b45210833fae'
440
- };
441
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
442
- await api.admin.list.find(params, session);
357
+ const API = require('@docbrasil/api-systemmanager');
443
358
  orgId: '55e4a3bd6be6b45210833fae'
444
359
  ```
445
360
  <a name="AdminMessage"></a>
446
361
 
@@ -517,15 +432,7 @@ Send email, array with email list or send one email
517
432
 
518
433
  **Example**
519
434
  ```js
520
- const API = require('@docbrasil/api-systemmanager');
521
- const api = new API();
522
- const params = {
523
- subject: 'Test email',
524
- message: '<h1>Hi!</h1>',
525
- to: 'destination@gmail.com'
526
- };
527
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
528
- await api.admin.message.sendEmail(params, session);
435
+ const API = require('@docbrasil/api-systemmanager');
529
436
  subject: 'Test email',
530
437
  message: '<h1>Hi!</h1>',
531
438
  to: 'destination@gmail.com'
532
439
  ```
533
440
  <a name="AdminNotification"></a>
534
441
 
@@ -574,15 +481,7 @@ Create notification
574
481
 
575
482
  **Example**
576
483
  ```js
577
- const API = require('@docbrasil/api-systemmanager');
578
- const api = new API();
579
- const params = {
580
- orgId: '5edd11c46b6ce9729c2c297c',
581
- userId: '55e4a3bd6be6b45210833fae',
582
- message: 'Olá como vai tudo bem?'
583
- };
584
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
585
- await api.admin.notifications.add(params, session);
484
+ const API = require('@docbrasil/api-systemmanager');
586
485
  orgId: '5edd11c46b6ce9729c2c297c',
587
486
  userId: '55e4a3bd6be6b45210833fae',
588
487
  message: 'Olá como vai tudo bem?'
589
488
  ```
590
489
  <a name="AdminNotification+findById"></a>
591
490
 
@@ -602,14 +501,7 @@ Search notification using (notificationId or userId)
602
501
 
603
502
  **Example**
604
503
  ```js
605
- const API = require('@docbrasil/api-systemmanager');
606
- const api = new API();
607
- const params = {
608
- orgId: '5edd11c46b6ce9729c2c297c',
609
- id: '55e4a3bd6be6b45210833fae',
610
- };
611
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
612
- await api.admin.notifications.findById(params, session);
504
+ const API = require('@docbrasil/api-systemmanager');
613
505
  orgId: '5edd11c46b6ce9729c2c297c',
614
506
  id: '55e4a3bd6be6b45210833fae',
615
507
  ```
616
508
  <a name="AdminNotification+findByIdAndUpdate"></a>
617
509
 
@@ -630,15 +522,7 @@ Update notification using (notificationId or userId)
630
522
 
631
523
  **Example**
632
524
  ```js
633
- const API = require('@docbrasil/api-systemmanager');
634
- const api = new API();
635
- const params = {
636
- orgId: '5edd11c46b6ce9729c2c297c',
637
- id: '55e4a3bd6be6b45210833fae',
638
- read: true
639
- };
640
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
641
- await api.admin.notifications.findByIdAndUpdate(params, session);
525
+ const API = require('@docbrasil/api-systemmanager');
642
526
  orgId: '5edd11c46b6ce9729c2c297c',
643
527
  id: '55e4a3bd6be6b45210833fae',
644
528
  read: true
645
529
  ```
646
530
  <a name="AdminNotification+findByIdAndRemove"></a>
647
531
 
@@ -658,14 +542,7 @@ Delete notification using (notificationId or userId)
658
542
 
659
543
  **Example**
660
544
  ```js
661
- const API = require('@docbrasil/api-systemmanager');
662
- const api = new API();
663
- const params = {
664
- orgId: '5edd11c46b6ce9729c2c297c',
665
- id: '55e4a3bd6be6b45210833fae',
666
- };
667
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
668
- await api.admin.notifications.findByIdAndDelete(params, session);
545
+ const API = require('@docbrasil/api-systemmanager');
669
546
  orgId: '5edd11c46b6ce9729c2c297c',
670
547
  id: '55e4a3bd6be6b45210833fae',
671
548
  ```
672
549
  <a name="Organization"></a>
673
550
 
@@ -702,15 +579,7 @@ Update avatar of organization by session of user not allow session user SU
702
579
 
703
580
  **Example**
704
581
  ```js
705
- const API = require('@docbrasil/api-systemmanager');
706
- const api = new API();
707
- const params = {
708
- orgId: '5dadd01dc4af3941d42f8c5c',
709
- avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
710
- type: 'image/png',
711
- };
712
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
713
- await api.admin.organizations.upsertAvatar(params, session);
582
+ const API = require('@docbrasil/api-systemmanager');
714
583
  orgId: '5dadd01dc4af3941d42f8c5c',
715
584
  avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
716
585
  type: 'image/png',
717
586
  ```
718
587
  <a name="Organization+removeAvatar"></a>
719
588
 
@@ -728,11 +597,7 @@ Remove avatar of user by session of user not allow session user SU
728
597
 
729
598
  **Example**
730
599
  ```js
731
- const API = require('@docbrasil/api-systemmanager');
732
- const api = new API();
733
- const orgId = '5dadd01dc4af3941d42f8c5c';
734
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
735
- await api.admin.organizations.removeAvatar(orgId, session);
600
+ const API = require('@docbrasil/api-systemmanager');
736
601
  ```
737
602
  <a name="Organization+findById"></a>
738
603
 
@@ -750,11 +615,7 @@ Find organization by id
750
615
 
751
616
  **Example**
752
617
  ```js
753
- const API = require('@docbrasil/api-systemmanager');
754
- const api = new API();
755
- const orgId = '80443245000122';
756
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
757
- await api.user.organization.findById(idCard, session);
618
+ const API = require('@docbrasil/api-systemmanager');
758
619
  ```
759
620
  <a name="Organization+idCardExist"></a>
760
621
 
@@ -772,11 +633,7 @@ Check if id card exist
772
633
 
773
634
  **Example**
774
635
  ```js
775
- const API = require('@docbrasil/api-systemmanager');
776
- const api = new API();
777
- const idCard = '80443245000122';
778
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
779
- await api.user.organization.idCardExist(idCard, session);
636
+ const API = require('@docbrasil/api-systemmanager');
780
637
  ```
781
638
  <a name="Organization+upsertAvatar"></a>
782
639
 
@@ -796,14 +653,7 @@ Update avatar of organization by session of user not allow session user SU
796
653
 
797
654
  **Example**
798
655
  ```js
799
- const API = require('@docbrasil/api-systemmanager');
800
- const api = new API();
801
- const params = {
802
- avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
803
- type: 'image/png',
804
- };
805
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
806
- await api.user.profile.updateAvatar(params, session);
656
+ const API = require('@docbrasil/api-systemmanager');
807
657
  avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
808
658
  type: 'image/png',
809
659
  ```
810
660
  <a name="Organization+removeAvatar"></a>
811
661
 
@@ -820,10 +670,7 @@ Remove avatar of user by session of user not allow session user SU
820
670
 
821
671
  **Example**
822
672
  ```js
823
- const API = require('@docbrasil/api-systemmanager');
824
- const api = new API();
825
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
826
- await api.user.profile.removeAvatar(session);
673
+ const API = require('@docbrasil/api-systemmanager');
827
674
  ```
828
675
  <a name="Organization+callFetch"></a>
829
676
 
@@ -843,14 +690,7 @@ Call URL internal, need auth JWT (session)
843
690
 
844
691
  **Example**
845
692
  ```js
846
- const API = require('@docbrasil/api-systemmanager');
847
- const api = new API();
848
-
849
- const params = {
850
- url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
851
- method: 'POST'
852
- }
853
- await api.user.organization.callFetchs(params, session);
693
+ const API = require('@docbrasil/api-systemmanager');
854
694
  url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
855
695
  method: 'POST'
856
696
  ```
857
697
  <a name="AdminPlugin"></a>
858
698
 
@@ -880,11 +720,7 @@ Find plugins
880
720
 
881
721
  **Example**
882
722
  ```js
883
- const API = require('@docbrasil/api-systemmanager');
884
- const api = new API();
885
- const params = {page: 1, perPage: 200};
886
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
887
- await api.user.organization.findById(params, session);
723
+ const API = require('@docbrasil/api-systemmanager');
888
724
  ```
889
725
  <a name="AdminPlugin+findById"></a>
890
726
 
@@ -902,11 +738,7 @@ Get plugin by ID
902
738
 
903
739
  **Example**
904
740
  ```js
905
- const API = require('@docbrasil/api-systemmanager');
906
- const api = new API();
907
- const id ='55e4a3bd6be6b45210833fae',
908
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
909
- await api.admin.plugin.findById(id, session);
741
+ const API = require('@docbrasil/api-systemmanager');
910
742
  ```
911
743
  <a name="AdminPolicy"></a>
912
744
 
@@ -929,10 +761,7 @@ Find all policies
929
761
 
930
762
  **Example**
931
763
  ```js
932
- const API = require('@docbrasil/api-systemmanager');
933
- const api = new API();
934
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
935
- await api.admin.policy.find(session);
764
+ const API = require('@docbrasil/api-systemmanager');
936
765
  ```
937
766
  <a name="AdminProcesses"></a>
938
767
 
@@ -956,16 +785,7 @@ Advanced search of processes, check documentation, to verify all params, pass to
956
785
  **Author**: CloudBrasil <abernardo.br@gmail.com>
957
786
  **Example**
958
787
  ```js
959
- const API = require('@docbrasil/api-systemmanager');
960
- const api = new API();
961
- const params = {
962
- orgId: '5edd11c46b6ce9729c2c297c',
963
- ...
964
- ...
965
- ...
966
- };
967
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
968
- await api.admin.processes.search(params, session);
788
+ const API = require('@docbrasil/api-systemmanager');
969
789
  orgId: '5edd11c46b6ce9729c2c297c',
970
790
  ...
971
791
  ...
972
792
  ...
973
793
  ```
974
794
  <a name="AdminProcesses+advancedSearch"></a>
975
795
 
@@ -985,23 +805,7 @@ Advanced search of process in elastic search ussing system manager
985
805
 
986
806
  **Example**
987
807
  ```js
988
- const API = require('@docbrasil/api-systemmanager');
989
- const api = new API();
990
- const params = {
991
- orgProcessId: '5edd11c46b6ce9729c2c297c',
992
- query: {
993
- "_source": "processData.properties.processProperties",
994
- "query": {
995
- "term": {
996
- "initParams.email.keyword": {
997
- "value": "clintes001@gmail.com"
998
- }
999
- }
1000
- }
1001
- }
1002
- }
1003
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1004
- await api.admin.processes.advancedSearch(params, session);
808
+ const API = require('@docbrasil/api-systemmanager');
1005
809
  orgProcessId: '5edd11c46b6ce9729c2c297c',
1006
810
  query: {
1007
811
  "_source": "processData.properties.processProperties",
1008
812
  "query": {
1009
813
  "term": {
1010
814
  "initParams.email.keyword": {
1011
815
  "value": "clintes001@gmail.com"
1012
816
  }
1013
817
  }
1014
818
  }
1015
819
  }
1016
820
  ```
1017
821
  <a name="AdminTask"></a>
1018
822
 
@@ -1032,13 +836,7 @@ Get task by user Id
1032
836
 
1033
837
  **Example**
1034
838
  ```js
1035
- const API = require('@docbrasil/api-systemmanager');
1036
- const api = new API();
1037
- const params = {
1038
- userId: '55e4a3bd6be6b45210833fae',
1039
- };
1040
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1041
- await api.admin.task.find(params, session);
839
+ const API = require('@docbrasil/api-systemmanager');
1042
840
  userId: '55e4a3bd6be6b45210833fae',
1043
841
  ```
1044
842
  <a name="AdminUser"></a>
1045
843
 
@@ -1069,11 +867,7 @@ Request profile by userId
1069
867
 
1070
868
  **Example**
1071
869
  ```js
1072
- const API = require('@docbrasil/api-systemmanager');
1073
- const api = new API();
1074
- const userId = '55e4a3bd6be6b45210833fae';
1075
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1076
- await api.admin.user.findById(userId, session);
870
+ const API = require('@docbrasil/api-systemmanager');
1077
871
  ```
1078
872
  <a name="AdminUser+findByIdAndUpdatePassword"></a>
1079
873
 
@@ -1094,15 +888,7 @@ Update password by userId
1094
888
 
1095
889
  **Example**
1096
890
  ```js
1097
- const API = require('@docbrasil/api-systemmanager');
1098
- const api = new API();
1099
- const params = {
1100
- userId: '55e4a3bd6be6b45210833fae',
1101
- oldPassword: '123456',
1102
- newPassword: '123456789'
1103
- };
1104
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1105
- await api.admin.user.findByIdAndUpdatePassword(params, session);
891
+ const API = require('@docbrasil/api-systemmanager');
1106
892
  userId: '55e4a3bd6be6b45210833fae',
1107
893
  oldPassword: '123456',
1108
894
  newPassword: '123456789'
1109
895
  ```
1110
896
  <a name="AdminUser+emailExist"></a>
1111
897
 
@@ -1120,11 +906,7 @@ Check if email is unique
1120
906
 
1121
907
  **Example**
1122
908
  ```js
1123
- const API = require('@docbrasil/api-systemmanager');
1124
- const api = new API();
1125
- const email = 'ana.silva@gmail.com';
1126
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1127
- await api.admin.user.emailExist(email, session);
909
+ const API = require('@docbrasil/api-systemmanager');
1128
910
  ```
1129
911
  <a name="AdminUser+findByIdAndUpdate"></a>
1130
912
 
@@ -1142,12 +924,49 @@ update userData by userSMId
1142
924
 
1143
925
  **Example**
1144
926
  ```js
1145
- const userId = '55e4a3bd6be6b45210833fae';
1146
- const payload = {
1147
- name: 'Maria joaquina',
1148
- email: 'maria@gmail.com'
1149
- };
1150
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
927
+ const userId = '55e4a3bd6be6b45210833fae';
1151
928
  name: 'Maria joaquina',
1152
929
  email: 'maria@gmail.com'
930
+ ```
931
+ <a name="Dispatch"></a>
932
+
933
+ ## Dispatch
934
+ Api dispatch manager
935
+
936
+ **Kind**: global class
937
+
938
+ * [Dispatch](#Dispatch)
939
+ * [.getContext(url, session)](#Dispatch+getContext) ⇒ <code>Promise.&lt;object&gt;</code>
940
+ * [.getClient()](#Dispatch+getClient) ⇒ <code>promise</code>
941
+
942
+ <a name="Dispatch+getContext"></a>
943
+
944
+ ### dispatch.getContext(url, session) ⇒ <code>Promise.&lt;object&gt;</code>
945
+ Get the URL context
946
+
947
+ **Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
948
+ **Returns**: <code>Promise.&lt;object&gt;</code> - The full data context of the URL
949
+ **Access**: public
950
+
951
+ | Param | Type | Default | Description |
952
+ | --- | --- | --- | --- |
953
+ | url | <code>string</code> | | Full url |
954
+ | session | <code>session</code> | <code></code> | Session, token JWT |
955
+
956
+ **Example**
957
+ ```js
958
+ const API = require('@docbrasil/api-systemmanager');
959
+ ```
960
+ <a name="Dispatch+getClient"></a>
961
+
962
+ ### dispatch.getClient() ⇒ <code>promise</code>
963
+ Get client Axios
964
+
965
+ **Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
966
+ **Returns**: <code>promise</code> - return client axios
967
+ **Access**: public
968
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
969
+ **Example**
970
+ ```js
971
+ const API = require('@docbrasil/api-systemmanager');
1153
972
  ```
1154
973
  <a name="GeoLocation"></a>
1155
974
 
@@ -1172,13 +991,7 @@ Get geo location of the address
1172
991
 
1173
992
  **Example**
1174
993
  ```js
1175
- const API = require('@docbrasil/api-systemmanager');
1176
- const api = new API();
1177
- const params = {
1178
- address: 'Rua Sud Menucci, 615 - Vila Camilopolis, Santo André - SP',
1179
- apiKey: 'AIzaSyC7gJFOkuT-Mel3WZbX5uKuJ1USqLVkGnY',
1180
- };
1181
- await api.general.geo.location(params);
994
+ const API = require('@docbrasil/api-systemmanager');
1182
995
  address: 'Rua Sud Menucci, 615 - Vila Camilopolis, Santo André - SP',
1183
996
  apiKey: 'AIzaSyC7gJFOkuT-Mel3WZbX5uKuJ1USqLVkGnY',
1184
997
  ```
1185
998
  <a name="Users"></a>
1186
999
 
@@ -1210,6 +1023,161 @@ API request, user permission level
1210
1023
  | options | <code>object</code> | Params of the constructor |
1211
1024
  | options.parent | <code>object</code> | This of the pararent |
1212
1025
 
1026
+ <a name="Login"></a>
1027
+
1028
+ ## Login
1029
+ Login manager
1030
+
1031
+ **Kind**: global class
1032
+
1033
+ * [Login](#Login)
1034
+ * [.facebook(params)](#Login+facebook) ⇒ <code>promise.&lt;object&gt;</code> \| <code>object</code> \| <code>object</code>
1035
+ * [.google(params)](#Login+google) ⇒ <code>promise.&lt;object&gt;</code> \| <code>object</code> \| <code>object</code>
1036
+ * [.apiKey(apikey)](#Login+apiKey) ⇒ <code>promise.&lt;object&gt;</code> \| <code>object</code> \| <code>object</code>
1037
+ * [.userPass(params)](#Login+userPass) ⇒ <code>promise.&lt;object&gt;</code> \| <code>object</code> \| <code>object</code>
1038
+ * [.logout(session)](#Login+logout) ⇒ <code>promise.&lt;object&gt;</code> \| <code>boolean</code>
1039
+ * [.recover(username)](#Login+recover) ⇒ <code>promise.&lt;object&gt;</code> \| <code>boolean</code>
1040
+
1041
+ <a name="Login+facebook"></a>
1042
+
1043
+ ### login.facebook(params) ⇒ <code>promise.&lt;object&gt;</code> \| <code>object</code> \| <code>object</code>
1044
+ Login with social login Facebook
1045
+
1046
+ **Kind**: instance method of [<code>Login</code>](#Login)
1047
+ **Returns**: <code>promise.&lt;object&gt;</code> - data<code>object</code> - data.auth true or false if we have the user authenticaited correctly<code>object</code> - data.user the logged user
1048
+ **Access**: public
1049
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
1050
+
1051
+ | Param | Type | Description |
1052
+ | --- | --- | --- |
1053
+ | params | <code>object</code> | Params to login Facebook |
1054
+ | params.accessToken | <code>string</code> | Access token of the system manager |
1055
+ | params.initialUserData | <code>object</code> | Object with roles default if sigin |
1056
+ | params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
1057
+
1058
+ **Example**
1059
+ ```js
1060
+ const API = require('@docbrasil/api-systemmanager');
1061
+ ```
1062
+ <a name="Login+google"></a>
1063
+
1064
+ ### login.google(params) ⇒ <code>promise.&lt;object&gt;</code> \| <code>object</code> \| <code>object</code>
1065
+ Login with social login Google
1066
+
1067
+ **Kind**: instance method of [<code>Login</code>](#Login)
1068
+ **Returns**: <code>promise.&lt;object&gt;</code> - data<code>object</code> - data.auth true or false if we have the user authenticaited correctly<code>object</code> - data.user the logged user
1069
+ **Access**: public
1070
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
1071
+
1072
+ | Param | Type | Description |
1073
+ | --- | --- | --- |
1074
+ | params | <code>object</code> | Params to login Google |
1075
+ | params.accessToken | <code>string</code> | Access token of the system manager |
1076
+ | params.initialUserData | <code>object</code> | Object with roles default if sigin |
1077
+ | params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
1078
+
1079
+ **Example**
1080
+ ```js
1081
+ const API = require('@docbrasil/api-systemmanager');
1082
+ ```
1083
+ <a name="Login+apiKey"></a>
1084
+
1085
+ ### login.apiKey(apikey) ⇒ <code>promise.&lt;object&gt;</code> \| <code>object</code> \| <code>object</code>
1086
+ Login with apikey
1087
+
1088
+ **Kind**: instance method of [<code>Login</code>](#Login)
1089
+ **Returns**: <code>promise.&lt;object&gt;</code> - data<code>object</code> - data.auth true or false if we have the user authenticaited correctly<code>object</code> - data.user the logged user
1090
+ **Access**: public
1091
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
1092
+
1093
+ | Param | Type | Description |
1094
+ | --- | --- | --- |
1095
+ | apikey | <code>string</code> | Access key |
1096
+
1097
+ **Example**
1098
+ ```js
1099
+ const API = require('@docbrasil/api-systemmanager');
1100
+ ```
1101
+ <a name="Login+userPass"></a>
1102
+
1103
+ ### login.userPass(params) ⇒ <code>promise.&lt;object&gt;</code> \| <code>object</code> \| <code>object</code>
1104
+ Login with user and password
1105
+
1106
+ **Kind**: instance method of [<code>Login</code>](#Login)
1107
+ **Returns**: <code>promise.&lt;object&gt;</code> - data<code>object</code> - data.auth true or false if we have the user authenticaited correctly<code>object</code> - data.user the logged user
1108
+ **Access**: public
1109
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
1110
+
1111
+ | Param | Type | Description |
1112
+ | --- | --- | --- |
1113
+ | params | <code>object</code> | Object with user and password |
1114
+ | params.username | <code>string</code> | Username or email of the user |
1115
+ | params.password | <code>string</code> | Password of the user |
1116
+ | params.orgname | <code>string</code> | The organame of the user |
1117
+
1118
+ **Example**
1119
+ ```js
1120
+ const API = require('@docbrasil/api-systemmanager');
1213
1121
  username: 'ana.silva@gmail.com',
1214
1122
  password: '123456'
1123
+ ```
1124
+ <a name="Login+logout"></a>
1125
+
1126
+ ### login.logout(session) ⇒ <code>promise.&lt;object&gt;</code> \| <code>boolean</code>
1127
+ Logout user system manager
1128
+
1129
+ **Kind**: instance method of [<code>Login</code>](#Login)
1130
+ **Returns**: <code>promise.&lt;object&gt;</code> - } data<code>boolean</code> - data.success true|false
1131
+ **Access**: public
1132
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
1133
+
1134
+ | Param | Type | Description |
1135
+ | --- | --- | --- |
1136
+ | session | <code>string</code> | Session, token JWT |
1137
+
1138
+ **Example**
1139
+ ```js
1140
+ const API = require('@docbrasil/api-systemmanager');
1141
+ ```
1142
+ <a name="Login+recover"></a>
1143
+
1144
+ ### login.recover(username) ⇒ <code>promise.&lt;object&gt;</code> \| <code>boolean</code>
1145
+ Recover the password
1146
+
1147
+ **Kind**: instance method of [<code>Login</code>](#Login)
1148
+ **Returns**: <code>promise.&lt;object&gt;</code> - } data<code>boolean</code> - data.success true|false
1149
+ **Access**: public
1150
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
1151
+
1152
+ | Param | Type | Description |
1153
+ | --- | --- | --- |
1154
+ | username | <code>string</code> | The username or email |
1155
+
1156
+ **Example**
1157
+ ```js
1158
+ const API = require('@docbrasil/api-systemmanager');
1159
+ ```
1160
+ <a name="Session"></a>
1161
+
1162
+ ## Session
1163
+ Session manager of the API
1164
+
1165
+ **Kind**: global class
1166
+ <a name="Session+information"></a>
1167
+
1168
+ ### session.information(sessionId, suSessionId) ⇒ <code>Promise</code>
1169
+ Show information for session, thus validating the session (Valid token JWT)
1170
+
1171
+ **Kind**: instance method of [<code>Session</code>](#Session)
1172
+ **Access**: public
1173
+
1174
+ | Param | Type | Default | Description |
1175
+ | --- | --- | --- | --- |
1176
+ | sessionId | <code>string</code> | | The user session (JWT Token) |
1177
+ | suSessionId | <code>string</code> | <code>&quot;sessionId&quot;</code> | Given a JWT Token of a SU (SuperAdmin), allow to check session for another user. |
1178
+
1179
+ **Example**
1180
+ ```js
1181
+ const API = require('@docbrasil/api-systemmanager');
1182
+ ```
1215
1183
  <a name="Datasource"></a>
1216
1184
 
1217
1185
  ## Datasource
@@ -1239,15 +1207,7 @@ Method to get autocomplete data from a datasource
1239
1207
 
1240
1208
  **Example**
1241
1209
  ```js
1242
- const API = require('@docbrasil/api-systemmanager');
1243
- const api = new API();
1244
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1245
- const params = {
1246
- orgId: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
1247
- dataSources: [{}],
1248
- documents: [{}]
1249
- };
1250
- const retData = await api.user.datasource.autocomplete(params, session);
1210
+ const API = require('@docbrasil/api-systemmanager');
1251
1211
  orgId: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
1252
1212
  dataSources: [{}],
1253
1213
  documents: [{}]
1254
1214
  ```
1255
1215
  <a name="Documents"></a>
1256
1216
 
@@ -1307,23 +1267,7 @@ Create new document
1307
1267
 
1308
1268
  **Example**
1309
1269
  ```js
1310
- const API = require('@docbrasil/api-systemmanager');
1311
- const api = new API();
1312
- const params = {
1313
- orgname: 'cloundbrasil',
1314
- areaId: '5edf9f8ee896b817e45b8dac',
1315
- docId: '5edf86fbe896b817e45b8da6',
1316
- fileName: 'foto',
1317
- type: 'image/png',
1318
- name: 'Fotografia',
1319
- docTypeId = '5edf9f8ee896b817e45b8dac',
1320
- bytes: 12345,
1321
- signedUrl: 'https://s3.amazonaws.com...'
1322
- docTypeFieldsData: {extraUser: '12349f8ee896b817e45b8dac'},
1323
- orgId: '5df7f19618430c89a41a19d2',
1324
- };
1325
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1326
- await api.user.document.add(params, session);
1270
+ const API = require('@docbrasil/api-systemmanager');
1327
1271
  orgname: 'cloundbrasil',
1328
1272
  areaId: '5edf9f8ee896b817e45b8dac',
1329
1273
  docId: '5edf86fbe896b817e45b8da6',
1330
1274
  fileName: 'foto',
1331
1275
  type: 'image/png',
1332
1276
  name: 'Fotografia',
1333
1277
  docTypeId = '5edf9f8ee896b817e45b8dac',
1334
1278
  bytes: 12345,
1335
1279
  signedUrl: 'https://s3.amazonaws.com...'
1336
1280
  docTypeFieldsData: {extraUser: '12349f8ee896b817e45b8dac'},
1337
1281
  orgId: '5df7f19618430c89a41a19d2',
1338
1282
  ```
1339
1283
  <a name="Documents+find"></a>
1340
1284
 
@@ -1351,18 +1295,7 @@ await api.user.document.add(params, session);
1351
1295
 
1352
1296
  **Example**
1353
1297
  ```js
1354
- const API = require('@docbrasil/api-systemmanager');
1355
- const api = new API();
1356
- const params - {
1357
- index: 'extraCity',
1358
- txtToSearch: 'São',
1359
- docId: '5df7f19618430c89a41a19d2',
1360
- docAreaId: '5edd11c46b6ce9729c2c297c',
1361
- tag: 'Nome da cidade',
1362
- orgId: '1234d01dc4af3941d42f8c5c'
1363
- };
1364
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1365
- await api.user.document.findByIdAndRemove(params, session);
1298
+ const API = require('@docbrasil/api-systemmanager');
1366
1299
  index: 'extraCity',
1367
1300
  txtToSearch: 'São',
1368
1301
  docId: '5df7f19618430c89a41a19d2',
1369
1302
  docAreaId: '5edd11c46b6ce9729c2c297c',
1370
1303
  tag: 'Nome da cidade',
1371
1304
  orgId: '1234d01dc4af3941d42f8c5c'
1372
1305
  ```
1373
1306
  <a name="Documents+findByIdAndRemove"></a>
1374
1307
 
@@ -1383,14 +1316,7 @@ Remove document by id
1383
1316
 
1384
1317
  **Example**
1385
1318
  ```js
1386
- const API = require('@docbrasil/api-systemmanager');
1387
- const api = new API();
1388
- const params - {
1389
- docId: '5dadd01dc4af3941d42f8c5c',
1390
- orgIdId: '5df7f19618430c89a41a19d2',
1391
- };
1392
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1393
- await api.user.document.findByIdAndRemove(params, session);
1319
+ const API = require('@docbrasil/api-systemmanager');
1394
1320
  docId: '5dadd01dc4af3941d42f8c5c',
1395
1321
  orgIdId: '5df7f19618430c89a41a19d2',
1396
1322
  ```
1397
1323
  <a name="Documents+findByIdsAndRemove"></a>
1398
1324
 
@@ -1412,14 +1338,7 @@ Remove documents
1412
1338
 
1413
1339
  **Example**
1414
1340
  ```js
1415
- const API = require('@docbrasil/api-systemmanager');
1416
- const api = new API();
1417
- const params - {
1418
- documents: [{ _id: '5dadd01dc4af3941d42f8c5c' }],
1419
- orgId: '5df7f19618430c89a41a19d2',
1420
- };
1421
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1422
- await api.user.document.findByIdsAndRemove(params, session);
1341
+ const API = require('@docbrasil/api-systemmanager');
1423
1342
  documents: [{ _id: '5dadd01dc4af3941d42f8c5c' }],
1424
1343
  orgId: '5df7f19618430c89a41a19d2',
1425
1344
  ```
1426
1345
  <a name="Documents+signedUrl"></a>
1427
1346
 
@@ -1445,30 +1364,11 @@ Request signed url url to put or get
1445
1364
 
1446
1365
  **Example**
1447
1366
  ```js
1448
- const API = require('@docbrasil/api-systemmanager');
1449
- const api = new API();
1450
- const params - {
1451
- methodType: 'put',
1452
- docId: '5dadd01dc4af3941d42f8c5c',
1453
- docAreaId: '5df7f19618430c89a41a19d2',
1454
- fileName: 'Foto',
1455
- type: 'image/png'
1456
- orgId: '5df7f19618430c89a41a19f8'
1457
- };
1458
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1459
- // each doc: { docId, name, areaId, type, signedUrl }
1460
- const { docs } = await api.user.document.signedUrl(params, session);
1367
+ const API = require('@docbrasil/api-systemmanager');
1461
1368
  methodType: 'put',
1462
1369
  docId: '5dadd01dc4af3941d42f8c5c',
1463
1370
  docAreaId: '5df7f19618430c89a41a19d2',
1464
1371
  fileName: 'Foto',
1465
1372
  type: 'image/png'
1466
1373
  orgId: '5df7f19618430c89a41a19f8'
1467
1374
  ```
1468
1375
  **Example**
1469
1376
  ```js
1470
- const API = require('@docbrasil/api-systemmanager');
1471
- const api = new API();
1472
- const params - {
1473
- methodType: 'get',
1474
- document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf',
1475
- };
1476
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1477
- const base64Data = await api.user.document.signedUrl(params, session);
1377
+ const API = require('@docbrasil/api-systemmanager');
1478
1378
  methodType: 'get',
1479
1379
  document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf',
1480
1380
  ```
1481
1381
  <a name="Documents+signedUrls"></a>
1482
1382
 
@@ -1495,36 +1395,11 @@ Request signed url url to put or get
1495
1395
 
1496
1396
  **Example**
1497
1397
  ```js
1498
- const API = require('@docbrasil/api-systemmanager');
1499
- const api = new API();
1500
- const params - {
1501
- methodType: 'put',
1502
- orgId: '5df7f19618430c89a41a19f8'
1503
- docs: [
1504
- {
1505
- docId: '5dadd01dc4af3941d42f8c5c',
1506
- areaId: '5df7f19618430c89a41a19d2',
1507
- name: 'Foto.png',
1508
- type: 'image/png'
1509
- }
1510
- ]
1511
- };
1512
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1513
- // each doc: { docId, name, areaId, type, signedUrl }
1514
- const { docs } = await api.user.document.signedUrls(params, session);
1515
- ```
1516
- **Example**
1517
- ```js
1518
- const API = require('@docbrasil/api-systemmanager');
1519
- const api = new API();
1520
- const params - {
1521
- methodType: 'get',
1522
- docs: [
1523
- { document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf' }
1524
- ],
1525
- };
1526
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1527
- const base64Data = await api.user.document.signedUrls(params, session);
1398
+ const API = require('@docbrasil/api-systemmanager');
1528
1399
  methodType: 'put',
1529
1400
  orgId: '5df7f19618430c89a41a19f8'
1530
1401
  docs: [
1531
1402
  {
1532
1403
  docId: '5dadd01dc4af3941d42f8c5c',
1533
1404
  areaId: '5df7f19618430c89a41a19d2',
1534
1405
  name: 'Foto.png',
1535
1406
  type: 'image/png'
1536
1407
  }
1537
1408
  ]
1409
+ ```
1410
+ **Example**
1411
+ ```js
1412
+ const API = require('@docbrasil/api-systemmanager');
1538
1413
  methodType: 'get',
1539
1414
  docs: [
1540
1415
  { document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf' }
1541
1416
  ],
1542
1417
  ```
1543
1418
  <a name="Documents+uploadSignedDocument"></a>
1544
1419
 
@@ -1545,21 +1420,7 @@ Uploads the file
1545
1420
 
1546
1421
  **Example**
1547
1422
  ```js
1548
- const FS = require('fs');
1549
- const Path = require('path');
1550
- const API = require('@docbrasil/api-systemmanager');
1551
- const api = new API();
1552
- const params - {
1553
- content: FS.readFileSync(Path.join(__dirname, '.mypdf.pdf')),
1554
- signedUrl: 'https://signedurl.com/token...',
1555
- type: 'application/pdf'
1556
- };
1557
- const retData = await api.user.document.uploadSignedDocument(params);
1558
-
1559
- onUploadProgress return the progressEvent
1560
- - lengthComputable: A Boolean that indicates whether or not the total number of bytes is known.
1561
- - loaded: The number of bytes of the file that have been uploaded.
1562
- - total: The total number of bytes in the file.
1423
+ const FS = require('fs');
1563
1424
  content: FS.readFileSync(Path.join(__dirname, '.mypdf.pdf')),
1564
1425
  signedUrl: 'https://signedurl.com/token...',
1565
1426
  type: 'application/pdf'
1566
1427
  - lengthComputable: A Boolean that indicates whether or not the total number of bytes is known.
1567
1428
  - loaded: The number of bytes of the file that have been uploaded.
1568
1429
  - total: The total number of bytes in the file.
1569
1430
  ```
1570
1431
  <a name="Documents+checkPrimaryKeys"></a>
1571
1432
 
@@ -1567,8 +1428,7 @@ onUploadProgress return the progressEvent
1567
1428
  **Kind**: instance method of [<code>Documents</code>](#Documents)
1568
1429
  **Returns**: <code>Promise.&lt;array&gt;</code> - Return the array of the documents that are repeated. If not document is repeaded, then if returns an empty array.<code>array.&lt;string&gt;</code> - id the id of the repeated document
1569
1430
  **Access**: public
1570
- **Author**: CloudBrasil <abernardo.br@gmail.com>
1571
- Checks if a document can be added and it does not repeat its primary key
1431
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
1572
1432
 
1573
1433
  | Param | Type | Description |
1574
1434
  | --- | --- | --- |
@@ -1583,17 +1443,7 @@ Checks if a document can be added and it does not repeat its primary key
1583
1443
 
1584
1444
  **Example**
1585
1445
  ```js
1586
- const API = require('@docbrasil/api-systemmanager');
1587
- const api = new API();
1588
- const docTypeFields = [...]; // the doc type fields array
1589
- const docTypeFieldsData = {...}; // the data of this fields
1590
- const params - {
1591
- docs: [{ id: '5dadd01dc4af3941d42f8c5c', docTypeFields, docTypeFieldsData }],
1592
- orgId: '5df7f19618430c89a41a19d2',
1593
- docTypeId: '5df7f19618430c89a41a19d5',
1594
- };
1595
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1596
- const retDocs = await api.user.document.checkPrimaryKeys(params, session);
1446
+ const API = require('@docbrasil/api-systemmanager');
1597
1447
  docs: [{ id: '5dadd01dc4af3941d42f8c5c', docTypeFields, docTypeFieldsData }],
1598
1448
  orgId: '5df7f19618430c89a41a19d2',
1599
1449
  docTypeId: '5df7f19618430c89a41a19d5',
1600
1450
  ```
1601
1451
  <a name="Documents+searchDocuments"></a>
1602
1452
 
@@ -1614,14 +1464,7 @@ Method to search documents for
1614
1464
 
1615
1465
  **Example**
1616
1466
  ```js
1617
- const API = require('@docbrasil/api-systemmanager');
1618
- const api = new API();
1619
- const params = {
1620
- query: {p: 20, i: 1, s: 'Mais recentes', as: '', m: 'w', ai: '57e6a3bd6be6b45210833fae'},
1621
- orgId: '55e4a3bd6be6b45210833fae',
1622
- };
1623
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1624
- const retSearch = await api.user.document.searchDocuments(params, session);
1467
+ const API = require('@docbrasil/api-systemmanager');
1625
1468
  query: {p: 20, i: 1, s: 'Mais recentes', as: '', m: 'w', ai: '57e6a3bd6be6b45210833fae'},
1626
1469
  orgId: '55e4a3bd6be6b45210833fae',
1627
1470
  ```
1628
1471
  <a name="Users"></a>
1629
1472
 
@@ -1689,14 +1532,7 @@ Method to add a notification token
1689
1532
 
1690
1533
  **Example**
1691
1534
  ```js
1692
- const API = require('@docbrasil/api-systemmanager');
1693
- const api = new API();
1694
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1695
- const params = {
1696
- token: 'V6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz2',
1697
- type: 'FCM_WEB'
1698
- };
1699
- const retData = await api.user.notification.addToken(params, session);
1535
+ const API = require('@docbrasil/api-systemmanager');
1700
1536
  token: 'V6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz2',
1701
1537
  type: 'FCM_WEB'
1702
1538
  ```
1703
1539
  <a name="Organization"></a>
1704
1540
 
@@ -1733,15 +1569,7 @@ Update avatar of organization by session of user not allow session user SU
1733
1569
 
1734
1570
  **Example**
1735
1571
  ```js
1736
- const API = require('@docbrasil/api-systemmanager');
1737
- const api = new API();
1738
- const params = {
1739
- orgId: '5dadd01dc4af3941d42f8c5c',
1740
- avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
1741
- type: 'image/png',
1742
- };
1743
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1744
- await api.admin.organizations.upsertAvatar(params, session);
1572
+ const API = require('@docbrasil/api-systemmanager');
1745
1573
  orgId: '5dadd01dc4af3941d42f8c5c',
1746
1574
  avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
1747
1575
  type: 'image/png',
1748
1576
  ```
1749
1577
  <a name="Organization+removeAvatar"></a>
1750
1578
 
@@ -1759,11 +1587,7 @@ Remove avatar of user by session of user not allow session user SU
1759
1587
 
1760
1588
  **Example**
1761
1589
  ```js
1762
- const API = require('@docbrasil/api-systemmanager');
1763
- const api = new API();
1764
- const orgId = '5dadd01dc4af3941d42f8c5c';
1765
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1766
- await api.admin.organizations.removeAvatar(orgId, session);
1590
+ const API = require('@docbrasil/api-systemmanager');
1767
1591
  ```
1768
1592
  <a name="Organization+findById"></a>
1769
1593
 
@@ -1781,11 +1605,7 @@ Find organization by id
1781
1605
 
1782
1606
  **Example**
1783
1607
  ```js
1784
- const API = require('@docbrasil/api-systemmanager');
1785
- const api = new API();
1786
- const orgId = '80443245000122';
1787
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1788
- await api.user.organization.findById(idCard, session);
1608
+ const API = require('@docbrasil/api-systemmanager');
1789
1609
  ```
1790
1610
  <a name="Organization+idCardExist"></a>
1791
1611
 
@@ -1803,11 +1623,7 @@ Check if id card exist
1803
1623
 
1804
1624
  **Example**
1805
1625
  ```js
1806
- const API = require('@docbrasil/api-systemmanager');
1807
- const api = new API();
1808
- const idCard = '80443245000122';
1809
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1810
- await api.user.organization.idCardExist(idCard, session);
1626
+ const API = require('@docbrasil/api-systemmanager');
1811
1627
  ```
1812
1628
  <a name="Organization+upsertAvatar"></a>
1813
1629
 
@@ -1827,14 +1643,7 @@ Update avatar of organization by session of user not allow session user SU
1827
1643
 
1828
1644
  **Example**
1829
1645
  ```js
1830
- const API = require('@docbrasil/api-systemmanager');
1831
- const api = new API();
1832
- const params = {
1833
- avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
1834
- type: 'image/png',
1835
- };
1836
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1837
- await api.user.profile.updateAvatar(params, session);
1646
+ const API = require('@docbrasil/api-systemmanager');
1838
1647
  avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
1839
1648
  type: 'image/png',
1840
1649
  ```
1841
1650
  <a name="Organization+removeAvatar"></a>
1842
1651
 
@@ -1851,10 +1660,7 @@ Remove avatar of user by session of user not allow session user SU
1851
1660
 
1852
1661
  **Example**
1853
1662
  ```js
1854
- const API = require('@docbrasil/api-systemmanager');
1855
- const api = new API();
1856
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1857
- await api.user.profile.removeAvatar(session);
1663
+ const API = require('@docbrasil/api-systemmanager');
1858
1664
  ```
1859
1665
  <a name="Organization+callFetch"></a>
1860
1666
 
@@ -1874,14 +1680,7 @@ Call URL internal, need auth JWT (session)
1874
1680
 
1875
1681
  **Example**
1876
1682
  ```js
1877
- const API = require('@docbrasil/api-systemmanager');
1878
- const api = new API();
1879
-
1880
- const params = {
1881
- url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
1882
- method: 'POST'
1883
- }
1884
- await api.user.organization.callFetchs(params, session);
1683
+ const API = require('@docbrasil/api-systemmanager');
1885
1684
  url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
1886
1685
  method: 'POST'
1887
1686
  ```
1888
1687
  <a name="Process"></a>
1889
1688
 
@@ -1914,15 +1713,7 @@ Start process
1914
1713
 
1915
1714
  **Example**
1916
1715
  ```js
1917
- const API = require('@docbrasil/api-systemmanager');
1918
- const api = new API();
1919
- const params = {
1920
- processId: '5dadd01dc4af3941d42f8c5c',
1921
- orgId: '5edd11c46b6ce9729c2c297c',
1922
- payload: {}
1923
- }
1924
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1925
- await api.user.process.start(params, session);
1716
+ const API = require('@docbrasil/api-systemmanager');
1926
1717
  processId: '5dadd01dc4af3941d42f8c5c',
1927
1718
  orgId: '5edd11c46b6ce9729c2c297c',
1928
1719
  payload: {}
1929
1720
  ```
1930
1721
  <a name="Process+getProcessProperties"></a>
1931
1722
 
@@ -1942,14 +1733,7 @@ Get process properties of process
1942
1733
 
1943
1734
  **Example**
1944
1735
  ```js
1945
- const API = require('@docbrasil/api-systemmanager');
1946
- const api = new API();
1947
- const params = {
1948
- processId: '5dadd01dc4af3941d42f8c5c',
1949
- orgId: '5edd11c46b6ce9729c2c297c',
1950
- }
1951
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1952
- await api.user.process.getProcessProperties(params, session);
1736
+ const API = require('@docbrasil/api-systemmanager');
1953
1737
  processId: '5dadd01dc4af3941d42f8c5c',
1954
1738
  orgId: '5edd11c46b6ce9729c2c297c',
1955
1739
  ```
1956
1740
  <a name="Process+getOrgProcessSearchInfo"></a>
1957
1741
 
@@ -1957,8 +1741,7 @@ await api.user.process.getProcessProperties(params, session);
1957
1741
  Get the search info of a organization process
1958
1742
 
1959
1743
  **Kind**: instance method of [<code>Process</code>](#Process)
1960
- **Returns**: <code>Promise</code> - the search info result<code>string</code> - name the name of the organization process<code>object</code> - processIndexFields the list of fields to index<code>object</code> - processParticipantsGroup the permissions in this organization process<code>object</code> - stepsProperties the organization process steps properties<code>string</code> - _id the same organization id
1961
- @
1744
+ **Returns**: <code>Promise</code> - the search info result<code>string</code> - name the name of the organization process<code>object</code> - processIndexFields the list of fields to index<code>object</code> - processParticipantsGroup the permissions in this organization process<code>object</code> - stepsProperties the organization process steps properties<code>string</code> - _id the same organization id
1962
1745
  **Access**: public
1963
1746
  **Author**: CloudBrasil <abernardo.br@gmail.com>
1964
1747
 
@@ -1971,14 +1754,7 @@ Get the search info of a organization process
1971
1754
 
1972
1755
  **Example**
1973
1756
  ```js
1974
- const API = require('@docbrasil/api-systemmanager');
1975
- const api = new API();
1976
- const params = {
1977
- orgProcessId: '5dadd01dc4af3941d42f8c67',
1978
- orgId: '5edd11c46b6ce9729c2c297c',
1979
- }
1980
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1981
- const retSearchInfo = await api.user.process.getOrgProcessSearchInfo(params, session);
1757
+ const API = require('@docbrasil/api-systemmanager');
1982
1758
  orgProcessId: '5dadd01dc4af3941d42f8c67',
1983
1759
  orgId: '5edd11c46b6ce9729c2c297c',
1984
1760
  ```
1985
1761
  <a name="Register"></a>
1986
1762
 
@@ -2006,12 +1782,7 @@ Class for user registration in a user
2006
1782
 
2007
1783
  **Example**
2008
1784
  ```js
2009
- const API = require('@docbrasil/api-systemmanager');
2010
- const api = new API();
2011
- const params = {
2012
- registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...'
2013
- };
2014
- const orgname = await api.user.register.getOrgname(params);
1785
+ const API = require('@docbrasil/api-systemmanager');
2015
1786
  registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...'
2016
1787
  ```
2017
1788
  <a name="Register+validateEmail"></a>
2018
1789
 
@@ -2031,13 +1802,7 @@ Method to find task by id
2031
1802
 
2032
1803
  **Example**
2033
1804
  ```js
2034
- const API = require('@docbrasil/api-systemmanager');
2035
- const api = new API();
2036
- const params = {
2037
- registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
2038
- email: 'myemail@company.com'
2039
- };
2040
- const retData = await api.user.register.validateEmail(params);
1805
+ const API = require('@docbrasil/api-systemmanager');
2041
1806
  registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
2042
1807
  email: 'myemail@company.com'
2043
1808
  ```
2044
1809
  <a name="Register+execute"></a>
2045
1810
 
@@ -2071,30 +1836,60 @@ Method to register a user
2071
1836
 
2072
1837
  **Example**
2073
1838
  ```js
2074
- const API = require('@docbrasil/api-systemmanager');
2075
- const api = new API();
2076
- const params ={
2077
- "registerId": 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
2078
- "type": 'sign',
2079
- "login": false,
2080
- "emailInfo": {
2081
- "code": "5974",
2082
- "email": "cbtoto_1@mailinator.com"
2083
- },
2084
- "registerData": {
2085
- "name": "Augusto Totlo",
2086
- "registerEmail": "cbtoto_1@mailinator.com",
2087
- "phone": "",
2088
- "idcard": "",
2089
- "dob": "1978-01-12T03:00:00.000Z",
2090
- "registerPassword": "123456",
2091
- "emailValidationCode": "5974",
2092
- "phoneValidationCode": "",
2093
- "language": "en-US",
2094
- "timezone": "Europe/Dublin"
2095
- }
2096
- };
2097
- const retData = await api.user.register.execute(params);
1839
+ const API = require('@docbrasil/api-systemmanager');
2098
1840
  "registerId": 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
2099
1841
  "type": 'sign',
2100
1842
  "login": false,
2101
1843
  "emailInfo": {
2102
1844
  "code": "5974",
2103
1845
  "email": "cbtoto_1@mailinator.com"
2104
1846
  },
2105
1847
  "registerData": {
2106
1848
  "name": "Augusto Totlo",
2107
1849
  "registerEmail": "cbtoto_1@mailinator.com",
2108
1850
  "phone": "",
2109
1851
  "idcard": "",
2110
1852
  "dob": "1978-01-12T03:00:00.000Z",
2111
1853
  "registerPassword": "123456",
2112
1854
  "emailValidationCode": "5974",
2113
1855
  "phoneValidationCode": "",
2114
1856
  "language": "en-US",
2115
1857
  "timezone": "Europe/Dublin"
2116
1858
  }
2117
1859
  };
1860
+ ```
1861
+ <a name="TaskAvailable"></a>
1862
+
1863
+ ## TaskAvailable
1864
+ Class for available tasks, permission user
1865
+
1866
+ **Kind**: global class
1867
+
1868
+ * [TaskAvailable](#TaskAvailable)
1869
+ * [.find(params, session)](#TaskAvailable+find) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.&lt;object&gt;</code> \| <code>number</code> \| <code>number</code>
1870
+ * [.claim(params, session)](#TaskAvailable+claim) ⇒ <code>promise</code> \| <code>boolean</code>
1871
+
1872
+ <a name="TaskAvailable+find"></a>
1873
+
1874
+ ### taskAvailable.find(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.&lt;object&gt;</code> \| <code>number</code> \| <code>number</code>
1875
+ Method to find available tasks for a user
1876
+
1877
+ **Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
1878
+ **Returns**: <code>promise</code> - returned data from the search<code>number</code> - count the count of items searched<code>array.&lt;object&gt;</code> - items the items returned from search<code>number</code> - page the page of the search (on pagination), zero indexed<code>number</code> - perPage how many items per page
1879
+ **Access**: public
1880
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
1881
+
1882
+ | Param | Type | Description |
1883
+ | --- | --- | --- |
1884
+ | params | <code>object</code> | Params to get task |
1885
+ | params.query | <code>object</code> | Search process query |
1886
+ | params.orgId | <code>object</code> | Organization id (_id database) |
1887
+ | session | <code>string</code> | Session, token JWT |
1888
+
1889
+ **Example**
1890
+ ```js
1891
+ const API = require('@docbrasil/api-systemmanager');
2118
1892
  query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
2119
1893
  orgId: '55e4a3bd6be6b45210833fae',
1894
+ ```
1895
+ <a name="TaskAvailable+claim"></a>
1896
+
1897
+ ### taskAvailable.claim(params, session) ⇒ <code>promise</code> \| <code>boolean</code>
1898
+ Method for a user to claim an available task
1899
+
1900
+ **Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
1901
+ **Returns**: <code>promise</code> - returned data from the method call<code>boolean</code> - success true|false if the method was successful
1902
+ **Access**: public
1903
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
1904
+
1905
+ | Param | Type | Description |
1906
+ | --- | --- | --- |
1907
+ | params | <code>object</code> | Params to get task |
1908
+ | params.taskId | <code>object</code> | the task id to claim |
1909
+ | params.orgname | <code>object</code> | Organization slug (short name of the orgnization) |
1910
+ | session | <code>string</code> | Session, token JWT |
1911
+
1912
+ **Example**
1913
+ ```js
1914
+ const API = require('@docbrasil/api-systemmanager');
2120
1915
  taskId: '55e4a3bd6be6b45210833f67',
2121
1916
  orgname: 'acme',
2122
1917
  ```
2123
1918
  <a name="Task"></a>
2124
1919
 
@@ -2127,15 +1922,7 @@ Method to find task by id
2127
1922
 
2128
1923
  **Example**
2129
1924
  ```js
2130
- const API = require('@docbrasil/api-systemmanager');
2131
- const api = new API();
2132
- const params = {
2133
- processId: '5dadd01dc4af3941d42f8c5c',
2134
- taskId: '5df7f19618430c89a41a19d2',
2135
- orgId: '55e4a3bd6be6b45210833fae',
2136
- };
2137
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
2138
- await api.user.task.findById(params, session);
1925
+ const API = require('@docbrasil/api-systemmanager');
2139
1926
  processId: '5dadd01dc4af3941d42f8c5c',
2140
1927
  taskId: '5df7f19618430c89a41a19d2',
2141
1928
  orgId: '55e4a3bd6be6b45210833fae',
2142
1929
  ```
2143
1930
  <a name="Task+findByIdAndUpdate"></a>
2144
1931
 
@@ -2161,17 +1948,7 @@ Find task by id and update
2161
1948
 
2162
1949
  **Example**
2163
1950
  ```js
2164
- const API = require('@docbrasil/api-systemmanager');
2165
- const api = new API();
2166
- const params = {
2167
- userId: '5739d4c6ccb0ebc61f2a9557',
2168
- processId: '5dadd01dc4af3941d42f8c5c',
2169
- taskId: '5df7f19618430c89a41a19d2',
2170
- action: 1,
2171
- formData: {name: 'CloudBrasil'},
2172
- };
2173
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
2174
- await api.user.task.findByIdAndUpdate(params, session);
1951
+ const API = require('@docbrasil/api-systemmanager');
2175
1952
  userId: '5739d4c6ccb0ebc61f2a9557',
2176
1953
  processId: '5dadd01dc4af3941d42f8c5c',
2177
1954
  taskId: '5df7f19618430c89a41a19d2',
2178
1955
  action: 1,
2179
1956
  formData: {name: 'CloudBrasil'},
2180
1957
  ```
2181
1958
  <a name="Task+executeActionFinalize"></a>
2182
1959
 
@@ -2193,83 +1970,7 @@ Find task by id and update
2193
1970
 
2194
1971
  **Example**
2195
1972
  ```js
2196
- const API = require('@docbrasil/api-systemmanager');
2197
- const api = new API();
2198
- const params = {
2199
- taskId: '5df7f19618430c89a41a19d2',
2200
- actionGuid: 'b3823a2ae52c7a05bfb9590fe427038d'
2201
- orgId: '5df7f19618430c89a41a1bc3',
2202
- body: {}',
2203
- };
2204
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
2205
- await api.user.task.executeActionFinalize(params, session);
2206
- ```
2207
- <a name="TaskAvailable"></a>
2208
-
2209
- ## TaskAvailable
2210
- Class for available tasks, permission user
2211
-
2212
- **Kind**: global class
2213
-
2214
- * [TaskAvailable](#TaskAvailable)
2215
- * [.find(params, session)](#TaskAvailable+find) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.&lt;object&gt;</code> \| <code>number</code> \| <code>number</code>
2216
- * [.claim(params, session)](#TaskAvailable+claim) ⇒ <code>promise</code> \| <code>boolean</code>
2217
-
2218
- <a name="TaskAvailable+find"></a>
2219
-
2220
- ### taskAvailable.find(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.&lt;object&gt;</code> \| <code>number</code> \| <code>number</code>
2221
- Method to find available tasks for a user
2222
-
2223
- **Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
2224
- **Returns**: <code>promise</code> - returned data from the search<code>number</code> - count the count of items searched<code>array.&lt;object&gt;</code> - items the items returned from search<code>number</code> - page the page of the search (on pagination), zero indexed<code>number</code> - perPage how many items per page
2225
- **Access**: public
2226
- **Author**: CloudBrasil <abernardo.br@gmail.com>
2227
-
2228
- | Param | Type | Description |
2229
- | --- | --- | --- |
2230
- | params | <code>object</code> | Params to get task |
2231
- | params.query | <code>object</code> | Search process query |
2232
- | params.orgId | <code>object</code> | Organization id (_id database) |
2233
- | session | <code>string</code> | Session, token JWT |
2234
-
2235
- **Example**
2236
- ```js
2237
- const API = require('@docbrasil/api-systemmanager');
2238
- const api = new API();
2239
- const params = {
2240
- query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
2241
- orgId: '55e4a3bd6be6b45210833fae',
2242
- };
2243
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
2244
- const retSearch = await api.user.task.available.find(params, session);
2245
- ```
2246
- <a name="TaskAvailable+claim"></a>
2247
-
2248
- ### taskAvailable.claim(params, session) ⇒ <code>promise</code> \| <code>boolean</code>
2249
- Method for a user to claim an available task
2250
-
2251
- **Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
2252
- **Returns**: <code>promise</code> - returned data from the method call<code>boolean</code> - success true|false if the method was successful
2253
- **Access**: public
2254
- **Author**: CloudBrasil <abernardo.br@gmail.com>
2255
-
2256
- | Param | Type | Description |
2257
- | --- | --- | --- |
2258
- | params | <code>object</code> | Params to get task |
2259
- | params.taskId | <code>object</code> | the task id to claim |
2260
- | params.orgname | <code>object</code> | Organization slug (short name of the orgnization) |
2261
- | session | <code>string</code> | Session, token JWT |
2262
-
2263
- **Example**
2264
- ```js
2265
- const API = require('@docbrasil/api-systemmanager');
2266
- const api = new API();
2267
- const params = {
2268
- taskId: '55e4a3bd6be6b45210833f67',
2269
- orgname: 'acme',
2270
- };
2271
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
2272
- const success = await api.user.task.available.claim(params, session);
1973
+ const API = require('@docbrasil/api-systemmanager');
2273
1974
  taskId: '5df7f19618430c89a41a19d2',
2274
1975
  actionGuid: 'b3823a2ae52c7a05bfb9590fe427038d'
2275
1976
  orgId: '5df7f19618430c89a41a1bc3',
2276
1977
  body: {}',
2277
1978
  ```
2278
1979
  <a name="User"></a>
2279
1980
 
@@ -2304,14 +2005,7 @@ Update avatar of user by session of user not allow session user SU
2304
2005
 
2305
2006
  **Example**
2306
2007
  ```js
2307
- const API = require('@docbrasil/api-systemmanager');
2308
- const api = new API();
2309
- const params = {
2310
- avatar: '55e4a3bd6be6b45210833fae',
2311
- type: '123456',
2312
- };
2313
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
2314
- await api.user.profile.updateAvatar(params, session);
2008
+ const API = require('@docbrasil/api-systemmanager');
2315
2009
  avatar: '55e4a3bd6be6b45210833fae',
2316
2010
  type: '123456',
2317
2011
  ```
2318
2012
  <a name="User+removeAvatar"></a>
2319
2013
 
@@ -2328,10 +2022,7 @@ Remove avatar of user by session of user not allow session user SU
2328
2022
 
2329
2023
  **Example**
2330
2024
  ```js
2331
- const API = require('@docbrasil/api-systemmanager');
2332
- const api = new API();
2333
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
2334
- await api.user.profile.removeAvatar(session);
2025
+ const API = require('@docbrasil/api-systemmanager');
2335
2026
  ```
2336
2027
  <a name="User+removeSignature"></a>
2337
2028
 
@@ -2348,10 +2039,7 @@ Remove the signature of user by session
2348
2039
 
2349
2040
  **Example**
2350
2041
  ```js
2351
- const API = require('@docbrasil/api-systemmanager');
2352
- const api = new API();
2353
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
2354
- await api.user.profile.removeSignature(session);
2042
+ const API = require('@docbrasil/api-systemmanager');
2355
2043
  ```
2356
2044
  <a name="User+saveSignature"></a>
2357
2045
 
@@ -2371,23 +2059,7 @@ Sava a new signature of user by session
2371
2059
 
2372
2060
  **Example**
2373
2061
  ```js
2374
- const API = require('@docbrasil/api-systemmanager');
2375
- const api = new API();
2376
- const data = {
2377
- type: 'CURSIVE',
2378
- file: 'allura:Mary John Heart'
2379
- };
2380
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
2381
- await api.user.profile.saveSignature(data, session);
2382
-
2383
- const API = require('@docbrasil/api-systemmanager');
2384
- const api = new API();
2385
- const data = {
2386
- type: 'HANDWRITE',
2387
- file: 'iVBORw0KGgoAAAANSUhEUgAAAj...'
2388
- };
2389
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
2390
- await api.user.profile.saveSignature(session);
2062
+ const API = require('@docbrasil/api-systemmanager');
2391
2063
  type: 'CURSIVE',
2392
2064
  file: 'allura:Mary John Heart'
2393
2065
  type: 'HANDWRITE',
2394
2066
  file: 'iVBORw0KGgoAAAANSUhEUgAAAj...'
2395
2067
  ```
2396
2068
  <a name="User+findByIdAndUpdate"></a>
2397
2069
 
@@ -2421,13 +2093,7 @@ Update a user profile by id
2421
2093
 
2422
2094
  **Example**
2423
2095
  ```js
2424
- const API = require('@docbrasil/api-systemmanager');
2425
- const api = new API();
2426
- const params = {
2427
- name: 'New Name'
2428
- };
2429
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
2430
- await api.user.profile.findByIdAndUpdate(params, session);
2096
+ const API = require('@docbrasil/api-systemmanager');
2431
2097
  name: 'New Name'
2432
2098
  ```
2433
2099
  <a name="User+changeOrganization"></a>
2434
2100
 
@@ -2445,9 +2111,5 @@ Change a user's organization
2445
2111
 
2446
2112
  **Example**
2447
2113
  ```js
2448
- const API = require('@docbrasil/api-systemmanager');
2449
- const api = new API();
2450
- const id = '616eccaaa9360a05293b10fe';
2451
- const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
2452
- await api.user.changeOrganization.updateAvatar(id, session);
2114
+ const API = require('@docbrasil/api-systemmanager');
2453
2115
  ```