@docbrasil/api-systemmanager 1.1.13 → 1.1.14
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/my_tasks.js +83 -2
- package/dist/bundle.cjs +83 -2
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +565 -1310
- package/package.json +1 -1
package/doc/api.md
CHANGED
|
@@ -37,12 +37,24 @@
|
|
|
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>
|
|
43
|
+
<dt><a href="#External">External</a></dt>
|
|
44
|
+
<dd><p>Class for documents, permission user</p>
|
|
45
|
+
</dd>
|
|
40
46
|
<dt><a href="#GeoLocation">GeoLocation</a></dt>
|
|
41
47
|
<dd><p>General Class for user, permission organization</p>
|
|
42
48
|
</dd>
|
|
43
49
|
<dt><a href="#Users">Users</a></dt>
|
|
44
50
|
<dd><p>API request, user permission level</p>
|
|
45
51
|
</dd>
|
|
52
|
+
<dt><a href="#Login">Login</a></dt>
|
|
53
|
+
<dd><p>Login manager</p>
|
|
54
|
+
</dd>
|
|
55
|
+
<dt><a href="#Session">Session</a></dt>
|
|
56
|
+
<dd><p>Session manager of the API</p>
|
|
57
|
+
</dd>
|
|
46
58
|
<dt><a href="#Application">Application</a></dt>
|
|
47
59
|
<dd><p>Class for Applications, permission user</p>
|
|
48
60
|
</dd>
|
|
@@ -79,30 +91,18 @@
|
|
|
79
91
|
<dt><a href="#Settings">Settings</a></dt>
|
|
80
92
|
<dd><p>Class for user settings</p>
|
|
81
93
|
</dd>
|
|
82
|
-
<dt><a href="#Task">Task</a></dt>
|
|
83
|
-
<dd><p>Class for task, permission user</p>
|
|
84
|
-
</dd>
|
|
85
94
|
<dt><a href="#TaskAvailable">TaskAvailable</a></dt>
|
|
86
95
|
<dd><p>Class for available tasks, permission user</p>
|
|
87
96
|
</dd>
|
|
97
|
+
<dt><a href="#Task">Task</a></dt>
|
|
98
|
+
<dd><p>Class for task, permission user</p>
|
|
99
|
+
</dd>
|
|
88
100
|
<dt><a href="#Updates">Updates</a></dt>
|
|
89
101
|
<dd><p>Class for user registration in a user</p>
|
|
90
102
|
</dd>
|
|
91
103
|
<dt><a href="#User">User</a></dt>
|
|
92
104
|
<dd><p>Class for user, permission user</p>
|
|
93
105
|
</dd>
|
|
94
|
-
<dt><a href="#Dispatch">Dispatch</a></dt>
|
|
95
|
-
<dd><p>Api dispatch manager</p>
|
|
96
|
-
</dd>
|
|
97
|
-
<dt><a href="#External">External</a></dt>
|
|
98
|
-
<dd><p>Class for documents, permission user</p>
|
|
99
|
-
</dd>
|
|
100
|
-
<dt><a href="#Login">Login</a></dt>
|
|
101
|
-
<dd><p>Login manager</p>
|
|
102
|
-
</dd>
|
|
103
|
-
<dt><a href="#Session">Session</a></dt>
|
|
104
|
-
<dd><p>Session manager of the API</p>
|
|
105
|
-
</dd>
|
|
106
106
|
</dl>
|
|
107
107
|
|
|
108
108
|
<a name="AdminDocuments"></a>
|
|
@@ -138,33 +138,7 @@ Advanced search of document in elastic search ussing system manager
|
|
|
138
138
|
|
|
139
139
|
**Example**
|
|
140
140
|
```js
|
|
141
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
142
|
-
const api = new API();
|
|
143
|
-
const params = {
|
|
144
|
-
docId: '5edd11c46b6ce9729c2c297c',
|
|
145
|
-
query: {
|
|
146
|
-
"query": {
|
|
147
|
-
"bool": {
|
|
148
|
-
"minimum_should_match": 1,
|
|
149
|
-
"should": [
|
|
150
|
-
{
|
|
151
|
-
"match": {
|
|
152
|
-
"locationText.keyword": {
|
|
153
|
-
"query": "sao pau"
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
"wildcard": {
|
|
159
|
-
"locationText.normalized": "*sao pau*"
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
]
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
167
|
-
await api.admin.document.advancedSearch(params, session);
|
|
141
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
168
142
|
docId: '5edd11c46b6ce9729c2c297c',
|
|
169
143
|
query: {
|
|
170
144
|
"query": {
|
|
171
145
|
"bool": {
|
|
172
146
|
"minimum_should_match": 1,
|
|
173
147
|
"should": [
|
|
174
148
|
{
|
|
175
149
|
"match": {
|
|
176
150
|
"locationText.keyword": {
|
|
177
151
|
"query": "sao pau"
|
|
178
152
|
}
|
|
179
153
|
}
|
|
180
154
|
},
|
|
181
155
|
{
|
|
182
156
|
"wildcard": {
|
|
183
157
|
"locationText.normalized": "*sao pau*"
|
|
184
158
|
}
|
|
185
159
|
}
|
|
186
160
|
]
|
|
187
161
|
}
|
|
188
162
|
}
|
|
189
163
|
}
|
|
190
164
|
```
|
|
191
165
|
<a name="AdminDocuments+findById"></a>
|
|
192
166
|
|
|
@@ -184,14 +158,7 @@ Get document by id
|
|
|
184
158
|
|
|
185
159
|
**Example**
|
|
186
160
|
```js
|
|
187
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
188
|
-
const api = new API();
|
|
189
|
-
const params = {
|
|
190
|
-
docId: '5edd11c46b6ce9729c2c297c',
|
|
191
|
-
orgId: '55e4a3bd6be6b45210833fae'
|
|
192
|
-
};
|
|
193
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
194
|
-
await api.admin.document.findById(params, session);
|
|
161
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
195
162
|
docId: '5edd11c46b6ce9729c2c297c',
|
|
196
163
|
orgId: '55e4a3bd6be6b45210833fae'
|
|
197
164
|
```
|
|
198
165
|
<a name="AdminDocuments+signedUrl"></a>
|
|
199
166
|
|
|
@@ -212,25 +179,11 @@ Request signed url url to put or get
|
|
|
212
179
|
|
|
213
180
|
**Example**
|
|
214
181
|
```js
|
|
215
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
216
|
-
const api = new API();
|
|
217
|
-
const params - {
|
|
218
|
-
methodType: 'put',
|
|
219
|
-
docId: '5dadd01dc4af3941d42f8c5c'
|
|
220
|
-
};
|
|
221
|
-
const apiKey: '...';
|
|
222
|
-
const { docId, name, areaId, type, signedUrl } = await api.admin.document.signedUrl(params, apiKey);
|
|
182
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
223
183
|
methodType: 'put',
|
|
224
184
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
225
185
|
```
|
|
226
186
|
**Example**
|
|
227
187
|
```js
|
|
228
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
229
|
-
const api = new API();
|
|
230
|
-
const params - {
|
|
231
|
-
methodType: 'get',
|
|
232
|
-
docId: '5dadd01dc4af3941d42f8c5c'
|
|
233
|
-
};
|
|
234
|
-
const apiKey: '...';
|
|
235
|
-
const { signedUrl, imageType } = await api.admin.document.signedUrl(params, apiKey);
|
|
188
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
236
189
|
methodType: 'get',
|
|
237
190
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
238
191
|
```
|
|
239
192
|
<a name="AdminDocuments+updateContent"></a>
|
|
240
193
|
|
|
@@ -251,14 +204,7 @@ Update a document content
|
|
|
251
204
|
|
|
252
205
|
**Example**
|
|
253
206
|
```js
|
|
254
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
255
|
-
const api = new API();
|
|
256
|
-
const params - {
|
|
257
|
-
content: 'some text...',
|
|
258
|
-
docId: '5dadd01dc4af3941d42f8c5c'
|
|
259
|
-
};
|
|
260
|
-
const apiKey: '...';
|
|
261
|
-
await api.admin.document.updateContent(params, apiKey);
|
|
207
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
262
208
|
content: 'some text...',
|
|
263
209
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
264
210
|
```
|
|
265
211
|
<a name="AdminDocuments+updateAI"></a>
|
|
266
212
|
|
|
@@ -285,14 +231,7 @@ Update a document content
|
|
|
285
231
|
|
|
286
232
|
**Example**
|
|
287
233
|
```js
|
|
288
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
289
|
-
const api = new API();
|
|
290
|
-
const params - {
|
|
291
|
-
content: 'some text...',
|
|
292
|
-
docId: '5dadd01dc4af3941d42f8c5c'
|
|
293
|
-
};
|
|
294
|
-
const apiKey: '...';
|
|
295
|
-
await api.admin.document.updateContent(params, apiKey);
|
|
234
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
296
235
|
content: 'some text...',
|
|
297
236
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
298
237
|
```
|
|
299
238
|
<a name="AdminDocuments+getContent"></a>
|
|
300
239
|
|
|
@@ -313,14 +252,7 @@ Get the content of a document
|
|
|
313
252
|
|
|
314
253
|
**Example**
|
|
315
254
|
```js
|
|
316
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
317
|
-
const api = new API();
|
|
318
|
-
const params - {
|
|
319
|
-
page: '0',
|
|
320
|
-
docId: '5dadd01dc4af3941d42f8c5c'
|
|
321
|
-
};
|
|
322
|
-
const apiKey: '...';
|
|
323
|
-
await api.admin.document.getContent(params, apiKey);
|
|
255
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
324
256
|
page: '0',
|
|
325
257
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
326
258
|
```
|
|
327
259
|
<a name="AdminForm"></a>
|
|
328
260
|
|
|
@@ -351,14 +283,7 @@ Get advance form by ID
|
|
|
351
283
|
|
|
352
284
|
**Example**
|
|
353
285
|
```js
|
|
354
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
355
|
-
const api = new API();
|
|
356
|
-
const params = {
|
|
357
|
-
id: '55e4a3bd6be6b45210833fae',
|
|
358
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
359
|
-
};
|
|
360
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
361
|
-
await api.admin.form.findById(params, session);
|
|
286
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
362
287
|
id: '55e4a3bd6be6b45210833fae',
|
|
363
288
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
364
289
|
```
|
|
365
290
|
<a name="AdminForm+getFormList"></a>
|
|
366
291
|
|
|
@@ -382,13 +307,7 @@ Request signed url url to put or get
|
|
|
382
307
|
|
|
383
308
|
**Example**
|
|
384
309
|
```js
|
|
385
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
386
|
-
const api = new API();
|
|
387
|
-
const params - {
|
|
388
|
-
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
389
|
-
};
|
|
390
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
391
|
-
await api.user.form.getFormList(params, session);
|
|
310
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
392
311
|
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
393
312
|
```
|
|
394
313
|
<a name="Admin"></a>
|
|
395
314
|
|
|
@@ -435,14 +354,7 @@ Get list by ID
|
|
|
435
354
|
|
|
436
355
|
**Example**
|
|
437
356
|
```js
|
|
438
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
439
|
-
const api = new API();
|
|
440
|
-
const params = {
|
|
441
|
-
id: '55e4a3bd6be6b45210833fae',
|
|
442
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
443
|
-
};
|
|
444
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
445
|
-
await api.admin.list.findById(params, session);
|
|
357
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
446
358
|
id: '55e4a3bd6be6b45210833fae',
|
|
447
359
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
448
360
|
```
|
|
449
361
|
<a name="AdminLists+find"></a>
|
|
450
362
|
|
|
@@ -463,13 +375,7 @@ Get all lists
|
|
|
463
375
|
|
|
464
376
|
**Example**
|
|
465
377
|
```js
|
|
466
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
467
|
-
const api = new API();
|
|
468
|
-
const params = {
|
|
469
|
-
orgId: '55e4a3bd6be6b45210833fae'
|
|
470
|
-
};
|
|
471
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
472
|
-
await api.admin.list.find(params, session);
|
|
378
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
473
379
|
orgId: '55e4a3bd6be6b45210833fae'
|
|
474
380
|
```
|
|
475
381
|
<a name="AdminMessage"></a>
|
|
476
382
|
|
|
@@ -547,15 +453,7 @@ Send email, array with email list or send one email
|
|
|
547
453
|
|
|
548
454
|
**Example**
|
|
549
455
|
```js
|
|
550
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
551
|
-
const api = new API();
|
|
552
|
-
const params = {
|
|
553
|
-
subject: 'Test email',
|
|
554
|
-
message: '<h1>Hi!</h1>',
|
|
555
|
-
to: 'destination@gmail.com'
|
|
556
|
-
};
|
|
557
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
558
|
-
await api.admin.message.sendEmail(params, session);
|
|
456
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
559
457
|
subject: 'Test email',
|
|
560
458
|
message: '<h1>Hi!</h1>',
|
|
561
459
|
to: 'destination@gmail.com'
|
|
562
460
|
```
|
|
563
461
|
<a name="AdminNotification"></a>
|
|
564
462
|
|
|
@@ -604,15 +502,7 @@ Create notification
|
|
|
604
502
|
|
|
605
503
|
**Example**
|
|
606
504
|
```js
|
|
607
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
608
|
-
const api = new API();
|
|
609
|
-
const params = {
|
|
610
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
611
|
-
userId: '55e4a3bd6be6b45210833fae',
|
|
612
|
-
message: 'Olá como vai tudo bem?'
|
|
613
|
-
};
|
|
614
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
615
|
-
await api.admin.notifications.add(params, session);
|
|
505
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
616
506
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
617
507
|
userId: '55e4a3bd6be6b45210833fae',
|
|
618
508
|
message: 'Olá como vai tudo bem?'
|
|
619
509
|
```
|
|
620
510
|
<a name="AdminNotification+findById"></a>
|
|
621
511
|
|
|
@@ -632,14 +522,7 @@ Search notification using (notificationId or userId)
|
|
|
632
522
|
|
|
633
523
|
**Example**
|
|
634
524
|
```js
|
|
635
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
636
|
-
const api = new API();
|
|
637
|
-
const params = {
|
|
638
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
639
|
-
id: '55e4a3bd6be6b45210833fae',
|
|
640
|
-
};
|
|
641
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
642
|
-
await api.admin.notifications.findById(params, session);
|
|
525
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
643
526
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
644
527
|
id: '55e4a3bd6be6b45210833fae',
|
|
645
528
|
```
|
|
646
529
|
<a name="AdminNotification+findByIdAndUpdate"></a>
|
|
647
530
|
|
|
@@ -660,15 +543,7 @@ Update notification using (notificationId or userId)
|
|
|
660
543
|
|
|
661
544
|
**Example**
|
|
662
545
|
```js
|
|
663
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
664
|
-
const api = new API();
|
|
665
|
-
const params = {
|
|
666
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
667
|
-
id: '55e4a3bd6be6b45210833fae',
|
|
668
|
-
read: true
|
|
669
|
-
};
|
|
670
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
671
|
-
await api.admin.notifications.findByIdAndUpdate(params, session);
|
|
546
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
672
547
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
673
548
|
id: '55e4a3bd6be6b45210833fae',
|
|
674
549
|
read: true
|
|
675
550
|
```
|
|
676
551
|
<a name="AdminNotification+findByIdAndRemove"></a>
|
|
677
552
|
|
|
@@ -688,14 +563,7 @@ Delete notification using (notificationId or userId)
|
|
|
688
563
|
|
|
689
564
|
**Example**
|
|
690
565
|
```js
|
|
691
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
692
|
-
const api = new API();
|
|
693
|
-
const params = {
|
|
694
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
695
|
-
id: '55e4a3bd6be6b45210833fae',
|
|
696
|
-
};
|
|
697
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
698
|
-
await api.admin.notifications.findByIdAndDelete(params, session);
|
|
566
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
699
567
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
700
568
|
id: '55e4a3bd6be6b45210833fae',
|
|
701
569
|
```
|
|
702
570
|
<a name="Organization"></a>
|
|
703
571
|
|
|
@@ -732,15 +600,7 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
732
600
|
|
|
733
601
|
**Example**
|
|
734
602
|
```js
|
|
735
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
736
|
-
const api = new API();
|
|
737
|
-
const params = {
|
|
738
|
-
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
739
|
-
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
740
|
-
type: 'image/png',
|
|
741
|
-
};
|
|
742
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
743
|
-
await api.admin.organizations.upsertAvatar(params, session);
|
|
603
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
744
604
|
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
745
605
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
746
606
|
type: 'image/png',
|
|
747
607
|
```
|
|
748
608
|
<a name="Organization+removeAvatar"></a>
|
|
749
609
|
|
|
@@ -758,11 +618,7 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
758
618
|
|
|
759
619
|
**Example**
|
|
760
620
|
```js
|
|
761
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
762
|
-
const api = new API();
|
|
763
|
-
const orgId = '5dadd01dc4af3941d42f8c5c';
|
|
764
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
765
|
-
await api.admin.organizations.removeAvatar(orgId, session);
|
|
621
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
766
622
|
```
|
|
767
623
|
<a name="Organization+findById"></a>
|
|
768
624
|
|
|
@@ -780,11 +636,7 @@ Find organization by id
|
|
|
780
636
|
|
|
781
637
|
**Example**
|
|
782
638
|
```js
|
|
783
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
784
|
-
const api = new API();
|
|
785
|
-
const orgId = '80443245000122';
|
|
786
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
787
|
-
await api.user.organization.findById(idCard, session);
|
|
639
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
788
640
|
```
|
|
789
641
|
<a name="Organization+idCardExist"></a>
|
|
790
642
|
|
|
@@ -802,11 +654,7 @@ Check if id card exist
|
|
|
802
654
|
|
|
803
655
|
**Example**
|
|
804
656
|
```js
|
|
805
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
806
|
-
const api = new API();
|
|
807
|
-
const idCard = '80443245000122';
|
|
808
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
809
|
-
await api.user.organization.idCardExist(idCard, session);
|
|
657
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
810
658
|
```
|
|
811
659
|
<a name="Organization+upsertAvatar"></a>
|
|
812
660
|
|
|
@@ -826,14 +674,7 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
826
674
|
|
|
827
675
|
**Example**
|
|
828
676
|
```js
|
|
829
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
830
|
-
const api = new API();
|
|
831
|
-
const params = {
|
|
832
|
-
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
833
|
-
type: 'image/png',
|
|
834
|
-
};
|
|
835
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
836
|
-
await api.user.profile.updateAvatar(params, session);
|
|
677
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
837
678
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
838
679
|
type: 'image/png',
|
|
839
680
|
```
|
|
840
681
|
<a name="Organization+removeAvatar"></a>
|
|
841
682
|
|
|
@@ -850,10 +691,7 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
850
691
|
|
|
851
692
|
**Example**
|
|
852
693
|
```js
|
|
853
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
854
|
-
const api = new API();
|
|
855
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
856
|
-
await api.user.profile.removeAvatar(session);
|
|
694
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
857
695
|
```
|
|
858
696
|
<a name="Organization+callFetch"></a>
|
|
859
697
|
|
|
@@ -873,14 +711,7 @@ Call URL internal, need auth JWT (session)
|
|
|
873
711
|
|
|
874
712
|
**Example**
|
|
875
713
|
```js
|
|
876
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
877
|
-
const api = new API();
|
|
878
|
-
|
|
879
|
-
const params = {
|
|
880
|
-
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
881
|
-
method: 'POST'
|
|
882
|
-
}
|
|
883
|
-
await api.user.organization.callFetchs(params, session);
|
|
714
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
884
715
|
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
885
716
|
method: 'POST'
|
|
886
717
|
```
|
|
887
718
|
<a name="AdminPlugin"></a>
|
|
888
719
|
|
|
@@ -910,11 +741,7 @@ Find plugins
|
|
|
910
741
|
|
|
911
742
|
**Example**
|
|
912
743
|
```js
|
|
913
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
914
|
-
const api = new API();
|
|
915
|
-
const params = {page: 1, perPage: 200};
|
|
916
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
917
|
-
await api.user.organization.findById(params, session);
|
|
744
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
918
745
|
```
|
|
919
746
|
<a name="AdminPlugin+findById"></a>
|
|
920
747
|
|
|
@@ -932,11 +759,7 @@ Get plugin by ID
|
|
|
932
759
|
|
|
933
760
|
**Example**
|
|
934
761
|
```js
|
|
935
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
936
|
-
const api = new API();
|
|
937
|
-
const id ='55e4a3bd6be6b45210833fae',
|
|
938
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
939
|
-
await api.admin.plugin.findById(id, session);
|
|
762
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
940
763
|
```
|
|
941
764
|
<a name="AdminPolicy"></a>
|
|
942
765
|
|
|
@@ -959,10 +782,7 @@ Find all policies
|
|
|
959
782
|
|
|
960
783
|
**Example**
|
|
961
784
|
```js
|
|
962
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
963
|
-
const api = new API();
|
|
964
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
965
|
-
await api.admin.policy.find(session);
|
|
785
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
966
786
|
```
|
|
967
787
|
<a name="AdminProcesses"></a>
|
|
968
788
|
|
|
@@ -986,16 +806,7 @@ Advanced search of processes, check documentation, to verify all params, pass to
|
|
|
986
806
|
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
987
807
|
**Example**
|
|
988
808
|
```js
|
|
989
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
990
|
-
const api = new API();
|
|
991
|
-
const params = {
|
|
992
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
993
|
-
...
|
|
994
|
-
...
|
|
995
|
-
...
|
|
996
|
-
};
|
|
997
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
998
|
-
await api.admin.processes.search(params, session);
|
|
809
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
999
810
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
1000
811
|
...
|
|
1001
812
|
...
|
|
1002
813
|
...
|
|
1003
814
|
```
|
|
1004
815
|
<a name="AdminProcesses+advancedSearch"></a>
|
|
1005
816
|
|
|
@@ -1015,23 +826,7 @@ Advanced search of process in elastic search ussing system manager
|
|
|
1015
826
|
|
|
1016
827
|
**Example**
|
|
1017
828
|
```js
|
|
1018
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1019
|
-
const api = new API();
|
|
1020
|
-
const params = {
|
|
1021
|
-
orgProcessId: '5edd11c46b6ce9729c2c297c',
|
|
1022
|
-
query: {
|
|
1023
|
-
"_source": "processData.properties.processProperties",
|
|
1024
|
-
"query": {
|
|
1025
|
-
"term": {
|
|
1026
|
-
"initParams.email.keyword": {
|
|
1027
|
-
"value": "clintes001@gmail.com"
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1034
|
-
await api.admin.processes.advancedSearch(params, session);
|
|
829
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1035
830
|
orgProcessId: '5edd11c46b6ce9729c2c297c',
|
|
1036
831
|
query: {
|
|
1037
832
|
"_source": "processData.properties.processProperties",
|
|
1038
833
|
"query": {
|
|
1039
834
|
"term": {
|
|
1040
835
|
"initParams.email.keyword": {
|
|
1041
836
|
"value": "clintes001@gmail.com"
|
|
1042
837
|
}
|
|
1043
838
|
}
|
|
1044
839
|
}
|
|
1045
840
|
}
|
|
1046
841
|
```
|
|
1047
842
|
<a name="AdminTask"></a>
|
|
1048
843
|
|
|
@@ -1062,13 +857,7 @@ Get task by user Id
|
|
|
1062
857
|
|
|
1063
858
|
**Example**
|
|
1064
859
|
```js
|
|
1065
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1066
|
-
const api = new API();
|
|
1067
|
-
const params = {
|
|
1068
|
-
userId: '55e4a3bd6be6b45210833fae',
|
|
1069
|
-
};
|
|
1070
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1071
|
-
await api.admin.task.find(params, session);
|
|
860
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1072
861
|
userId: '55e4a3bd6be6b45210833fae',
|
|
1073
862
|
```
|
|
1074
863
|
<a name="AdminUser"></a>
|
|
1075
864
|
|
|
@@ -1102,11 +891,7 @@ Request profile by userId
|
|
|
1102
891
|
|
|
1103
892
|
**Example**
|
|
1104
893
|
```js
|
|
1105
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1106
|
-
const api = new API();
|
|
1107
|
-
const userId = '55e4a3bd6be6b45210833fae';
|
|
1108
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1109
|
-
await api.admin.user.findById(userId, session);
|
|
894
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1110
895
|
```
|
|
1111
896
|
<a name="AdminUser+findByIds"></a>
|
|
1112
897
|
|
|
@@ -1124,11 +909,7 @@ Request profile by userId
|
|
|
1124
909
|
|
|
1125
910
|
**Example**
|
|
1126
911
|
```js
|
|
1127
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1128
|
-
const api = new API();
|
|
1129
|
-
const userIds = ['55e4a3bd6be6b45210833fae', '55e4a3bd6be6b45210833fae'];
|
|
1130
|
-
const apiKey = 'c9bbd652-d112-454e-8595-f1669f49dde0';
|
|
1131
|
-
await api.admin.user.findByIds(userIds, apiKey);
|
|
912
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1132
913
|
```
|
|
1133
914
|
<a name="AdminUser+findByIdAndUpdatePassword"></a>
|
|
1134
915
|
|
|
@@ -1149,15 +930,7 @@ Update password by userId
|
|
|
1149
930
|
|
|
1150
931
|
**Example**
|
|
1151
932
|
```js
|
|
1152
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1153
|
-
const api = new API();
|
|
1154
|
-
const params = {
|
|
1155
|
-
userId: '55e4a3bd6be6b45210833fae',
|
|
1156
|
-
oldPassword: '123456',
|
|
1157
|
-
newPassword: '123456789'
|
|
1158
|
-
};
|
|
1159
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1160
|
-
await api.admin.user.findByIdAndUpdatePassword(params, session);
|
|
933
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1161
934
|
userId: '55e4a3bd6be6b45210833fae',
|
|
1162
935
|
oldPassword: '123456',
|
|
1163
936
|
newPassword: '123456789'
|
|
1164
937
|
```
|
|
1165
938
|
<a name="AdminUser+emailExist"></a>
|
|
1166
939
|
|
|
@@ -1175,11 +948,7 @@ Check if email is unique
|
|
|
1175
948
|
|
|
1176
949
|
**Example**
|
|
1177
950
|
```js
|
|
1178
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1179
|
-
const api = new API();
|
|
1180
|
-
const email = 'ana.silva@gmail.com';
|
|
1181
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1182
|
-
await api.admin.user.emailExist(email, session);
|
|
951
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1183
952
|
```
|
|
1184
953
|
<a name="AdminUser+findByIdAndUpdate"></a>
|
|
1185
954
|
|
|
@@ -1197,12 +966,7 @@ update userData by userSMId
|
|
|
1197
966
|
|
|
1198
967
|
**Example**
|
|
1199
968
|
```js
|
|
1200
|
-
const userId = '55e4a3bd6be6b45210833fae';
|
|
1201
|
-
const payload = {
|
|
1202
|
-
name: 'Maria joaquina',
|
|
1203
|
-
email: 'maria@gmail.com'
|
|
1204
|
-
};
|
|
1205
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
969
|
+
const userId = '55e4a3bd6be6b45210833fae';
|
|
1206
970
|
name: 'Maria joaquina',
|
|
1207
971
|
email: 'maria@gmail.com'
|
|
1208
972
|
```
|
|
1209
973
|
<a name="AdminUser+getChangePasswordGuid"></a>
|
|
1210
974
|
|
|
@@ -1218,10 +982,7 @@ Request GUID to change the password
|
|
|
1218
982
|
|
|
1219
983
|
**Example**
|
|
1220
984
|
```js
|
|
1221
|
-
const payload = {
|
|
1222
|
-
email: 'maria@gmail.com'
|
|
1223
|
-
};
|
|
1224
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
985
|
+
const payload = {
|
|
1225
986
|
email: 'maria@gmail.com'
|
|
1226
987
|
```
|
|
1227
988
|
<a name="AdminUser+changePasswordGuid"></a>
|
|
1228
989
|
|
|
@@ -1239,11 +1000,143 @@ Change password guid
|
|
|
1239
1000
|
|
|
1240
1001
|
**Example**
|
|
1241
1002
|
```js
|
|
1242
|
-
const payload = {
|
|
1243
|
-
guid: '5b3c049c-4861-4353-a423-5e3f14242642',
|
|
1244
|
-
newPassword: '123456789'
|
|
1245
|
-
};
|
|
1246
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1003
|
+
const payload = {
|
|
1247
1004
|
guid: '5b3c049c-4861-4353-a423-5e3f14242642',
|
|
1248
1005
|
newPassword: '123456789'
|
|
1006
|
+
```
|
|
1007
|
+
<a name="Dispatch"></a>
|
|
1008
|
+
|
|
1009
|
+
## Dispatch
|
|
1010
|
+
Api dispatch manager
|
|
1011
|
+
|
|
1012
|
+
**Kind**: global class
|
|
1013
|
+
|
|
1014
|
+
* [Dispatch](#Dispatch)
|
|
1015
|
+
* [.getContext(url, session)](#Dispatch+getContext) ⇒ <code>Promise.<object></code>
|
|
1016
|
+
* [.getClient()](#Dispatch+getClient) ⇒ <code>promise</code>
|
|
1017
|
+
|
|
1018
|
+
<a name="Dispatch+getContext"></a>
|
|
1019
|
+
|
|
1020
|
+
### dispatch.getContext(url, session) ⇒ <code>Promise.<object></code>
|
|
1021
|
+
Get the URL context
|
|
1022
|
+
|
|
1023
|
+
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
1024
|
+
**Returns**: <code>Promise.<object></code> - The full data context of the URL
|
|
1025
|
+
**Access**: public
|
|
1026
|
+
|
|
1027
|
+
| Param | Type | Default | Description |
|
|
1028
|
+
| --- | --- | --- | --- |
|
|
1029
|
+
| url | <code>string</code> | | Full url |
|
|
1030
|
+
| session | <code>session</code> | <code></code> | Session, token JWT |
|
|
1031
|
+
|
|
1032
|
+
**Example**
|
|
1033
|
+
```js
|
|
1034
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1035
|
+
```
|
|
1036
|
+
<a name="Dispatch+getClient"></a>
|
|
1037
|
+
|
|
1038
|
+
### dispatch.getClient() ⇒ <code>promise</code>
|
|
1039
|
+
Get client Axios
|
|
1040
|
+
|
|
1041
|
+
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
1042
|
+
**Returns**: <code>promise</code> - return client axios
|
|
1043
|
+
**Access**: public
|
|
1044
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1045
|
+
**Example**
|
|
1046
|
+
```js
|
|
1047
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1048
|
+
```
|
|
1049
|
+
<a name="External"></a>
|
|
1050
|
+
|
|
1051
|
+
## External
|
|
1052
|
+
Class for documents, permission user
|
|
1053
|
+
|
|
1054
|
+
**Kind**: global class
|
|
1055
|
+
|
|
1056
|
+
* [External](#External)
|
|
1057
|
+
* [.context(params)](#External+context) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>array.<object></code>
|
|
1058
|
+
* [.getUploadDocumentSignedUrl(mime, authorization)](#External+getUploadDocumentSignedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1059
|
+
* [.getUploadDocumentsSignedUrl(docs, authorization)](#External+getUploadDocumentsSignedUrl) ⇒ <code>Promise.<array></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1060
|
+
* [.handle(authorization, params)](#External+handle) ⇒ <code>Promise.<boolean></code>
|
|
1061
|
+
|
|
1062
|
+
<a name="External+context"></a>
|
|
1063
|
+
|
|
1064
|
+
### external.context(params) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>array.<object></code>
|
|
1065
|
+
Create new document
|
|
1066
|
+
|
|
1067
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
1068
|
+
**Returns**: <code>Promise.<object></code> - data<code>string</code> - _id the id of the form<code>string</code> - orgId the organization id of the form<code>string</code> - authorization the unique token registered internally by the system for all the next calls to the external form APIs
|
|
1249
1069
|
The authorization is unique and is ONLY valid for this session.<code>array.<object></code> - groups the form groups to render
|
|
1070
|
+
**Access**: public
|
|
1071
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1072
|
+
|
|
1073
|
+
| Param | Type | Description |
|
|
1074
|
+
| --- | --- | --- |
|
|
1075
|
+
| params | <code>object</code> | Object for add new document |
|
|
1076
|
+
| params.id | <code>string</code> | Organization form id |
|
|
1077
|
+
|
|
1078
|
+
**Example**
|
|
1079
|
+
```js
|
|
1080
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1250
1081
|
id: '611e679741cc63168c26d7ee'
|
|
1082
|
+
```
|
|
1083
|
+
<a name="External+getUploadDocumentSignedUrl"></a>
|
|
1084
|
+
|
|
1085
|
+
### external.getUploadDocumentSignedUrl(mime, authorization) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1086
|
+
Get an upload signed url, so it will be possible to upload documents temporarily during the use of the external form
|
|
1087
|
+
|
|
1088
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
1089
|
+
**Returns**: <code>Promise.<object></code> - doc<code>string</code> - doc.mime the original mime type of the document<code>string</code> - doc.signedUrl the signed url to upload the document<code>string</code> - doc.filename the filename of the uploaded file<code>string</code> - doc.extension the extension of the filename, obtained from the mime type
|
|
1090
|
+
**Access**: public
|
|
1091
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1092
|
+
|
|
1093
|
+
| Param | Type | Description |
|
|
1094
|
+
| --- | --- | --- |
|
|
1095
|
+
| mime | <code>string</code> | the mime type of the document |
|
|
1096
|
+
| authorization | <code>string</code> | a legal authorization |
|
|
1097
|
+
|
|
1098
|
+
**Example**
|
|
1099
|
+
```js
|
|
1100
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1251
1101
|
mime: 'application/pdf'
|
|
1102
|
+
```
|
|
1103
|
+
<a name="External+getUploadDocumentsSignedUrl"></a>
|
|
1104
|
+
|
|
1105
|
+
### external.getUploadDocumentsSignedUrl(docs, authorization) ⇒ <code>Promise.<array></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1106
|
+
Get an upload signed url, for many documents. So it will be possible to upload documents temporarily during the use of the external form
|
|
1107
|
+
|
|
1108
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
1109
|
+
**Returns**: <code>Promise.<array></code> - docs<code>string</code> - docs.mime the original mime type of the document<code>string</code> - docs.signedUrl the signed url to upload the document<code>string</code> - docs.filename the filename of the uploaded file<code>string</code> - docs.extension the extension of the filename, obtained from the mime type
|
|
1110
|
+
**Access**: public
|
|
1111
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1112
|
+
|
|
1113
|
+
| Param | Type | Description |
|
|
1114
|
+
| --- | --- | --- |
|
|
1115
|
+
| docs | <code>array.<object></code> | the list of documents |
|
|
1116
|
+
| docs.mime | <code>string</code> | the mime type of the document |
|
|
1117
|
+
| authorization | <code>string</code> | a legal authorization |
|
|
1118
|
+
|
|
1119
|
+
**Example**
|
|
1120
|
+
```js
|
|
1121
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1252
1122
|
{
|
|
1253
1123
|
mime: 'application/pdf'
|
|
1254
1124
|
}
|
|
1125
|
+
```
|
|
1126
|
+
<a name="External+handle"></a>
|
|
1127
|
+
|
|
1128
|
+
### external.handle(authorization, params) ⇒ <code>Promise.<boolean></code>
|
|
1129
|
+
Handles the execution of an external form
|
|
1130
|
+
|
|
1131
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
1132
|
+
**Returns**: <code>Promise.<boolean></code> - true|false if success
|
|
1133
|
+
**Access**: public
|
|
1134
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1135
|
+
|
|
1136
|
+
| Param | Type | Description |
|
|
1137
|
+
| --- | --- | --- |
|
|
1138
|
+
| authorization | <code>string</code> | a legal authorization |
|
|
1139
|
+
| params | <code>object</code> | the parameters to handle the execution of an external form |
|
|
1140
|
+
| params.payload | <code>array.<object></code> | the payload of the external form. It should represent the form groups of the external form |
|
|
1141
|
+
| params.payload.name | <code>string</code> | the name of the group |
|
|
1142
|
+
| params.payload.fields | <code>array.<object></code> | the fields that belong to each group |
|
|
1143
|
+
| params.payload.fields.value | <code>\*</code> \| <code>Object</code> | besides all the data inside a field, it should have the value of the the field |
|
|
1144
|
+
|
|
1145
|
+
**Example**
|
|
1146
|
+
```js
|
|
1147
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1255
1148
|
payload: [
|
|
1256
1149
|
{
|
|
1257
1150
|
name: 'My Group One',
|
|
1258
1151
|
fields: [
|
|
1259
1152
|
{}
|
|
1260
1153
|
]
|
|
1261
1154
|
}
|
|
1262
1155
|
]
|
|
1263
1156
|
```
|
|
1264
1157
|
<a name="GeoLocation"></a>
|
|
1265
1158
|
|
|
@@ -1268,13 +1161,7 @@ Get geo location of the address
|
|
|
1268
1161
|
|
|
1269
1162
|
**Example**
|
|
1270
1163
|
```js
|
|
1271
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1272
|
-
const api = new API();
|
|
1273
|
-
const params = {
|
|
1274
|
-
address: 'Rua Sud Menucci, 615 - Vila Camilopolis, Santo André - SP',
|
|
1275
|
-
apiKey: 'AIzaSyC7gJFOkuT-Mel3WZbX5uKuJ1USqLVkGnY',
|
|
1276
|
-
};
|
|
1277
|
-
await api.general.geo.location(params);
|
|
1164
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1278
1165
|
address: 'Rua Sud Menucci, 615 - Vila Camilopolis, Santo André - SP',
|
|
1279
1166
|
apiKey: 'AIzaSyC7gJFOkuT-Mel3WZbX5uKuJ1USqLVkGnY',
|
|
1280
1167
|
```
|
|
1281
1168
|
<a name="Users"></a>
|
|
1282
1169
|
|
|
@@ -1306,103 +1193,244 @@ API request, user permission level
|
|
|
1306
1193
|
| options | <code>object</code> | Params of the constructor |
|
|
1307
1194
|
| options.parent | <code>object</code> | This of the pararent |
|
|
1308
1195
|
|
|
1309
|
-
<a name="
|
|
1196
|
+
<a name="Login"></a>
|
|
1310
1197
|
|
|
1311
|
-
##
|
|
1312
|
-
|
|
1198
|
+
## Login
|
|
1199
|
+
Login manager
|
|
1313
1200
|
|
|
1314
1201
|
**Kind**: global class
|
|
1315
|
-
<a name="Application+list"></a>
|
|
1316
1202
|
|
|
1317
|
-
|
|
1318
|
-
|
|
1203
|
+
* [Login](#Login)
|
|
1204
|
+
* [.facebook(params)](#Login+facebook) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1205
|
+
* [.google(params)](#Login+google) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1206
|
+
* [.apiKey(apikey)](#Login+apiKey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1207
|
+
* [.userPass(params)](#Login+userPass) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1208
|
+
* [.logout(session)](#Login+logout) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1209
|
+
* [.recover(username)](#Login+recover) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1319
1210
|
|
|
1320
|
-
|
|
1211
|
+
<a name="Login+facebook"></a>
|
|
1212
|
+
|
|
1213
|
+
### login.facebook(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1214
|
+
Login with social login Facebook
|
|
1215
|
+
|
|
1216
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1217
|
+
**Returns**: <code>promise.<object></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
|
|
1321
1218
|
**Access**: public
|
|
1322
1219
|
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1323
1220
|
|
|
1324
1221
|
| Param | Type | Description |
|
|
1325
1222
|
| --- | --- | --- |
|
|
1326
|
-
| params | <code>object</code> | Params to
|
|
1327
|
-
| params.
|
|
1328
|
-
|
|
|
1223
|
+
| params | <code>object</code> | Params to login Facebook |
|
|
1224
|
+
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
1225
|
+
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
1226
|
+
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
1329
1227
|
|
|
1330
1228
|
**Example**
|
|
1331
1229
|
```js
|
|
1332
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1333
|
-
const api = new API();
|
|
1334
|
-
const params = {
|
|
1335
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
1336
|
-
};
|
|
1337
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1338
|
-
await api.user.application.list(params, session);
|
|
1230
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1339
1231
|
```
|
|
1340
|
-
<a name="
|
|
1341
|
-
|
|
1342
|
-
## Datasource
|
|
1343
|
-
Class for user datasource access, to be used with when creating new documents
|
|
1344
|
-
|
|
1345
|
-
**Kind**: global class
|
|
1346
|
-
<a name="Datasource+autocomplete"></a>
|
|
1232
|
+
<a name="Login+google"></a>
|
|
1347
1233
|
|
|
1348
|
-
###
|
|
1349
|
-
|
|
1234
|
+
### login.google(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1235
|
+
Login with social login Google
|
|
1350
1236
|
|
|
1351
|
-
**Kind**: instance method of [<code>
|
|
1352
|
-
**Returns**: <code>promise.<
|
|
1237
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1238
|
+
**Returns**: <code>promise.<object></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
|
|
1353
1239
|
**Access**: public
|
|
1354
1240
|
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1355
1241
|
|
|
1356
1242
|
| Param | Type | Description |
|
|
1357
1243
|
| --- | --- | --- |
|
|
1358
|
-
| params | <code>object</code> | Params to
|
|
1359
|
-
| params.
|
|
1360
|
-
| params.
|
|
1361
|
-
| params.
|
|
1362
|
-
| params.dataSources.fields | <code>array.<object></code> | The document type data sources list of fields |
|
|
1363
|
-
| params.documents | <code>array.<object></code> | The document list |
|
|
1364
|
-
| params.documents._id | <code>string</code> | The document _id |
|
|
1365
|
-
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
1244
|
+
| params | <code>object</code> | Params to login Google |
|
|
1245
|
+
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
1246
|
+
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
1247
|
+
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
1366
1248
|
|
|
1367
1249
|
**Example**
|
|
1368
1250
|
```js
|
|
1369
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1370
|
-
const api = new API();
|
|
1371
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1372
|
-
const params = {
|
|
1373
|
-
orgId: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
|
|
1374
|
-
dataSources: [{}],
|
|
1375
|
-
documents: [{}]
|
|
1376
|
-
};
|
|
1377
|
-
const retData = await api.user.datasource.autocomplete(params, session);
|
|
1251
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1378
1252
|
```
|
|
1379
|
-
<a name="
|
|
1253
|
+
<a name="Login+apiKey"></a>
|
|
1380
1254
|
|
|
1381
|
-
|
|
1382
|
-
|
|
1255
|
+
### login.apiKey(apikey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1256
|
+
Login with apikey
|
|
1383
1257
|
|
|
1384
|
-
**Kind**:
|
|
1258
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1259
|
+
**Returns**: <code>promise.<object></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
|
|
1260
|
+
**Access**: public
|
|
1261
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1385
1262
|
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
* [.findById(id, session)](#Documents+findById) ⇒ <code>Promise</code>
|
|
1390
|
-
* [.find(params, session)](#Documents+find) ⇒ <code>Promise</code>
|
|
1391
|
-
* [.findByIdAndRemove(params, session)](#Documents+findByIdAndRemove) ⇒ <code>Promise.<object></code> \| <code>number</code> \| <code>array.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1392
|
-
* [.findByIdsAndRemove(params, session)](#Documents+findByIdsAndRemove) ⇒ <code>Promise.<object></code> \| <code>number</code> \| <code>array.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1393
|
-
* [.signedUrl(params, session)](#Documents+signedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1394
|
-
* [.signedUrls(params, session)](#Documents+signedUrls) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1395
|
-
* [.uploadSignedDocument(params)](#Documents+uploadSignedDocument) ⇒ <code>Promise.<boolean></code>
|
|
1396
|
-
* [.checkPrimaryKeys(params, session)](#Documents+checkPrimaryKeys) ⇒ <code>Promise.<array></code> \| <code>array.<string></code>
|
|
1397
|
-
* [.searchDocuments(params, session)](#Documents+searchDocuments) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
1263
|
+
| Param | Type | Description |
|
|
1264
|
+
| --- | --- | --- |
|
|
1265
|
+
| apikey | <code>string</code> | Access key |
|
|
1398
1266
|
|
|
1399
|
-
|
|
1267
|
+
**Example**
|
|
1268
|
+
```js
|
|
1269
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1270
|
+
```
|
|
1271
|
+
<a name="Login+userPass"></a>
|
|
1400
1272
|
|
|
1401
|
-
###
|
|
1402
|
-
|
|
1273
|
+
### login.userPass(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1274
|
+
Login with user and password
|
|
1403
1275
|
|
|
1404
|
-
**Kind**: instance method of [<code>
|
|
1405
|
-
**
|
|
1276
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1277
|
+
**Returns**: <code>promise.<object></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
|
|
1278
|
+
**Access**: public
|
|
1279
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1280
|
+
|
|
1281
|
+
| Param | Type | Description |
|
|
1282
|
+
| --- | --- | --- |
|
|
1283
|
+
| params | <code>object</code> | Object with user and password |
|
|
1284
|
+
| params.username | <code>string</code> | Username or email of the user |
|
|
1285
|
+
| params.password | <code>string</code> | Password of the user |
|
|
1286
|
+
| params.orgname | <code>string</code> | The organame of the user |
|
|
1287
|
+
|
|
1288
|
+
**Example**
|
|
1289
|
+
```js
|
|
1290
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1406
1291
|
username: 'ana.silva@gmail.com',
|
|
1407
1292
|
password: '123456'
|
|
1293
|
+
```
|
|
1294
|
+
<a name="Login+logout"></a>
|
|
1295
|
+
|
|
1296
|
+
### login.logout(session) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1297
|
+
Logout user system manager
|
|
1298
|
+
|
|
1299
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1300
|
+
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
1301
|
+
**Access**: public
|
|
1302
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1303
|
+
|
|
1304
|
+
| Param | Type | Description |
|
|
1305
|
+
| --- | --- | --- |
|
|
1306
|
+
| session | <code>string</code> | Session, token JWT |
|
|
1307
|
+
|
|
1308
|
+
**Example**
|
|
1309
|
+
```js
|
|
1310
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1311
|
+
```
|
|
1312
|
+
<a name="Login+recover"></a>
|
|
1313
|
+
|
|
1314
|
+
### login.recover(username) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1315
|
+
Recover the password
|
|
1316
|
+
|
|
1317
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1318
|
+
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
1319
|
+
**Access**: public
|
|
1320
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1321
|
+
|
|
1322
|
+
| Param | Type | Description |
|
|
1323
|
+
| --- | --- | --- |
|
|
1324
|
+
| username | <code>string</code> | The username or email |
|
|
1325
|
+
|
|
1326
|
+
**Example**
|
|
1327
|
+
```js
|
|
1328
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1329
|
+
```
|
|
1330
|
+
<a name="Session"></a>
|
|
1331
|
+
|
|
1332
|
+
## Session
|
|
1333
|
+
Session manager of the API
|
|
1334
|
+
|
|
1335
|
+
**Kind**: global class
|
|
1336
|
+
<a name="Session+information"></a>
|
|
1337
|
+
|
|
1338
|
+
### session.information(sessionId, suSessionId) ⇒ <code>Promise</code>
|
|
1339
|
+
Show information for session, thus validating the session (Valid token JWT)
|
|
1340
|
+
|
|
1341
|
+
**Kind**: instance method of [<code>Session</code>](#Session)
|
|
1342
|
+
**Access**: public
|
|
1343
|
+
|
|
1344
|
+
| Param | Type | Default | Description |
|
|
1345
|
+
| --- | --- | --- | --- |
|
|
1346
|
+
| sessionId | <code>string</code> | | The user session (JWT Token) |
|
|
1347
|
+
| suSessionId | <code>string</code> | <code>"sessionId"</code> | Given a JWT Token of a SU (SuperAdmin), allow to check session for another user. |
|
|
1348
|
+
|
|
1349
|
+
**Example**
|
|
1350
|
+
```js
|
|
1351
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1352
|
+
```
|
|
1353
|
+
<a name="Application"></a>
|
|
1354
|
+
|
|
1355
|
+
## Application
|
|
1356
|
+
Class for Applications, permission user
|
|
1357
|
+
|
|
1358
|
+
**Kind**: global class
|
|
1359
|
+
<a name="Application+list"></a>
|
|
1360
|
+
|
|
1361
|
+
### application.list(params, session) ⇒ <code>promise</code>
|
|
1362
|
+
Get the available applications for this user in this organizations
|
|
1363
|
+
|
|
1364
|
+
**Kind**: instance method of [<code>Application</code>](#Application)
|
|
1365
|
+
**Access**: public
|
|
1366
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1367
|
+
|
|
1368
|
+
| Param | Type | Description |
|
|
1369
|
+
| --- | --- | --- |
|
|
1370
|
+
| params | <code>object</code> | Params to get task |
|
|
1371
|
+
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
1372
|
+
| session | <code>string</code> | Session, token JWT |
|
|
1373
|
+
|
|
1374
|
+
**Example**
|
|
1375
|
+
```js
|
|
1376
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1408
1377
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
1378
|
+
```
|
|
1379
|
+
<a name="Datasource"></a>
|
|
1380
|
+
|
|
1381
|
+
## Datasource
|
|
1382
|
+
Class for user datasource access, to be used with when creating new documents
|
|
1383
|
+
|
|
1384
|
+
**Kind**: global class
|
|
1385
|
+
<a name="Datasource+autocomplete"></a>
|
|
1386
|
+
|
|
1387
|
+
### datasource.autocomplete(params, session) ⇒ <code>promise.<array></code> \| <code>string</code> \| <code>object</code>
|
|
1388
|
+
Method to get autocomplete data from a datasource
|
|
1389
|
+
|
|
1390
|
+
**Kind**: instance method of [<code>Datasource</code>](#Datasource)
|
|
1391
|
+
**Returns**: <code>promise.<array></code> - docs The returned documents field with autocomplete<code>string</code> - docs._id the _id of the document<code>object</code> - data.docTypeFieldsData the field values
|
|
1392
|
+
**Access**: public
|
|
1393
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1394
|
+
|
|
1395
|
+
| Param | Type | Description |
|
|
1396
|
+
| --- | --- | --- |
|
|
1397
|
+
| params | <code>object</code> | Params to add notification token |
|
|
1398
|
+
| params.orgId | <code>string</code> | The user organization _id |
|
|
1399
|
+
| params.dataSources | <code>array.<object></code> | The document type data sources information |
|
|
1400
|
+
| params.dataSources._id | <code>string</code> | The document type data sources _id |
|
|
1401
|
+
| params.dataSources.fields | <code>array.<object></code> | The document type data sources list of fields |
|
|
1402
|
+
| params.documents | <code>array.<object></code> | The document list |
|
|
1403
|
+
| params.documents._id | <code>string</code> | The document _id |
|
|
1404
|
+
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
1405
|
+
|
|
1406
|
+
**Example**
|
|
1407
|
+
```js
|
|
1408
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1409
1409
|
orgId: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
|
|
1410
1410
|
dataSources: [{}],
|
|
1411
1411
|
documents: [{}]
|
|
1412
|
+
```
|
|
1413
|
+
<a name="Documents"></a>
|
|
1414
|
+
|
|
1415
|
+
## Documents
|
|
1416
|
+
Class for documents, permission user
|
|
1417
|
+
|
|
1418
|
+
**Kind**: global class
|
|
1419
|
+
|
|
1420
|
+
* [Documents](#Documents)
|
|
1421
|
+
* [.add(params, session)](#Documents+add) ⇒ <code>Promise</code>
|
|
1422
|
+
* [.findByIdAndUpdate(id, params, session)](#Documents+findByIdAndUpdate) ⇒ <code>Promise</code>
|
|
1423
|
+
* [.findById(id, session)](#Documents+findById) ⇒ <code>Promise</code>
|
|
1424
|
+
* [.find(params, session)](#Documents+find) ⇒ <code>Promise</code>
|
|
1425
|
+
* [.findByIdAndRemove(params, session)](#Documents+findByIdAndRemove) ⇒ <code>Promise.<object></code> \| <code>number</code> \| <code>array.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1426
|
+
* [.findByIdsAndRemove(params, session)](#Documents+findByIdsAndRemove) ⇒ <code>Promise.<object></code> \| <code>number</code> \| <code>array.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1427
|
+
* [.signedUrl(params, session)](#Documents+signedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1428
|
+
* [.signedUrls(params, session)](#Documents+signedUrls) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1429
|
+
* [.uploadSignedDocument(params)](#Documents+uploadSignedDocument) ⇒ <code>Promise.<boolean></code>
|
|
1430
|
+
* [.checkPrimaryKeys(params, session)](#Documents+checkPrimaryKeys) ⇒ <code>Promise.<array></code> \| <code>array.<string></code>
|
|
1431
|
+
* [.searchDocuments(params, session)](#Documents+searchDocuments) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
1432
|
+
|
|
1433
|
+
<a name="Documents+add"></a>
|
|
1434
|
+
|
|
1435
|
+
### documents.add(params, session) ⇒ <code>Promise</code>
|
|
1436
|
+
Create new document
|
|
1437
|
+
|
|
1438
|
+
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1439
|
+
**Access**: public
|
|
1412
1440
|
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1413
1441
|
|
|
1414
1442
|
| Param | Type | Default | Description |
|
|
@@ -1436,23 +1464,7 @@ Create new document
|
|
|
1436
1464
|
|
|
1437
1465
|
**Example**
|
|
1438
1466
|
```js
|
|
1439
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1440
|
-
const api = new API();
|
|
1441
|
-
const params = {
|
|
1442
|
-
orgname: 'cloundbrasil',
|
|
1443
|
-
areaId: '5edf9f8ee896b817e45b8dac',
|
|
1444
|
-
docId: '5edf86fbe896b817e45b8da6',
|
|
1445
|
-
fileName: 'foto',
|
|
1446
|
-
type: 'image/png',
|
|
1447
|
-
name: 'Fotografia',
|
|
1448
|
-
docTypeId = '5edf9f8ee896b817e45b8dac',
|
|
1449
|
-
bytes: 12345,
|
|
1450
|
-
signedUrl: 'https://s3.amazonaws.com...'
|
|
1451
|
-
docTypeFieldsData: {extraUser: '12349f8ee896b817e45b8dac'},
|
|
1452
|
-
orgId: '5df7f19618430c89a41a19d2',
|
|
1453
|
-
};
|
|
1454
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1455
|
-
await api.user.document.add(params, session);
|
|
1467
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1456
1468
|
orgname: 'cloundbrasil',
|
|
1457
1469
|
areaId: '5edf9f8ee896b817e45b8dac',
|
|
1458
1470
|
docId: '5edf86fbe896b817e45b8da6',
|
|
1459
1471
|
fileName: 'foto',
|
|
1460
1472
|
type: 'image/png',
|
|
1461
1473
|
name: 'Fotografia',
|
|
1462
1474
|
docTypeId = '5edf9f8ee896b817e45b8dac',
|
|
1463
1475
|
bytes: 12345,
|
|
1464
1476
|
signedUrl: 'https://s3.amazonaws.com...'
|
|
1465
1477
|
docTypeFieldsData: {extraUser: '12349f8ee896b817e45b8dac'},
|
|
1466
1478
|
orgId: '5df7f19618430c89a41a19d2',
|
|
1467
1479
|
```
|
|
1468
1480
|
<a name="Documents+findByIdAndUpdate"></a>
|
|
1469
1481
|
|
|
@@ -1471,17 +1483,12 @@ Updates a document
|
|
|
1471
1483
|
|
|
1472
1484
|
**Example**
|
|
1473
1485
|
```js
|
|
1474
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1475
|
-
const api = new API();
|
|
1476
|
-
const params = { ... };
|
|
1477
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1478
|
-
await api.user.document.findByIdAndUpdate('5edf9f8ee896b817e45b8dad', params, session);
|
|
1486
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1479
1487
|
```
|
|
1480
1488
|
<a name="Documents+findById"></a>
|
|
1481
1489
|
|
|
1482
1490
|
### documents.findById(id, session) ⇒ <code>Promise</code>
|
|
1483
|
-
Updates a document.
|
|
1484
|
-
IMPORTANT: if your document has a content, it will NOT bring the content.
|
|
1491
|
+
Updates a document.
|
|
1485
1492
|
IMPORTANT: if your document has a content, it will NOT bring the content.
|
|
1486
1493
|
|
|
1487
1494
|
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1488
1495
|
**Access**: public
|
|
@@ -1494,10 +1501,7 @@ Updates a document.
|
|
|
1494
1501
|
|
|
1495
1502
|
**Example**
|
|
1496
1503
|
```js
|
|
1497
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1498
|
-
const api = new API();
|
|
1499
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1500
|
-
await api.user.document.findById('5edf9f8ee896b817e45b8dad', session);
|
|
1504
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1501
1505
|
```
|
|
1502
1506
|
<a name="Documents+find"></a>
|
|
1503
1507
|
|
|
@@ -1525,18 +1529,7 @@ await api.user.document.findById('5edf9f8ee896b817e45b8dad', session);
|
|
|
1525
1529
|
|
|
1526
1530
|
**Example**
|
|
1527
1531
|
```js
|
|
1528
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1529
|
-
const api = new API();
|
|
1530
|
-
const params - {
|
|
1531
|
-
index: 'extraCity',
|
|
1532
|
-
txtToSearch: 'São',
|
|
1533
|
-
docId: '5df7f19618430c89a41a19d2',
|
|
1534
|
-
docAreaId: '5edd11c46b6ce9729c2c297c',
|
|
1535
|
-
tag: 'Nome da cidade',
|
|
1536
|
-
orgId: '1234d01dc4af3941d42f8c5c'
|
|
1537
|
-
};
|
|
1538
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1539
|
-
await api.user.document.findByIdAndRemove(params, session);
|
|
1532
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1540
1533
|
index: 'extraCity',
|
|
1541
1534
|
txtToSearch: 'São',
|
|
1542
1535
|
docId: '5df7f19618430c89a41a19d2',
|
|
1543
1536
|
docAreaId: '5edd11c46b6ce9729c2c297c',
|
|
1544
1537
|
tag: 'Nome da cidade',
|
|
1545
1538
|
orgId: '1234d01dc4af3941d42f8c5c'
|
|
1546
1539
|
```
|
|
1547
1540
|
<a name="Documents+findByIdAndRemove"></a>
|
|
1548
1541
|
|
|
@@ -1557,14 +1550,7 @@ Remove document by id
|
|
|
1557
1550
|
|
|
1558
1551
|
**Example**
|
|
1559
1552
|
```js
|
|
1560
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1561
|
-
const api = new API();
|
|
1562
|
-
const params - {
|
|
1563
|
-
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1564
|
-
orgIdId: '5df7f19618430c89a41a19d2',
|
|
1565
|
-
};
|
|
1566
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1567
|
-
await api.user.document.findByIdAndRemove(params, session);
|
|
1553
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1568
1554
|
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1569
1555
|
orgIdId: '5df7f19618430c89a41a19d2',
|
|
1570
1556
|
```
|
|
1571
1557
|
<a name="Documents+findByIdsAndRemove"></a>
|
|
1572
1558
|
|
|
@@ -1586,14 +1572,7 @@ Remove documents
|
|
|
1586
1572
|
|
|
1587
1573
|
**Example**
|
|
1588
1574
|
```js
|
|
1589
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1590
|
-
const api = new API();
|
|
1591
|
-
const params - {
|
|
1592
|
-
documents: [{ _id: '5dadd01dc4af3941d42f8c5c' }],
|
|
1593
|
-
orgId: '5df7f19618430c89a41a19d2',
|
|
1594
|
-
};
|
|
1595
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1596
|
-
await api.user.document.findByIdsAndRemove(params, session);
|
|
1575
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1597
1576
|
documents: [{ _id: '5dadd01dc4af3941d42f8c5c' }],
|
|
1598
1577
|
orgId: '5df7f19618430c89a41a19d2',
|
|
1599
1578
|
```
|
|
1600
1579
|
<a name="Documents+signedUrl"></a>
|
|
1601
1580
|
|
|
@@ -1619,30 +1598,11 @@ Request signed url url to put or get
|
|
|
1619
1598
|
|
|
1620
1599
|
**Example**
|
|
1621
1600
|
```js
|
|
1622
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1623
|
-
const api = new API();
|
|
1624
|
-
const params - {
|
|
1625
|
-
methodType: 'put',
|
|
1626
|
-
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1627
|
-
docAreaId: '5df7f19618430c89a41a19d2',
|
|
1628
|
-
fileName: 'Foto',
|
|
1629
|
-
type: 'image/png'
|
|
1630
|
-
orgId: '5df7f19618430c89a41a19f8'
|
|
1631
|
-
};
|
|
1632
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1633
|
-
// each doc: { docId, name, areaId, type, signedUrl }
|
|
1634
|
-
const { docs } = await api.user.document.signedUrl(params, session);
|
|
1601
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1635
1602
|
methodType: 'put',
|
|
1636
1603
|
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1637
1604
|
docAreaId: '5df7f19618430c89a41a19d2',
|
|
1638
1605
|
fileName: 'Foto',
|
|
1639
1606
|
type: 'image/png'
|
|
1640
1607
|
orgId: '5df7f19618430c89a41a19f8'
|
|
1641
1608
|
```
|
|
1642
1609
|
**Example**
|
|
1643
1610
|
```js
|
|
1644
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1645
|
-
const api = new API();
|
|
1646
|
-
const params - {
|
|
1647
|
-
methodType: 'get',
|
|
1648
|
-
document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf',
|
|
1649
|
-
};
|
|
1650
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1651
|
-
const base64Data = await api.user.document.signedUrl(params, session);
|
|
1611
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1652
1612
|
methodType: 'get',
|
|
1653
1613
|
document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf',
|
|
1654
1614
|
```
|
|
1655
1615
|
<a name="Documents+signedUrls"></a>
|
|
1656
1616
|
|
|
@@ -1669,36 +1629,11 @@ Request signed url url to put or get
|
|
|
1669
1629
|
|
|
1670
1630
|
**Example**
|
|
1671
1631
|
```js
|
|
1672
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1673
|
-
const api = new API();
|
|
1674
|
-
const params - {
|
|
1675
|
-
methodType: 'put',
|
|
1676
|
-
orgId: '5df7f19618430c89a41a19f8'
|
|
1677
|
-
docs: [
|
|
1678
|
-
{
|
|
1679
|
-
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1680
|
-
areaId: '5df7f19618430c89a41a19d2',
|
|
1681
|
-
name: 'Foto.png',
|
|
1682
|
-
type: 'image/png'
|
|
1683
|
-
}
|
|
1684
|
-
]
|
|
1685
|
-
};
|
|
1686
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1687
|
-
// each doc: { docId, name, areaId, type, signedUrl }
|
|
1688
|
-
const { docs } = await api.user.document.signedUrls(params, session);
|
|
1689
|
-
```
|
|
1690
|
-
**Example**
|
|
1691
|
-
```js
|
|
1692
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1693
|
-
const api = new API();
|
|
1694
|
-
const params - {
|
|
1695
|
-
methodType: 'get',
|
|
1696
|
-
docs: [
|
|
1697
|
-
{ document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf' }
|
|
1698
|
-
],
|
|
1699
|
-
};
|
|
1700
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1701
|
-
const base64Data = await api.user.document.signedUrls(params, session);
|
|
1632
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1702
1633
|
methodType: 'put',
|
|
1703
1634
|
orgId: '5df7f19618430c89a41a19f8'
|
|
1704
1635
|
docs: [
|
|
1705
1636
|
{
|
|
1706
1637
|
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1707
1638
|
areaId: '5df7f19618430c89a41a19d2',
|
|
1708
1639
|
name: 'Foto.png',
|
|
1709
1640
|
type: 'image/png'
|
|
1710
1641
|
}
|
|
1711
1642
|
]
|
|
1643
|
+
```
|
|
1644
|
+
**Example**
|
|
1645
|
+
```js
|
|
1646
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1712
1647
|
methodType: 'get',
|
|
1713
1648
|
docs: [
|
|
1714
1649
|
{ document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf' }
|
|
1715
1650
|
],
|
|
1716
1651
|
```
|
|
1717
1652
|
<a name="Documents+uploadSignedDocument"></a>
|
|
1718
1653
|
|
|
@@ -1719,21 +1654,7 @@ Uploads the file
|
|
|
1719
1654
|
|
|
1720
1655
|
**Example**
|
|
1721
1656
|
```js
|
|
1722
|
-
const FS = require('fs');
|
|
1723
|
-
const Path = require('path');
|
|
1724
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1725
|
-
const api = new API();
|
|
1726
|
-
const params - {
|
|
1727
|
-
content: FS.readFileSync(Path.join(__dirname, '.mypdf.pdf')),
|
|
1728
|
-
signedUrl: 'https://signedurl.com/token...',
|
|
1729
|
-
type: 'application/pdf'
|
|
1730
|
-
};
|
|
1731
|
-
const retData = await api.user.document.uploadSignedDocument(params);
|
|
1732
|
-
|
|
1733
|
-
onUploadProgress return the progressEvent
|
|
1734
|
-
- lengthComputable: A Boolean that indicates whether or not the total number of bytes is known.
|
|
1735
|
-
- loaded: The number of bytes of the file that have been uploaded.
|
|
1736
|
-
- total: The total number of bytes in the file.
|
|
1657
|
+
const FS = require('fs');
|
|
1737
1658
|
content: FS.readFileSync(Path.join(__dirname, '.mypdf.pdf')),
|
|
1738
1659
|
signedUrl: 'https://signedurl.com/token...',
|
|
1739
1660
|
type: 'application/pdf'
|
|
1740
1661
|
- lengthComputable: A Boolean that indicates whether or not the total number of bytes is known.
|
|
1741
1662
|
- loaded: The number of bytes of the file that have been uploaded.
|
|
1742
1663
|
- total: The total number of bytes in the file.
|
|
1743
1664
|
```
|
|
1744
1665
|
<a name="Documents+checkPrimaryKeys"></a>
|
|
1745
1666
|
|
|
@@ -1741,8 +1662,7 @@ onUploadProgress return the progressEvent
|
|
|
1741
1662
|
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1742
1663
|
**Returns**: <code>Promise.<array></code> - Return the array of the documents that are repeated. If not document is repeaded, then if returns an empty array.<code>array.<string></code> - id the id of the repeated document
|
|
1743
1664
|
**Access**: public
|
|
1744
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1745
|
-
Checks if a document can be added and it does not repeat its primary key
|
|
1665
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1746
1666
|
|
|
1747
1667
|
| Param | Type | Description |
|
|
1748
1668
|
| --- | --- | --- |
|
|
@@ -1757,17 +1677,7 @@ Checks if a document can be added and it does not repeat its primary key
|
|
|
1757
1677
|
|
|
1758
1678
|
**Example**
|
|
1759
1679
|
```js
|
|
1760
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1761
|
-
const api = new API();
|
|
1762
|
-
const docTypeFields = [...]; // the doc type fields array
|
|
1763
|
-
const docTypeFieldsData = {...}; // the data of this fields
|
|
1764
|
-
const params - {
|
|
1765
|
-
docs: [{ id: '5dadd01dc4af3941d42f8c5c', docTypeFields, docTypeFieldsData }],
|
|
1766
|
-
orgId: '5df7f19618430c89a41a19d2',
|
|
1767
|
-
docTypeId: '5df7f19618430c89a41a19d5',
|
|
1768
|
-
};
|
|
1769
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1770
|
-
const retDocs = await api.user.document.checkPrimaryKeys(params, session);
|
|
1680
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1771
1681
|
docs: [{ id: '5dadd01dc4af3941d42f8c5c', docTypeFields, docTypeFieldsData }],
|
|
1772
1682
|
orgId: '5df7f19618430c89a41a19d2',
|
|
1773
1683
|
docTypeId: '5df7f19618430c89a41a19d5',
|
|
1774
1684
|
```
|
|
1775
1685
|
<a name="Documents+searchDocuments"></a>
|
|
1776
1686
|
|
|
@@ -1788,14 +1698,7 @@ Method to search documents for
|
|
|
1788
1698
|
|
|
1789
1699
|
**Example**
|
|
1790
1700
|
```js
|
|
1791
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1792
|
-
const api = new API();
|
|
1793
|
-
const params = {
|
|
1794
|
-
query: {p: 20, i: 1, s: 'Mais recentes', as: '', m: 'w', ai: '57e6a3bd6be6b45210833fae'},
|
|
1795
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
1796
|
-
};
|
|
1797
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1798
|
-
const retSearch = await api.user.document.searchDocuments(params, session);
|
|
1701
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1799
1702
|
query: {p: 20, i: 1, s: 'Mais recentes', as: '', m: 'w', ai: '57e6a3bd6be6b45210833fae'},
|
|
1800
1703
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
1801
1704
|
```
|
|
1802
1705
|
<a name="Help"></a>
|
|
1803
1706
|
|
|
@@ -1823,10 +1726,7 @@ get heps topics
|
|
|
1823
1726
|
|
|
1824
1727
|
**Example**
|
|
1825
1728
|
```js
|
|
1826
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1827
|
-
const api = new API();
|
|
1828
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1829
|
-
await api.user.help.getTopics(session);
|
|
1729
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1830
1730
|
```
|
|
1831
1731
|
<a name="Help+get"></a>
|
|
1832
1732
|
|
|
@@ -1845,13 +1745,7 @@ Method to find helps from a topic
|
|
|
1845
1745
|
|
|
1846
1746
|
**Example**
|
|
1847
1747
|
```js
|
|
1848
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1849
|
-
const api = new API();
|
|
1850
|
-
const params = {
|
|
1851
|
-
id: '5dadd01dc4af3941d42f8c5c'
|
|
1852
|
-
};
|
|
1853
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1854
|
-
await api.user.help.get(params, session);
|
|
1748
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1855
1749
|
id: '5dadd01dc4af3941d42f8c5c'
|
|
1856
1750
|
```
|
|
1857
1751
|
<a name="Users"></a>
|
|
1858
1752
|
|
|
@@ -1897,6 +1791,8 @@ Class for my tasks, permission user
|
|
|
1897
1791
|
* [.getTaskMultiUsers(params, session)](#MyTasks+getTaskMultiUsers) ⇒ <code>promise</code>
|
|
1898
1792
|
* [.removeMultiTaskUser(params, session)](#MyTasks+removeMultiTaskUser) ⇒ <code>Promise</code>
|
|
1899
1793
|
* [.addMultiTaskUser(params, session)](#MyTasks+addMultiTaskUser) ⇒ <code>Promise</code>
|
|
1794
|
+
* [.getAssignTaskUsers(params, session)](#MyTasks+getAssignTaskUsers) ⇒ <code>promise</code>
|
|
1795
|
+
* [.assignTaskUsers(params, session)](#MyTasks+assignTaskUsers) ⇒ <code>Promise</code>
|
|
1900
1796
|
|
|
1901
1797
|
<a name="MyTasks+find"></a>
|
|
1902
1798
|
|
|
@@ -1917,14 +1813,7 @@ Method to find my tasks for a user
|
|
|
1917
1813
|
|
|
1918
1814
|
**Example**
|
|
1919
1815
|
```js
|
|
1920
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1921
|
-
const api = new API();
|
|
1922
|
-
const params = {
|
|
1923
|
-
query: {"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
1924
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
1925
|
-
};
|
|
1926
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1927
|
-
const retSearch = await api.user.task.mytasks.find(params, session);
|
|
1816
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1928
1817
|
query: {"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
1929
1818
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
1930
1819
|
```
|
|
1931
1820
|
<a name="MyTasks+saveDueDate"></a>
|
|
1932
1821
|
|
|
@@ -1945,15 +1834,7 @@ Update task dueDate
|
|
|
1945
1834
|
|
|
1946
1835
|
**Example**
|
|
1947
1836
|
```js
|
|
1948
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1949
|
-
const api = new API();
|
|
1950
|
-
const params = {
|
|
1951
|
-
dueDate: '2011-10-05T14:48:00.000Z',
|
|
1952
|
-
orgId: '646386c9583e04a131adc894',
|
|
1953
|
-
taskId: '646386c9583e04a131adc895'
|
|
1954
|
-
};
|
|
1955
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1956
|
-
await api.user.task.mytasks.saveDueDate(params, session);
|
|
1837
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1957
1838
|
dueDate: '2011-10-05T14:48:00.000Z',
|
|
1958
1839
|
orgId: '646386c9583e04a131adc894',
|
|
1959
1840
|
taskId: '646386c9583e04a131adc895'
|
|
1960
1841
|
```
|
|
1961
1842
|
<a name="MyTasks+removeDueDate"></a>
|
|
1962
1843
|
|
|
@@ -1972,14 +1853,7 @@ Update task dueDate
|
|
|
1972
1853
|
|
|
1973
1854
|
**Example**
|
|
1974
1855
|
```js
|
|
1975
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1976
|
-
const api = new API();
|
|
1977
|
-
const params = {
|
|
1978
|
-
orgId: '646386c9583e04a131adc894',
|
|
1979
|
-
taskId: '646386c9583e04a131adc895'
|
|
1980
|
-
};
|
|
1981
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1982
|
-
await api.user.task.mytasks.removeDueDate(params, session);
|
|
1856
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1983
1857
|
orgId: '646386c9583e04a131adc894',
|
|
1984
1858
|
taskId: '646386c9583e04a131adc895'
|
|
1985
1859
|
```
|
|
1986
1860
|
<a name="MyTasks+getTaskMultiUsers"></a>
|
|
1987
1861
|
|
|
@@ -1999,14 +1873,7 @@ Method to get task multi users
|
|
|
1999
1873
|
|
|
2000
1874
|
**Example**
|
|
2001
1875
|
```js
|
|
2002
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2003
|
-
const api = new API();
|
|
2004
|
-
const params = {
|
|
2005
|
-
taskId: '5df7f19618430c89a41a19d2',
|
|
2006
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2007
|
-
};
|
|
2008
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2009
|
-
await api.user.task.mytasks.getTaskMultiUsers(params, session);
|
|
1876
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2010
1877
|
taskId: '5df7f19618430c89a41a19d2',
|
|
2011
1878
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2012
1879
|
```
|
|
2013
1880
|
<a name="MyTasks+removeMultiTaskUser"></a>
|
|
2014
1881
|
|
|
@@ -2027,15 +1894,7 @@ remove multi task user
|
|
|
2027
1894
|
|
|
2028
1895
|
**Example**
|
|
2029
1896
|
```js
|
|
2030
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2031
|
-
const api = new API();
|
|
2032
|
-
const params = {
|
|
2033
|
-
userId: '646386c9583e04a131adc896',
|
|
2034
|
-
orgId: '646386c9583e04a131adc894',
|
|
2035
|
-
taskId: '646386c9583e04a131adc895'
|
|
2036
|
-
};
|
|
2037
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2038
|
-
await api.user.task.mytasks.removeMultiTaskUser(params, session);
|
|
1897
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2039
1898
|
userId: '646386c9583e04a131adc896',
|
|
2040
1899
|
orgId: '646386c9583e04a131adc894',
|
|
2041
1900
|
taskId: '646386c9583e04a131adc895'
|
|
2042
1901
|
```
|
|
2043
1902
|
<a name="MyTasks+addMultiTaskUser"></a>
|
|
2044
1903
|
|
|
@@ -2056,15 +1915,48 @@ Add Multi Task User
|
|
|
2056
1915
|
|
|
2057
1916
|
**Example**
|
|
2058
1917
|
```js
|
|
2059
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2060
|
-
const api = new API();
|
|
2061
|
-
const params = {
|
|
2062
|
-
userId: '646386c9583e04a131adc8946',
|
|
2063
|
-
orgId: '646386c9583e04a131adc894',
|
|
2064
|
-
taskId: '646386c9583e04a131adc895'
|
|
2065
|
-
};
|
|
2066
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2067
|
-
await api.user.task.mytasks.addMultiTaskUser(params, session);
|
|
1918
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2068
1919
|
userId: '646386c9583e04a131adc8946',
|
|
2069
1920
|
orgId: '646386c9583e04a131adc894',
|
|
2070
1921
|
taskId: '646386c9583e04a131adc895'
|
|
1922
|
+
```
|
|
1923
|
+
<a name="MyTasks+getAssignTaskUsers"></a>
|
|
1924
|
+
|
|
1925
|
+
### myTasks.getAssignTaskUsers(params, session) ⇒ <code>promise</code>
|
|
1926
|
+
Method to get assign task users
|
|
1927
|
+
|
|
1928
|
+
**Kind**: instance method of [<code>MyTasks</code>](#MyTasks)
|
|
1929
|
+
**Access**: public
|
|
1930
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1931
|
+
|
|
1932
|
+
| Param | Type | Description |
|
|
1933
|
+
| --- | --- | --- |
|
|
1934
|
+
| params | <code>object</code> | Params to get task |
|
|
1935
|
+
| params.taskId | <code>object</code> | Task id (_id database) |
|
|
1936
|
+
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
1937
|
+
| session | <code>string</code> | Session, token JWT |
|
|
1938
|
+
|
|
1939
|
+
**Example**
|
|
1940
|
+
```js
|
|
1941
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2071
1942
|
taskId: '5df7f19618430c89a41a19d2',
|
|
2072
1943
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
1944
|
+
```
|
|
1945
|
+
<a name="MyTasks+assignTaskUsers"></a>
|
|
1946
|
+
|
|
1947
|
+
### myTasks.assignTaskUsers(params, session) ⇒ <code>Promise</code>
|
|
1948
|
+
Assign Task user
|
|
1949
|
+
|
|
1950
|
+
**Kind**: instance method of [<code>MyTasks</code>](#MyTasks)
|
|
1951
|
+
**Access**: public
|
|
1952
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1953
|
+
|
|
1954
|
+
| Param | Type | Description |
|
|
1955
|
+
| --- | --- | --- |
|
|
1956
|
+
| params | <code>object</code> | The params to assign task to user |
|
|
1957
|
+
| params.orgName | <code>string</code> | Organization Name |
|
|
1958
|
+
| params.userId | <code>string</code> | User id that will be assigned the task |
|
|
1959
|
+
| params.taskId | <code>string</code> | Task Id |
|
|
1960
|
+
| session | <code>string</code> | Is token JWT of user |
|
|
1961
|
+
|
|
1962
|
+
**Example**
|
|
1963
|
+
```js
|
|
1964
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2073
1965
|
orgName: 'pinkbrain',
|
|
2074
1966
|
userId: '646386c9583e04a131adc894',
|
|
2075
1967
|
taskId: '646386c9583e04a131adc895'
|
|
2076
1968
|
```
|
|
2077
1969
|
<a name="Notification"></a>
|
|
2078
1970
|
|
|
@@ -2106,14 +1998,7 @@ Method to add a notification token
|
|
|
2106
1998
|
|
|
2107
1999
|
**Example**
|
|
2108
2000
|
```js
|
|
2109
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2110
|
-
const api = new API();
|
|
2111
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2112
|
-
const params = {
|
|
2113
|
-
token: 'V6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz2',
|
|
2114
|
-
type: 'FCM_WEB'
|
|
2115
|
-
};
|
|
2116
|
-
const retData = await api.user.notification.addToken(params, session);
|
|
2001
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2117
2002
|
token: 'V6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz2',
|
|
2118
2003
|
type: 'FCM_WEB'
|
|
2119
2004
|
```
|
|
2120
2005
|
<a name="Notification+getNew"></a>
|
|
2121
2006
|
|
|
@@ -2130,10 +2015,7 @@ get new notifications
|
|
|
2130
2015
|
|
|
2131
2016
|
**Example**
|
|
2132
2017
|
```js
|
|
2133
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2134
|
-
const api = new API();
|
|
2135
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2136
|
-
await api.user.notification.getNew(session);
|
|
2018
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2137
2019
|
```
|
|
2138
2020
|
<a name="Notification+getOld"></a>
|
|
2139
2021
|
|
|
@@ -2150,10 +2032,7 @@ get old notifications
|
|
|
2150
2032
|
|
|
2151
2033
|
**Example**
|
|
2152
2034
|
```js
|
|
2153
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2154
|
-
const api = new API();
|
|
2155
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2156
|
-
await api.user.notification.getOld(session);
|
|
2035
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2157
2036
|
```
|
|
2158
2037
|
<a name="Notification+setRead"></a>
|
|
2159
2038
|
|
|
@@ -2172,13 +2051,7 @@ Set notification as readed
|
|
|
2172
2051
|
|
|
2173
2052
|
**Example**
|
|
2174
2053
|
```js
|
|
2175
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2176
|
-
const api = new API();
|
|
2177
|
-
const params = {
|
|
2178
|
-
id: '34c344c43c34c344c43c'
|
|
2179
|
-
};
|
|
2180
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2181
|
-
await api.user.notification.setRead(params, session);
|
|
2054
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2182
2055
|
id: '34c344c43c34c344c43c'
|
|
2183
2056
|
```
|
|
2184
2057
|
<a name="Notification+setUnread"></a>
|
|
2185
2058
|
|
|
@@ -2197,13 +2070,7 @@ Set notification as unreaded
|
|
|
2197
2070
|
|
|
2198
2071
|
**Example**
|
|
2199
2072
|
```js
|
|
2200
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2201
|
-
const api = new API();
|
|
2202
|
-
const params = {
|
|
2203
|
-
id: '34c344c43c34c344c43c'
|
|
2204
|
-
};
|
|
2205
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2206
|
-
await api.user.notification.setUnread(params, session);
|
|
2073
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2207
2074
|
id: '34c344c43c34c344c43c'
|
|
2208
2075
|
```
|
|
2209
2076
|
<a name="Organization"></a>
|
|
2210
2077
|
|
|
@@ -2240,15 +2107,7 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
2240
2107
|
|
|
2241
2108
|
**Example**
|
|
2242
2109
|
```js
|
|
2243
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2244
|
-
const api = new API();
|
|
2245
|
-
const params = {
|
|
2246
|
-
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
2247
|
-
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
2248
|
-
type: 'image/png',
|
|
2249
|
-
};
|
|
2250
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2251
|
-
await api.admin.organizations.upsertAvatar(params, session);
|
|
2110
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2252
2111
|
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
2253
2112
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
2254
2113
|
type: 'image/png',
|
|
2255
2114
|
```
|
|
2256
2115
|
<a name="Organization+removeAvatar"></a>
|
|
2257
2116
|
|
|
@@ -2266,11 +2125,7 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
2266
2125
|
|
|
2267
2126
|
**Example**
|
|
2268
2127
|
```js
|
|
2269
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2270
|
-
const api = new API();
|
|
2271
|
-
const orgId = '5dadd01dc4af3941d42f8c5c';
|
|
2272
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2273
|
-
await api.admin.organizations.removeAvatar(orgId, session);
|
|
2128
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2274
2129
|
```
|
|
2275
2130
|
<a name="Organization+findById"></a>
|
|
2276
2131
|
|
|
@@ -2288,11 +2143,7 @@ Find organization by id
|
|
|
2288
2143
|
|
|
2289
2144
|
**Example**
|
|
2290
2145
|
```js
|
|
2291
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2292
|
-
const api = new API();
|
|
2293
|
-
const orgId = '80443245000122';
|
|
2294
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2295
|
-
await api.user.organization.findById(idCard, session);
|
|
2146
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2296
2147
|
```
|
|
2297
2148
|
<a name="Organization+idCardExist"></a>
|
|
2298
2149
|
|
|
@@ -2310,11 +2161,7 @@ Check if id card exist
|
|
|
2310
2161
|
|
|
2311
2162
|
**Example**
|
|
2312
2163
|
```js
|
|
2313
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2314
|
-
const api = new API();
|
|
2315
|
-
const idCard = '80443245000122';
|
|
2316
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2317
|
-
await api.user.organization.idCardExist(idCard, session);
|
|
2164
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2318
2165
|
```
|
|
2319
2166
|
<a name="Organization+upsertAvatar"></a>
|
|
2320
2167
|
|
|
@@ -2334,14 +2181,7 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
2334
2181
|
|
|
2335
2182
|
**Example**
|
|
2336
2183
|
```js
|
|
2337
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2338
|
-
const api = new API();
|
|
2339
|
-
const params = {
|
|
2340
|
-
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
2341
|
-
type: 'image/png',
|
|
2342
|
-
};
|
|
2343
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2344
|
-
await api.user.profile.updateAvatar(params, session);
|
|
2184
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2345
2185
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
2346
2186
|
type: 'image/png',
|
|
2347
2187
|
```
|
|
2348
2188
|
<a name="Organization+removeAvatar"></a>
|
|
2349
2189
|
|
|
@@ -2358,10 +2198,7 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
2358
2198
|
|
|
2359
2199
|
**Example**
|
|
2360
2200
|
```js
|
|
2361
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2362
|
-
const api = new API();
|
|
2363
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2364
|
-
await api.user.profile.removeAvatar(session);
|
|
2201
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2365
2202
|
```
|
|
2366
2203
|
<a name="Organization+callFetch"></a>
|
|
2367
2204
|
|
|
@@ -2381,14 +2218,7 @@ Call URL internal, need auth JWT (session)
|
|
|
2381
2218
|
|
|
2382
2219
|
**Example**
|
|
2383
2220
|
```js
|
|
2384
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2385
|
-
const api = new API();
|
|
2386
|
-
|
|
2387
|
-
const params = {
|
|
2388
|
-
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
2389
|
-
method: 'POST'
|
|
2390
|
-
}
|
|
2391
|
-
await api.user.organization.callFetchs(params, session);
|
|
2221
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2392
2222
|
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
2393
2223
|
method: 'POST'
|
|
2394
2224
|
```
|
|
2395
2225
|
<a name="Page"></a>
|
|
2396
2226
|
|
|
@@ -2415,15 +2245,7 @@ Get the available page for an application inside an organization
|
|
|
2415
2245
|
|
|
2416
2246
|
**Example**
|
|
2417
2247
|
```js
|
|
2418
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2419
|
-
const api = new API();
|
|
2420
|
-
const params = {
|
|
2421
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2422
|
-
appId: '57e4a3bd6be6b45210833fa7',
|
|
2423
|
-
pageId: '57e4a3bd6be6b45210833fab'
|
|
2424
|
-
};
|
|
2425
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2426
|
-
await api.user.application.page.get(params, session);
|
|
2248
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2427
2249
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2428
2250
|
appId: '57e4a3bd6be6b45210833fa7',
|
|
2429
2251
|
pageId: '57e4a3bd6be6b45210833fab'
|
|
2430
2252
|
```
|
|
2431
2253
|
<a name="Process"></a>
|
|
2432
2254
|
|
|
@@ -2462,15 +2284,7 @@ Start process
|
|
|
2462
2284
|
|
|
2463
2285
|
**Example**
|
|
2464
2286
|
```js
|
|
2465
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2466
|
-
const api = new API();
|
|
2467
|
-
const params = {
|
|
2468
|
-
orgProcessId: '5dadd01dc4af3941d42f8c5c',
|
|
2469
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2470
|
-
payload: {}
|
|
2471
|
-
}
|
|
2472
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2473
|
-
await api.user.process.start(params, session);
|
|
2287
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2474
2288
|
orgProcessId: '5dadd01dc4af3941d42f8c5c',
|
|
2475
2289
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2476
2290
|
payload: {}
|
|
2477
2291
|
```
|
|
2478
2292
|
<a name="Process+getProcessProperties"></a>
|
|
2479
2293
|
|
|
@@ -2490,14 +2304,7 @@ Get process properties of process
|
|
|
2490
2304
|
|
|
2491
2305
|
**Example**
|
|
2492
2306
|
```js
|
|
2493
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2494
|
-
const api = new API();
|
|
2495
|
-
const params = {
|
|
2496
|
-
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2497
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2498
|
-
}
|
|
2499
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2500
|
-
await api.user.process.getProcessProperties(params, session);
|
|
2307
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2501
2308
|
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2502
2309
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2503
2310
|
```
|
|
2504
2311
|
<a name="Process+getOrgProcessSearchInfo"></a>
|
|
2505
2312
|
|
|
@@ -2505,8 +2312,7 @@ await api.user.process.getProcessProperties(params, session);
|
|
|
2505
2312
|
Get the search info of a organization process
|
|
2506
2313
|
|
|
2507
2314
|
**Kind**: instance method of [<code>Process</code>](#Process)
|
|
2508
|
-
**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
|
|
2509
|
-
@
|
|
2315
|
+
**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
|
|
2510
2316
|
**Access**: public
|
|
2511
2317
|
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2512
2318
|
|
|
@@ -2519,14 +2325,7 @@ Get the search info of a organization process
|
|
|
2519
2325
|
|
|
2520
2326
|
**Example**
|
|
2521
2327
|
```js
|
|
2522
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2523
|
-
const api = new API();
|
|
2524
|
-
const params = {
|
|
2525
|
-
orgProcessId: '5dadd01dc4af3941d42f8c67',
|
|
2526
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2527
|
-
}
|
|
2528
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2529
|
-
const retSearchInfo = await api.user.process.getOrgProcessSearchInfo(params, session);
|
|
2328
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2530
2329
|
orgProcessId: '5dadd01dc4af3941d42f8c67',
|
|
2531
2330
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2532
2331
|
```
|
|
2533
2332
|
<a name="Process+find"></a>
|
|
2534
2333
|
|
|
@@ -2547,14 +2346,7 @@ Method to search processes
|
|
|
2547
2346
|
|
|
2548
2347
|
**Example**
|
|
2549
2348
|
```js
|
|
2550
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2551
|
-
const api = new API();
|
|
2552
|
-
const params = {
|
|
2553
|
-
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2554
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2555
|
-
};
|
|
2556
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2557
|
-
const retSearch = await api.user.process.find(params, session);
|
|
2349
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2558
2350
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2559
2351
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2560
2352
|
```
|
|
2561
2353
|
<a name="Process+remove"></a>
|
|
2562
2354
|
|
|
@@ -2574,14 +2366,7 @@ Method to remove process
|
|
|
2574
2366
|
|
|
2575
2367
|
**Example**
|
|
2576
2368
|
```js
|
|
2577
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2578
|
-
const api = new API();
|
|
2579
|
-
const params = {
|
|
2580
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2581
|
-
processId: '55e4a3bd6be6b45210833fae'
|
|
2582
|
-
};
|
|
2583
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2584
|
-
const retSearch = await api.user.process.remove(params, session);
|
|
2369
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2585
2370
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2586
2371
|
processId: '55e4a3bd6be6b45210833fae'
|
|
2587
2372
|
```
|
|
2588
2373
|
<a name="Process+exportStatusData"></a>
|
|
2589
2374
|
|
|
@@ -2601,14 +2386,7 @@ Method to export status data
|
|
|
2601
2386
|
|
|
2602
2387
|
**Example**
|
|
2603
2388
|
```js
|
|
2604
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2605
|
-
const api = new API();
|
|
2606
|
-
const params = {
|
|
2607
|
-
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2608
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2609
|
-
};
|
|
2610
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2611
|
-
const retSearch = await api.user.process.exportStatusData(params, session);
|
|
2389
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2612
2390
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2613
2391
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2614
2392
|
```
|
|
2615
2393
|
<a name="Process+exportProcessData"></a>
|
|
2616
2394
|
|
|
@@ -2628,14 +2406,7 @@ Method to export process data
|
|
|
2628
2406
|
|
|
2629
2407
|
**Example**
|
|
2630
2408
|
```js
|
|
2631
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2632
|
-
const api = new API();
|
|
2633
|
-
const params = {
|
|
2634
|
-
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2635
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2636
|
-
};
|
|
2637
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2638
|
-
const retSearch = await api.user.process.exportProcessData(params, session);
|
|
2409
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2639
2410
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2640
2411
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2641
2412
|
```
|
|
2642
2413
|
<a name="Process+processDocs"></a>
|
|
2643
2414
|
|
|
@@ -2657,15 +2428,7 @@ Method to get Process Docs
|
|
|
2657
2428
|
|
|
2658
2429
|
**Example**
|
|
2659
2430
|
```js
|
|
2660
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2661
|
-
const api = new API();
|
|
2662
|
-
const params = {
|
|
2663
|
-
orgProcessId: '55e4a3bd6be6b45210833fae',
|
|
2664
|
-
processId: '55e4a3bd6be6b45210833fae',
|
|
2665
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2666
|
-
};
|
|
2667
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2668
|
-
const retSearch = await api.user.process.processDocs(params, session);
|
|
2431
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2669
2432
|
orgProcessId: '55e4a3bd6be6b45210833fae',
|
|
2670
2433
|
processId: '55e4a3bd6be6b45210833fae',
|
|
2671
2434
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2672
2435
|
```
|
|
2673
2436
|
<a name="Process+downloadDocs"></a>
|
|
2674
2437
|
|
|
@@ -2688,16 +2451,7 @@ Method to download the process documents
|
|
|
2688
2451
|
|
|
2689
2452
|
**Example**
|
|
2690
2453
|
```js
|
|
2691
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2692
|
-
const api = new API();
|
|
2693
|
-
const params = {
|
|
2694
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2695
|
-
type: 'Docs',
|
|
2696
|
-
docIds: ['55e4a3bd6be6b45210833fae'],
|
|
2697
|
-
footer: 'Documento - {page} de {pages}'
|
|
2698
|
-
};
|
|
2699
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2700
|
-
const result = await api.user.process.downloadDocs(params, session);
|
|
2454
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2701
2455
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2702
2456
|
type: 'Docs',
|
|
2703
2457
|
docIds: ['55e4a3bd6be6b45210833fae'],
|
|
2704
2458
|
footer: 'Documento - {page} de {pages}'
|
|
2705
2459
|
```
|
|
2706
2460
|
<a name="Register"></a>
|
|
2707
2461
|
|
|
@@ -2725,12 +2479,7 @@ Class for user registration in a user
|
|
|
2725
2479
|
|
|
2726
2480
|
**Example**
|
|
2727
2481
|
```js
|
|
2728
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2729
|
-
const api = new API();
|
|
2730
|
-
const params = {
|
|
2731
|
-
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...'
|
|
2732
|
-
};
|
|
2733
|
-
const orgname = await api.user.register.getOrgname(params);
|
|
2482
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2734
2483
|
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...'
|
|
2735
2484
|
```
|
|
2736
2485
|
<a name="Register+validateEmail"></a>
|
|
2737
2486
|
|
|
@@ -2750,13 +2499,7 @@ Method to find task by id
|
|
|
2750
2499
|
|
|
2751
2500
|
**Example**
|
|
2752
2501
|
```js
|
|
2753
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2754
|
-
const api = new API();
|
|
2755
|
-
const params = {
|
|
2756
|
-
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2757
|
-
email: 'myemail@company.com'
|
|
2758
|
-
};
|
|
2759
|
-
const retData = await api.user.register.validateEmail(params);
|
|
2502
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2760
2503
|
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2761
2504
|
email: 'myemail@company.com'
|
|
2762
2505
|
```
|
|
2763
2506
|
<a name="Register+execute"></a>
|
|
2764
2507
|
|
|
@@ -2790,30 +2533,7 @@ Method to register a user
|
|
|
2790
2533
|
|
|
2791
2534
|
**Example**
|
|
2792
2535
|
```js
|
|
2793
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2794
|
-
const api = new API();
|
|
2795
|
-
const params ={
|
|
2796
|
-
"registerId": 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2797
|
-
"type": 'sign',
|
|
2798
|
-
"login": false,
|
|
2799
|
-
"emailInfo": {
|
|
2800
|
-
"code": "5974",
|
|
2801
|
-
"email": "cbtoto_1@mailinator.com"
|
|
2802
|
-
},
|
|
2803
|
-
"registerData": {
|
|
2804
|
-
"name": "Augusto Totlo",
|
|
2805
|
-
"registerEmail": "cbtoto_1@mailinator.com",
|
|
2806
|
-
"phone": "",
|
|
2807
|
-
"idcard": "",
|
|
2808
|
-
"dob": "1978-01-12T03:00:00.000Z",
|
|
2809
|
-
"registerPassword": "123456",
|
|
2810
|
-
"emailValidationCode": "5974",
|
|
2811
|
-
"phoneValidationCode": "",
|
|
2812
|
-
"language": "en-US",
|
|
2813
|
-
"timezone": "Europe/Dublin"
|
|
2814
|
-
}
|
|
2815
|
-
};
|
|
2816
|
-
const retData = await api.user.register.execute(params);
|
|
2536
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2817
2537
|
"registerId": 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2818
2538
|
"type": 'sign',
|
|
2819
2539
|
"login": false,
|
|
2820
2540
|
"emailInfo": {
|
|
2821
2541
|
"code": "5974",
|
|
2822
2542
|
"email": "cbtoto_1@mailinator.com"
|
|
2823
2543
|
},
|
|
2824
2544
|
"registerData": {
|
|
2825
2545
|
"name": "Augusto Totlo",
|
|
2826
2546
|
"registerEmail": "cbtoto_1@mailinator.com",
|
|
2827
2547
|
"phone": "",
|
|
2828
2548
|
"idcard": "",
|
|
2829
2549
|
"dob": "1978-01-12T03:00:00.000Z",
|
|
2830
2550
|
"registerPassword": "123456",
|
|
2831
2551
|
"emailValidationCode": "5974",
|
|
2832
2552
|
"phoneValidationCode": "",
|
|
2833
2553
|
"language": "en-US",
|
|
2834
2554
|
"timezone": "Europe/Dublin"
|
|
2835
2555
|
}
|
|
2836
2556
|
};
|
|
2837
2557
|
```
|
|
2838
2558
|
<a name="Settings"></a>
|
|
2839
2559
|
|
|
@@ -2843,13 +2563,7 @@ Adds/updates a user settings
|
|
|
2843
2563
|
|
|
2844
2564
|
**Example**
|
|
2845
2565
|
```js
|
|
2846
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2847
|
-
const api = new API();
|
|
2848
|
-
const settings = {
|
|
2849
|
-
areaId: '55e4a3bd6be6b45210833fae'
|
|
2850
|
-
};
|
|
2851
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2852
|
-
await api.user.settings.upsert(settings, session);
|
|
2566
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2853
2567
|
areaId: '55e4a3bd6be6b45210833fae'
|
|
2854
2568
|
```
|
|
2855
2569
|
<a name="Settings+get"></a>
|
|
2856
2570
|
|
|
@@ -2866,10 +2580,7 @@ Gets the user settings. Returns an array of settings.
|
|
|
2866
2580
|
|
|
2867
2581
|
**Example**
|
|
2868
2582
|
```js
|
|
2869
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2870
|
-
const api = new API();
|
|
2871
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2872
|
-
ret settings = await api.user.settings.get(session);
|
|
2583
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2873
2584
|
```
|
|
2874
2585
|
<a name="Settings+remove"></a>
|
|
2875
2586
|
|
|
@@ -2886,10 +2597,60 @@ Removes the user settings
|
|
|
2886
2597
|
|
|
2887
2598
|
**Example**
|
|
2888
2599
|
```js
|
|
2889
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2600
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2601
|
+
```
|
|
2602
|
+
<a name="TaskAvailable"></a>
|
|
2603
|
+
|
|
2604
|
+
## TaskAvailable
|
|
2605
|
+
Class for available tasks, permission user
|
|
2606
|
+
|
|
2607
|
+
**Kind**: global class
|
|
2608
|
+
|
|
2609
|
+
* [TaskAvailable](#TaskAvailable)
|
|
2610
|
+
* [.find(params, session)](#TaskAvailable+find) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
2611
|
+
* [.claim(params, session)](#TaskAvailable+claim) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2612
|
+
|
|
2613
|
+
<a name="TaskAvailable+find"></a>
|
|
2614
|
+
|
|
2615
|
+
### taskAvailable.find(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
2616
|
+
Method to find available tasks for a user
|
|
2617
|
+
|
|
2618
|
+
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
2619
|
+
**Returns**: <code>promise</code> - returned data from the search<code>number</code> - count the count of items searched<code>array.<object></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
|
|
2620
|
+
**Access**: public
|
|
2621
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2622
|
+
|
|
2623
|
+
| Param | Type | Description |
|
|
2624
|
+
| --- | --- | --- |
|
|
2625
|
+
| params | <code>object</code> | Params to get task |
|
|
2626
|
+
| params.query | <code>object</code> | Search available tasks query |
|
|
2627
|
+
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
2628
|
+
| session | <code>string</code> | Session, token JWT |
|
|
2629
|
+
|
|
2630
|
+
**Example**
|
|
2631
|
+
```js
|
|
2632
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2893
2633
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2894
2634
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2635
|
+
```
|
|
2636
|
+
<a name="TaskAvailable+claim"></a>
|
|
2637
|
+
|
|
2638
|
+
### taskAvailable.claim(params, session) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2639
|
+
Method for a user to claim an available task
|
|
2640
|
+
|
|
2641
|
+
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
2642
|
+
**Returns**: <code>promise</code> - returned data from the method call<code>boolean</code> - success true|false if the method was successful
|
|
2643
|
+
**Access**: public
|
|
2644
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2645
|
+
|
|
2646
|
+
| Param | Type | Description |
|
|
2647
|
+
| --- | --- | --- |
|
|
2648
|
+
| params | <code>object</code> | Params to get task |
|
|
2649
|
+
| params.taskId | <code>object</code> | the task id to claim |
|
|
2650
|
+
| params.orgname | <code>object</code> | Organization slug (short name of the orgnization) |
|
|
2651
|
+
| session | <code>string</code> | Session, token JWT |
|
|
2652
|
+
|
|
2653
|
+
**Example**
|
|
2654
|
+
```js
|
|
2655
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2895
2656
|
taskId: '55e4a3bd6be6b45210833f67',
|
|
2896
2657
|
orgname: 'acme',
|
|
2897
2658
|
```
|
|
2898
2659
|
<a name="Task"></a>
|
|
2899
2660
|
|
|
@@ -2922,15 +2683,7 @@ Method to find task by id
|
|
|
2922
2683
|
|
|
2923
2684
|
**Example**
|
|
2924
2685
|
```js
|
|
2925
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2926
|
-
const api = new API();
|
|
2927
|
-
const params = {
|
|
2928
|
-
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2929
|
-
taskId: '5df7f19618430c89a41a19d2',
|
|
2930
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2931
|
-
};
|
|
2932
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2933
|
-
await api.user.task.findById(params, session);
|
|
2686
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2934
2687
|
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2935
2688
|
taskId: '5df7f19618430c89a41a19d2',
|
|
2936
2689
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2937
2690
|
```
|
|
2938
2691
|
<a name="Task+findByIdAndUpdate"></a>
|
|
2939
2692
|
|
|
@@ -2956,17 +2709,7 @@ Find task by id and update
|
|
|
2956
2709
|
|
|
2957
2710
|
**Example**
|
|
2958
2711
|
```js
|
|
2959
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2960
|
-
const api = new API();
|
|
2961
|
-
const params = {
|
|
2962
|
-
userId: '5739d4c6ccb0ebc61f2a9557',
|
|
2963
|
-
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2964
|
-
taskId: '5df7f19618430c89a41a19d2',
|
|
2965
|
-
action: 1,
|
|
2966
|
-
formData: {name: 'CloudBrasil'},
|
|
2967
|
-
};
|
|
2968
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2969
|
-
await api.user.task.findByIdAndUpdate(params, session);
|
|
2712
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2970
2713
|
userId: '5739d4c6ccb0ebc61f2a9557',
|
|
2971
2714
|
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2972
2715
|
taskId: '5df7f19618430c89a41a19d2',
|
|
2973
2716
|
action: 1,
|
|
2974
2717
|
formData: {name: 'CloudBrasil'},
|
|
2975
2718
|
```
|
|
2976
2719
|
<a name="Task+executeActionFinalize"></a>
|
|
2977
2720
|
|
|
@@ -2988,98 +2731,22 @@ Find task by id and update
|
|
|
2988
2731
|
|
|
2989
2732
|
**Example**
|
|
2990
2733
|
```js
|
|
2991
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2992
|
-
const api = new API();
|
|
2993
|
-
const params = {
|
|
2994
|
-
taskId: '5df7f19618430c89a41a19d2',
|
|
2995
|
-
actionGuid: 'b3823a2ae52c7a05bfb9590fe427038d'
|
|
2996
|
-
orgId: '5df7f19618430c89a41a1bc3',
|
|
2997
|
-
payload: {}',
|
|
2998
|
-
};
|
|
2999
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3000
|
-
await api.user.task.executeActionFinalize(params, session);
|
|
2734
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3001
2735
|
taskId: '5df7f19618430c89a41a19d2',
|
|
3002
2736
|
actionGuid: 'b3823a2ae52c7a05bfb9590fe427038d'
|
|
3003
2737
|
orgId: '5df7f19618430c89a41a1bc3',
|
|
3004
2738
|
payload: {}',
|
|
3005
2739
|
```
|
|
3006
|
-
<a name="
|
|
2740
|
+
<a name="Updates"></a>
|
|
3007
2741
|
|
|
3008
|
-
##
|
|
3009
|
-
Class for
|
|
2742
|
+
## Updates
|
|
2743
|
+
Class for user registration in a user
|
|
3010
2744
|
|
|
3011
2745
|
**Kind**: global class
|
|
2746
|
+
<a name="Updates+get"></a>
|
|
3012
2747
|
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
* [.claim(params, session)](#TaskAvailable+claim) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2748
|
+
### updates.get(session)
|
|
2749
|
+
get updates
|
|
3016
2750
|
|
|
3017
|
-
<
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
Method to find available tasks for a user
|
|
3021
|
-
|
|
3022
|
-
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
3023
|
-
**Returns**: <code>promise</code> - returned data from the search<code>number</code> - count the count of items searched<code>array.<object></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
|
|
3024
|
-
**Access**: public
|
|
3025
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3026
|
-
|
|
3027
|
-
| Param | Type | Description |
|
|
3028
|
-
| --- | --- | --- |
|
|
3029
|
-
| params | <code>object</code> | Params to get task |
|
|
3030
|
-
| params.query | <code>object</code> | Search available tasks query |
|
|
3031
|
-
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
3032
|
-
| session | <code>string</code> | Session, token JWT |
|
|
3033
|
-
|
|
3034
|
-
**Example**
|
|
3035
|
-
```js
|
|
3036
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3037
|
-
const api = new API();
|
|
3038
|
-
const params = {
|
|
3039
|
-
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
3040
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
3041
|
-
};
|
|
3042
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3043
|
-
const retSearch = await api.user.task.available.find(params, session);
|
|
3044
|
-
```
|
|
3045
|
-
<a name="TaskAvailable+claim"></a>
|
|
3046
|
-
|
|
3047
|
-
### taskAvailable.claim(params, session) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
3048
|
-
Method for a user to claim an available task
|
|
3049
|
-
|
|
3050
|
-
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
3051
|
-
**Returns**: <code>promise</code> - returned data from the method call<code>boolean</code> - success true|false if the method was successful
|
|
3052
|
-
**Access**: public
|
|
3053
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3054
|
-
|
|
3055
|
-
| Param | Type | Description |
|
|
3056
|
-
| --- | --- | --- |
|
|
3057
|
-
| params | <code>object</code> | Params to get task |
|
|
3058
|
-
| params.taskId | <code>object</code> | the task id to claim |
|
|
3059
|
-
| params.orgname | <code>object</code> | Organization slug (short name of the orgnization) |
|
|
3060
|
-
| session | <code>string</code> | Session, token JWT |
|
|
3061
|
-
|
|
3062
|
-
**Example**
|
|
3063
|
-
```js
|
|
3064
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3065
|
-
const api = new API();
|
|
3066
|
-
const params = {
|
|
3067
|
-
taskId: '55e4a3bd6be6b45210833f67',
|
|
3068
|
-
orgname: 'acme',
|
|
3069
|
-
};
|
|
3070
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3071
|
-
const success = await api.user.task.available.claim(params, session);
|
|
3072
|
-
```
|
|
3073
|
-
<a name="Updates"></a>
|
|
3074
|
-
|
|
3075
|
-
## Updates
|
|
3076
|
-
Class for user registration in a user
|
|
3077
|
-
|
|
3078
|
-
**Kind**: global class
|
|
3079
|
-
<a name="Updates+get"></a>
|
|
3080
|
-
|
|
3081
|
-
### updates.get(session)
|
|
3082
|
-
get updates
|
|
3083
|
-
|
|
3084
|
-
**Kind**: instance method of [<code>Updates</code>](#Updates)
|
|
3085
|
-
**Access**: public
|
|
3086
|
-
**Author**: Augusto Pissarra <abernardo.br@gmail.com>
|
|
2751
|
+
**Kind**: instance method of [<code>Updates</code>](#Updates)
|
|
2752
|
+
**Access**: public
|
|
2753
|
+
**Author**: Augusto Pissarra <abernardo.br@gmail.com>
|
|
3087
2754
|
|
|
3088
2755
|
| Param | Type | Description |
|
|
3089
2756
|
| --- | --- | --- |
|
|
@@ -3087,10 +2754,7 @@ get updates
|
|
|
3087
2754
|
|
|
3088
2755
|
**Example**
|
|
3089
2756
|
```js
|
|
3090
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3091
|
-
const api = new API();
|
|
3092
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3093
|
-
await api.user.updates.get(session);
|
|
2757
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3094
2758
|
```
|
|
3095
2759
|
<a name="User"></a>
|
|
3096
2760
|
|
|
@@ -3125,14 +2789,7 @@ Update avatar of user by session of user not allow session user SU
|
|
|
3125
2789
|
|
|
3126
2790
|
**Example**
|
|
3127
2791
|
```js
|
|
3128
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3129
|
-
const api = new API();
|
|
3130
|
-
const params = {
|
|
3131
|
-
avatar: '55e4a3bd6be6b45210833fae',
|
|
3132
|
-
type: '123456',
|
|
3133
|
-
};
|
|
3134
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3135
|
-
await api.user.profile.updateAvatar(params, session);
|
|
2792
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3136
2793
|
avatar: '55e4a3bd6be6b45210833fae',
|
|
3137
2794
|
type: '123456',
|
|
3138
2795
|
```
|
|
3139
2796
|
<a name="User+removeAvatar"></a>
|
|
3140
2797
|
|
|
@@ -3149,10 +2806,7 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
3149
2806
|
|
|
3150
2807
|
**Example**
|
|
3151
2808
|
```js
|
|
3152
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3153
|
-
const api = new API();
|
|
3154
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3155
|
-
await api.user.profile.removeAvatar(session);
|
|
2809
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3156
2810
|
```
|
|
3157
2811
|
<a name="User+removeSignature"></a>
|
|
3158
2812
|
|
|
@@ -3169,10 +2823,7 @@ Remove the signature of user by session
|
|
|
3169
2823
|
|
|
3170
2824
|
**Example**
|
|
3171
2825
|
```js
|
|
3172
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3173
|
-
const api = new API();
|
|
3174
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3175
|
-
await api.user.profile.removeSignature(session);
|
|
2826
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3176
2827
|
```
|
|
3177
2828
|
<a name="User+saveSignature"></a>
|
|
3178
2829
|
|
|
@@ -3192,23 +2843,7 @@ Sava a new signature of user by session
|
|
|
3192
2843
|
|
|
3193
2844
|
**Example**
|
|
3194
2845
|
```js
|
|
3195
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3196
|
-
const api = new API();
|
|
3197
|
-
const data = {
|
|
3198
|
-
type: 'CURSIVE',
|
|
3199
|
-
file: 'allura:Mary John Heart'
|
|
3200
|
-
};
|
|
3201
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3202
|
-
await api.user.profile.saveSignature(data, session);
|
|
3203
|
-
|
|
3204
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3205
|
-
const api = new API();
|
|
3206
|
-
const data = {
|
|
3207
|
-
type: 'HANDWRITE',
|
|
3208
|
-
file: 'iVBORw0KGgoAAAANSUhEUgAAAj...'
|
|
3209
|
-
};
|
|
3210
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3211
|
-
await api.user.profile.saveSignature(session);
|
|
2846
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3212
2847
|
type: 'CURSIVE',
|
|
3213
2848
|
file: 'allura:Mary John Heart'
|
|
3214
2849
|
type: 'HANDWRITE',
|
|
3215
2850
|
file: 'iVBORw0KGgoAAAANSUhEUgAAAj...'
|
|
3216
2851
|
```
|
|
3217
2852
|
<a name="User+findByIdAndUpdate"></a>
|
|
3218
2853
|
|
|
@@ -3242,13 +2877,7 @@ Update a user profile by id
|
|
|
3242
2877
|
|
|
3243
2878
|
**Example**
|
|
3244
2879
|
```js
|
|
3245
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3246
|
-
const api = new API();
|
|
3247
|
-
const params = {
|
|
3248
|
-
name: 'New Name'
|
|
3249
|
-
};
|
|
3250
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3251
|
-
await api.user.profile.findByIdAndUpdate(params, session);
|
|
2880
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3252
2881
|
name: 'New Name'
|
|
3253
2882
|
```
|
|
3254
2883
|
<a name="User+changeOrganization"></a>
|
|
3255
2884
|
|
|
@@ -3266,379 +2895,5 @@ Change a user's organization
|
|
|
3266
2895
|
|
|
3267
2896
|
**Example**
|
|
3268
2897
|
```js
|
|
3269
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3270
|
-
const api = new API();
|
|
3271
|
-
const id = '616eccaaa9360a05293b10fe';
|
|
3272
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3273
|
-
await api.user.changeOrganization.updateAvatar(id, session);
|
|
3274
|
-
```
|
|
3275
|
-
<a name="Dispatch"></a>
|
|
3276
|
-
|
|
3277
|
-
## Dispatch
|
|
3278
|
-
Api dispatch manager
|
|
3279
|
-
|
|
3280
|
-
**Kind**: global class
|
|
3281
|
-
|
|
3282
|
-
* [Dispatch](#Dispatch)
|
|
3283
|
-
* [.getContext(url, session)](#Dispatch+getContext) ⇒ <code>Promise.<object></code>
|
|
3284
|
-
* [.getClient()](#Dispatch+getClient) ⇒ <code>promise</code>
|
|
3285
|
-
|
|
3286
|
-
<a name="Dispatch+getContext"></a>
|
|
3287
|
-
|
|
3288
|
-
### dispatch.getContext(url, session) ⇒ <code>Promise.<object></code>
|
|
3289
|
-
Get the URL context
|
|
3290
|
-
|
|
3291
|
-
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
3292
|
-
**Returns**: <code>Promise.<object></code> - The full data context of the URL
|
|
3293
|
-
**Access**: public
|
|
3294
|
-
|
|
3295
|
-
| Param | Type | Default | Description |
|
|
3296
|
-
| --- | --- | --- | --- |
|
|
3297
|
-
| url | <code>string</code> | | Full url |
|
|
3298
|
-
| session | <code>session</code> | <code></code> | Session, token JWT |
|
|
3299
|
-
|
|
3300
|
-
**Example**
|
|
3301
|
-
```js
|
|
3302
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3303
|
-
const api = new API();
|
|
3304
|
-
const retContext = await api.dispatch.getContext('http://myndware.io/login/myorg);
|
|
3305
|
-
```
|
|
3306
|
-
<a name="Dispatch+getClient"></a>
|
|
3307
|
-
|
|
3308
|
-
### dispatch.getClient() ⇒ <code>promise</code>
|
|
3309
|
-
Get client Axios
|
|
3310
|
-
|
|
3311
|
-
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
3312
|
-
**Returns**: <code>promise</code> - return client axios
|
|
3313
|
-
**Access**: public
|
|
3314
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3315
|
-
**Example**
|
|
3316
|
-
```js
|
|
3317
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3318
|
-
const api = new API();
|
|
3319
|
-
await api.dispatch.getClient();
|
|
3320
|
-
```
|
|
3321
|
-
<a name="External"></a>
|
|
3322
|
-
|
|
3323
|
-
## External
|
|
3324
|
-
Class for documents, permission user
|
|
3325
|
-
|
|
3326
|
-
**Kind**: global class
|
|
3327
|
-
|
|
3328
|
-
* [External](#External)
|
|
3329
|
-
* [.context(params)](#External+context) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>array.<object></code>
|
|
3330
|
-
* [.getUploadDocumentSignedUrl(mime, authorization)](#External+getUploadDocumentSignedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3331
|
-
* [.getUploadDocumentsSignedUrl(docs, authorization)](#External+getUploadDocumentsSignedUrl) ⇒ <code>Promise.<array></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3332
|
-
* [.handle(authorization, params)](#External+handle) ⇒ <code>Promise.<boolean></code>
|
|
3333
|
-
|
|
3334
|
-
<a name="External+context"></a>
|
|
3335
|
-
|
|
3336
|
-
### external.context(params) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>array.<object></code>
|
|
3337
|
-
Create new document
|
|
3338
|
-
|
|
3339
|
-
**Kind**: instance method of [<code>External</code>](#External)
|
|
3340
|
-
**Returns**: <code>Promise.<object></code> - data<code>string</code> - _id the id of the form<code>string</code> - orgId the organization id of the form<code>string</code> - authorization the unique token registered internally by the system for all the next calls to the external form APIs
|
|
3341
|
-
The authorization is unique and is ONLY valid for this session.<code>array.<object></code> - groups the form groups to render
|
|
3342
|
-
**Access**: public
|
|
3343
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3344
|
-
|
|
3345
|
-
| Param | Type | Description |
|
|
3346
|
-
| --- | --- | --- |
|
|
3347
|
-
| params | <code>object</code> | Object for add new document |
|
|
3348
|
-
| params.id | <code>string</code> | Organization form id |
|
|
3349
|
-
|
|
3350
|
-
**Example**
|
|
3351
|
-
```js
|
|
3352
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3353
|
-
const api = new API();
|
|
3354
|
-
const params = {
|
|
3355
|
-
id: '611e679741cc63168c26d7ee'
|
|
3356
|
-
};
|
|
3357
|
-
const retForm = await api.external.context(params);
|
|
3358
|
-
```
|
|
3359
|
-
<a name="External+getUploadDocumentSignedUrl"></a>
|
|
3360
|
-
|
|
3361
|
-
### external.getUploadDocumentSignedUrl(mime, authorization) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3362
|
-
Get an upload signed url, so it will be possible to upload documents temporarily during the use of the external form
|
|
3363
|
-
|
|
3364
|
-
**Kind**: instance method of [<code>External</code>](#External)
|
|
3365
|
-
**Returns**: <code>Promise.<object></code> - doc<code>string</code> - doc.mime the original mime type of the document<code>string</code> - doc.signedUrl the signed url to upload the document<code>string</code> - doc.filename the filename of the uploaded file<code>string</code> - doc.extension the extension of the filename, obtained from the mime type
|
|
3366
|
-
**Access**: public
|
|
3367
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3368
|
-
|
|
3369
|
-
| Param | Type | Description |
|
|
3370
|
-
| --- | --- | --- |
|
|
3371
|
-
| mime | <code>string</code> | the mime type of the document |
|
|
3372
|
-
| authorization | <code>string</code> | a legal authorization |
|
|
3373
|
-
|
|
3374
|
-
**Example**
|
|
3375
|
-
```js
|
|
3376
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3377
|
-
const api = new API();
|
|
3378
|
-
const authorization = '...';
|
|
3379
|
-
const doc = {
|
|
3380
|
-
mime: 'application/pdf'
|
|
3381
|
-
};
|
|
3382
|
-
const retDoc = await api.external.getUploadDocumentSignedUrl(doc, authorization);
|
|
3383
|
-
```
|
|
3384
|
-
<a name="External+getUploadDocumentsSignedUrl"></a>
|
|
3385
|
-
|
|
3386
|
-
### external.getUploadDocumentsSignedUrl(docs, authorization) ⇒ <code>Promise.<array></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3387
|
-
Get an upload signed url, for many documents. So it will be possible to upload documents temporarily during the use of the external form
|
|
3388
|
-
|
|
3389
|
-
**Kind**: instance method of [<code>External</code>](#External)
|
|
3390
|
-
**Returns**: <code>Promise.<array></code> - docs<code>string</code> - docs.mime the original mime type of the document<code>string</code> - docs.signedUrl the signed url to upload the document<code>string</code> - docs.filename the filename of the uploaded file<code>string</code> - docs.extension the extension of the filename, obtained from the mime type
|
|
3391
|
-
**Access**: public
|
|
3392
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3393
|
-
|
|
3394
|
-
| Param | Type | Description |
|
|
3395
|
-
| --- | --- | --- |
|
|
3396
|
-
| docs | <code>array.<object></code> | the list of documents |
|
|
3397
|
-
| docs.mime | <code>string</code> | the mime type of the document |
|
|
3398
|
-
| authorization | <code>string</code> | a legal authorization |
|
|
3399
|
-
|
|
3400
|
-
**Example**
|
|
3401
|
-
```js
|
|
3402
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3403
|
-
const api = new API();
|
|
3404
|
-
const authorization = '...';
|
|
3405
|
-
const docs = [
|
|
3406
|
-
{
|
|
3407
|
-
mime: 'application/pdf'
|
|
3408
|
-
}
|
|
3409
|
-
];
|
|
3410
|
-
const retDocs = await api.external.getUploadDocumentsSignedUrl(docs, authorization);
|
|
3411
|
-
```
|
|
3412
|
-
<a name="External+handle"></a>
|
|
3413
|
-
|
|
3414
|
-
### external.handle(authorization, params) ⇒ <code>Promise.<boolean></code>
|
|
3415
|
-
Handles the execution of an external form
|
|
3416
|
-
|
|
3417
|
-
**Kind**: instance method of [<code>External</code>](#External)
|
|
3418
|
-
**Returns**: <code>Promise.<boolean></code> - true|false if success
|
|
3419
|
-
**Access**: public
|
|
3420
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3421
|
-
|
|
3422
|
-
| Param | Type | Description |
|
|
3423
|
-
| --- | --- | --- |
|
|
3424
|
-
| authorization | <code>string</code> | a legal authorization |
|
|
3425
|
-
| params | <code>object</code> | the parameters to handle the execution of an external form |
|
|
3426
|
-
| params.payload | <code>array.<object></code> | the payload of the external form. It should represent the form groups of the external form |
|
|
3427
|
-
| params.payload.name | <code>string</code> | the name of the group |
|
|
3428
|
-
| params.payload.fields | <code>array.<object></code> | the fields that belong to each group |
|
|
3429
|
-
| params.payload.fields.value | <code>\*</code> \| <code>Object</code> | besides all the data inside a field, it should have the value of the the field |
|
|
3430
|
-
|
|
3431
|
-
**Example**
|
|
3432
|
-
```js
|
|
3433
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3434
|
-
const api = new API();
|
|
3435
|
-
const authorization = '...';
|
|
3436
|
-
const params = {
|
|
3437
|
-
payload: [
|
|
3438
|
-
{
|
|
3439
|
-
name: 'My Group One',
|
|
3440
|
-
fields: [
|
|
3441
|
-
{}
|
|
3442
|
-
]
|
|
3443
|
-
}
|
|
3444
|
-
]
|
|
3445
|
-
};
|
|
3446
|
-
const success = await api.external.handle(params, authorization);
|
|
3447
|
-
```
|
|
3448
|
-
<a name="Login"></a>
|
|
3449
|
-
|
|
3450
|
-
## Login
|
|
3451
|
-
Login manager
|
|
3452
|
-
|
|
3453
|
-
**Kind**: global class
|
|
3454
|
-
|
|
3455
|
-
* [Login](#Login)
|
|
3456
|
-
* [.facebook(params)](#Login+facebook) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3457
|
-
* [.google(params)](#Login+google) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3458
|
-
* [.apiKey(apikey)](#Login+apiKey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3459
|
-
* [.userPass(params)](#Login+userPass) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3460
|
-
* [.logout(session)](#Login+logout) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3461
|
-
* [.recover(username)](#Login+recover) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3462
|
-
|
|
3463
|
-
<a name="Login+facebook"></a>
|
|
3464
|
-
|
|
3465
|
-
### login.facebook(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3466
|
-
Login with social login Facebook
|
|
3467
|
-
|
|
3468
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3469
|
-
**Returns**: <code>promise.<object></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
|
|
3470
|
-
**Access**: public
|
|
3471
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3472
|
-
|
|
3473
|
-
| Param | Type | Description |
|
|
3474
|
-
| --- | --- | --- |
|
|
3475
|
-
| params | <code>object</code> | Params to login Facebook |
|
|
3476
|
-
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
3477
|
-
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
3478
|
-
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
3479
|
-
|
|
3480
|
-
**Example**
|
|
3481
|
-
```js
|
|
3482
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3483
|
-
|
|
3484
|
-
// Params of the instance
|
|
3485
|
-
const params = {...}
|
|
3486
|
-
const api = new API(params);
|
|
3487
|
-
const params = { accessToken: 'eyJhbGciOiJIUzI1NiIsInR5cC...' };
|
|
3488
|
-
const { auth, user } = await api.login.facebook(params);
|
|
3489
|
-
```
|
|
3490
|
-
<a name="Login+google"></a>
|
|
3491
|
-
|
|
3492
|
-
### login.google(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3493
|
-
Login with social login Google
|
|
3494
|
-
|
|
3495
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3496
|
-
**Returns**: <code>promise.<object></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
|
|
3497
|
-
**Access**: public
|
|
3498
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3499
|
-
|
|
3500
|
-
| Param | Type | Description |
|
|
3501
|
-
| --- | --- | --- |
|
|
3502
|
-
| params | <code>object</code> | Params to login Google |
|
|
3503
|
-
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
3504
|
-
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
3505
|
-
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
3506
|
-
|
|
3507
|
-
**Example**
|
|
3508
|
-
```js
|
|
3509
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3510
|
-
|
|
3511
|
-
// Params of the instance
|
|
3512
|
-
const params = {...}
|
|
3513
|
-
const api = new API(params);
|
|
3514
|
-
const accessToken = 'eyJhbGciOiJIUzI1NiIsInR5cC...';
|
|
3515
|
-
const { auth, user } = await api.login.google(accessToken);
|
|
3516
|
-
```
|
|
3517
|
-
<a name="Login+apiKey"></a>
|
|
3518
|
-
|
|
3519
|
-
### login.apiKey(apikey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3520
|
-
Login with apikey
|
|
3521
|
-
|
|
3522
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3523
|
-
**Returns**: <code>promise.<object></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
|
|
3524
|
-
**Access**: public
|
|
3525
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3526
|
-
|
|
3527
|
-
| Param | Type | Description |
|
|
3528
|
-
| --- | --- | --- |
|
|
3529
|
-
| apikey | <code>string</code> | Access key |
|
|
3530
|
-
|
|
3531
|
-
**Example**
|
|
3532
|
-
```js
|
|
3533
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3534
|
-
|
|
3535
|
-
// Params of the instance
|
|
3536
|
-
const params = {...}
|
|
3537
|
-
const api = new API(params);
|
|
3538
|
-
const apiKey = '043a0eb2-f5c3-4900-b781-7f229d00d092';
|
|
3539
|
-
const { auth, user } = await api.login.apiKey(apiKey);
|
|
3540
|
-
```
|
|
3541
|
-
<a name="Login+userPass"></a>
|
|
3542
|
-
|
|
3543
|
-
### login.userPass(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3544
|
-
Login with user and password
|
|
3545
|
-
|
|
3546
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3547
|
-
**Returns**: <code>promise.<object></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
|
|
3548
|
-
**Access**: public
|
|
3549
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3550
|
-
|
|
3551
|
-
| Param | Type | Description |
|
|
3552
|
-
| --- | --- | --- |
|
|
3553
|
-
| params | <code>object</code> | Object with user and password |
|
|
3554
|
-
| params.username | <code>string</code> | Username or email of the user |
|
|
3555
|
-
| params.password | <code>string</code> | Password of the user |
|
|
3556
|
-
| params.orgname | <code>string</code> | The organame of the user |
|
|
3557
|
-
|
|
3558
|
-
**Example**
|
|
3559
|
-
```js
|
|
3560
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3561
|
-
|
|
3562
|
-
// Params of the instance
|
|
3563
|
-
const params = {...}
|
|
3564
|
-
const api = new API(params);
|
|
3565
|
-
const params = {
|
|
3566
|
-
username: 'ana.silva@gmail.com',
|
|
3567
|
-
password: '123456'
|
|
3568
|
-
};
|
|
3569
|
-
const { auth, user } = await api.login.userPass(params);
|
|
3570
|
-
```
|
|
3571
|
-
<a name="Login+logout"></a>
|
|
3572
|
-
|
|
3573
|
-
### login.logout(session) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3574
|
-
Logout user system manager
|
|
3575
|
-
|
|
3576
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3577
|
-
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
3578
|
-
**Access**: public
|
|
3579
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3580
|
-
|
|
3581
|
-
| Param | Type | Description |
|
|
3582
|
-
| --- | --- | --- |
|
|
3583
|
-
| session | <code>string</code> | Session, token JWT |
|
|
3584
|
-
|
|
3585
|
-
**Example**
|
|
3586
|
-
```js
|
|
3587
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3588
|
-
|
|
3589
|
-
// Params of the instance
|
|
3590
|
-
const params = {...}
|
|
3591
|
-
const api = new API(params);
|
|
3592
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3593
|
-
const { success } = await api.login.logout(session);
|
|
3594
|
-
```
|
|
3595
|
-
<a name="Login+recover"></a>
|
|
3596
|
-
|
|
3597
|
-
### login.recover(username) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3598
|
-
Recover the password
|
|
3599
|
-
|
|
3600
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3601
|
-
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
3602
|
-
**Access**: public
|
|
3603
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3604
|
-
|
|
3605
|
-
| Param | Type | Description |
|
|
3606
|
-
| --- | --- | --- |
|
|
3607
|
-
| username | <code>string</code> | The username or email |
|
|
3608
|
-
|
|
3609
|
-
**Example**
|
|
3610
|
-
```js
|
|
3611
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3612
|
-
|
|
3613
|
-
// Params of the instance
|
|
3614
|
-
const params = {...}
|
|
3615
|
-
const api = new API(params);
|
|
3616
|
-
const { success } = await api.login.recover('myusername');
|
|
3617
|
-
```
|
|
3618
|
-
<a name="Session"></a>
|
|
3619
|
-
|
|
3620
|
-
## Session
|
|
3621
|
-
Session manager of the API
|
|
3622
|
-
|
|
3623
|
-
**Kind**: global class
|
|
3624
|
-
<a name="Session+information"></a>
|
|
3625
|
-
|
|
3626
|
-
### session.information(sessionId, suSessionId) ⇒ <code>Promise</code>
|
|
3627
|
-
Show information for session, thus validating the session (Valid token JWT)
|
|
3628
|
-
|
|
3629
|
-
**Kind**: instance method of [<code>Session</code>](#Session)
|
|
3630
|
-
**Access**: public
|
|
3631
|
-
|
|
3632
|
-
| Param | Type | Default | Description |
|
|
3633
|
-
| --- | --- | --- | --- |
|
|
3634
|
-
| sessionId | <code>string</code> | | The user session (JWT Token) |
|
|
3635
|
-
| suSessionId | <code>string</code> | <code>"sessionId"</code> | Given a JWT Token of a SU (SuperAdmin), allow to check session for another user. |
|
|
3636
|
-
|
|
3637
|
-
**Example**
|
|
3638
|
-
```js
|
|
3639
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3640
|
-
const api = new API();
|
|
3641
|
-
const sessionId = 'eyJhbFVBBiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3642
|
-
const suSessionId = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3643
|
-
await api.session.information(sessionId, suSessionId);
|
|
2898
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3644
2899
|
```
|