@docbrasil/api-systemmanager 1.1.10 → 1.1.11
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/.vscode/settings.json +1 -0
- package/api/user/my_tasks.js +80 -0
- package/dist/bundle.cjs +80 -0
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +566 -1270
- 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
|
|
|
@@ -1889,6 +1783,12 @@ API request, user permission level
|
|
|
1889
1783
|
Class for my tasks, permission user
|
|
1890
1784
|
|
|
1891
1785
|
**Kind**: global class
|
|
1786
|
+
|
|
1787
|
+
* [MyTasks](#MyTasks)
|
|
1788
|
+
* [.find(params, session)](#MyTasks+find) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
1789
|
+
* [.saveDueDate(data, session)](#MyTasks+saveDueDate) ⇒ <code>Promise</code>
|
|
1790
|
+
* [.removeDueDate(session)](#MyTasks+removeDueDate) ⇒ <code>Promise</code>
|
|
1791
|
+
|
|
1892
1792
|
<a name="MyTasks+find"></a>
|
|
1893
1793
|
|
|
1894
1794
|
### myTasks.find(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
@@ -1908,14 +1808,47 @@ Method to find my tasks for a user
|
|
|
1908
1808
|
|
|
1909
1809
|
**Example**
|
|
1910
1810
|
```js
|
|
1911
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1912
|
-
const api = new API();
|
|
1913
|
-
const params = {
|
|
1914
|
-
query: {"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
1915
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
1916
|
-
};
|
|
1917
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1918
|
-
const retSearch = await api.user.task.mytasks.find(params, session);
|
|
1811
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1919
1812
|
query: {"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
1920
1813
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
1814
|
+
```
|
|
1815
|
+
<a name="MyTasks+saveDueDate"></a>
|
|
1816
|
+
|
|
1817
|
+
### myTasks.saveDueDate(data, session) ⇒ <code>Promise</code>
|
|
1818
|
+
Update task dueDate
|
|
1819
|
+
|
|
1820
|
+
**Kind**: instance method of [<code>MyTasks</code>](#MyTasks)
|
|
1821
|
+
**Access**: public
|
|
1822
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1823
|
+
|
|
1824
|
+
| Param | Type | Description |
|
|
1825
|
+
| --- | --- | --- |
|
|
1826
|
+
| data | <code>object</code> | The Date to save |
|
|
1827
|
+
| data.dueDate | <code>string</code> | DueDate |
|
|
1828
|
+
| data.orgId | <code>string</code> | Organization id |
|
|
1829
|
+
| data.taskId | <code>string</code> | Task Id |
|
|
1830
|
+
| session | <code>string</code> | Is token JWT of user |
|
|
1831
|
+
|
|
1832
|
+
**Example**
|
|
1833
|
+
```js
|
|
1834
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1921
1835
|
dueDate: '2011-10-05T14:48:00.000Z',
|
|
1922
1836
|
orgId: '646386c9583e04a131adc894',
|
|
1923
1837
|
taskId: '646386c9583e04a131adc895'
|
|
1838
|
+
```
|
|
1839
|
+
<a name="MyTasks+removeDueDate"></a>
|
|
1840
|
+
|
|
1841
|
+
### myTasks.removeDueDate(session) ⇒ <code>Promise</code>
|
|
1842
|
+
Update task dueDate
|
|
1843
|
+
|
|
1844
|
+
**Kind**: instance method of [<code>MyTasks</code>](#MyTasks)
|
|
1845
|
+
**Access**: public
|
|
1846
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1847
|
+
|
|
1848
|
+
| Param | Type | Description |
|
|
1849
|
+
| --- | --- | --- |
|
|
1850
|
+
| data.orgId | <code>string</code> | Organization id |
|
|
1851
|
+
| data.taskId | <code>string</code> | Task Id |
|
|
1852
|
+
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
1853
|
+
|
|
1854
|
+
**Example**
|
|
1855
|
+
```js
|
|
1856
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1924
1857
|
orgId: '646386c9583e04a131adc894',
|
|
1925
1858
|
taskId: '646386c9583e04a131adc895'
|
|
1926
1859
|
```
|
|
1927
1860
|
<a name="Notification"></a>
|
|
1928
1861
|
|
|
@@ -1957,14 +1890,7 @@ Method to add a notification token
|
|
|
1957
1890
|
|
|
1958
1891
|
**Example**
|
|
1959
1892
|
```js
|
|
1960
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1961
|
-
const api = new API();
|
|
1962
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1963
|
-
const params = {
|
|
1964
|
-
token: 'V6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz2',
|
|
1965
|
-
type: 'FCM_WEB'
|
|
1966
|
-
};
|
|
1967
|
-
const retData = await api.user.notification.addToken(params, session);
|
|
1893
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1968
1894
|
token: 'V6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz2',
|
|
1969
1895
|
type: 'FCM_WEB'
|
|
1970
1896
|
```
|
|
1971
1897
|
<a name="Notification+getNew"></a>
|
|
1972
1898
|
|
|
@@ -1981,10 +1907,7 @@ get new notifications
|
|
|
1981
1907
|
|
|
1982
1908
|
**Example**
|
|
1983
1909
|
```js
|
|
1984
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1985
|
-
const api = new API();
|
|
1986
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1987
|
-
await api.user.notification.getNew(session);
|
|
1910
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1988
1911
|
```
|
|
1989
1912
|
<a name="Notification+getOld"></a>
|
|
1990
1913
|
|
|
@@ -2001,10 +1924,7 @@ get old notifications
|
|
|
2001
1924
|
|
|
2002
1925
|
**Example**
|
|
2003
1926
|
```js
|
|
2004
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2005
|
-
const api = new API();
|
|
2006
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2007
|
-
await api.user.notification.getOld(session);
|
|
1927
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2008
1928
|
```
|
|
2009
1929
|
<a name="Notification+setRead"></a>
|
|
2010
1930
|
|
|
@@ -2023,13 +1943,7 @@ Set notification as readed
|
|
|
2023
1943
|
|
|
2024
1944
|
**Example**
|
|
2025
1945
|
```js
|
|
2026
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2027
|
-
const api = new API();
|
|
2028
|
-
const params = {
|
|
2029
|
-
id: '34c344c43c34c344c43c'
|
|
2030
|
-
};
|
|
2031
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2032
|
-
await api.user.notification.setRead(params, session);
|
|
1946
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2033
1947
|
id: '34c344c43c34c344c43c'
|
|
2034
1948
|
```
|
|
2035
1949
|
<a name="Notification+setUnread"></a>
|
|
2036
1950
|
|
|
@@ -2048,13 +1962,7 @@ Set notification as unreaded
|
|
|
2048
1962
|
|
|
2049
1963
|
**Example**
|
|
2050
1964
|
```js
|
|
2051
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2052
|
-
const api = new API();
|
|
2053
|
-
const params = {
|
|
2054
|
-
id: '34c344c43c34c344c43c'
|
|
2055
|
-
};
|
|
2056
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2057
|
-
await api.user.notification.setUnread(params, session);
|
|
1965
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2058
1966
|
id: '34c344c43c34c344c43c'
|
|
2059
1967
|
```
|
|
2060
1968
|
<a name="Organization"></a>
|
|
2061
1969
|
|
|
@@ -2091,15 +1999,7 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
2091
1999
|
|
|
2092
2000
|
**Example**
|
|
2093
2001
|
```js
|
|
2094
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2095
|
-
const api = new API();
|
|
2096
|
-
const params = {
|
|
2097
|
-
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
2098
|
-
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
2099
|
-
type: 'image/png',
|
|
2100
|
-
};
|
|
2101
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2102
|
-
await api.admin.organizations.upsertAvatar(params, session);
|
|
2002
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2103
2003
|
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
2104
2004
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
2105
2005
|
type: 'image/png',
|
|
2106
2006
|
```
|
|
2107
2007
|
<a name="Organization+removeAvatar"></a>
|
|
2108
2008
|
|
|
@@ -2117,11 +2017,7 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
2117
2017
|
|
|
2118
2018
|
**Example**
|
|
2119
2019
|
```js
|
|
2120
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2121
|
-
const api = new API();
|
|
2122
|
-
const orgId = '5dadd01dc4af3941d42f8c5c';
|
|
2123
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2124
|
-
await api.admin.organizations.removeAvatar(orgId, session);
|
|
2020
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2125
2021
|
```
|
|
2126
2022
|
<a name="Organization+findById"></a>
|
|
2127
2023
|
|
|
@@ -2139,11 +2035,7 @@ Find organization by id
|
|
|
2139
2035
|
|
|
2140
2036
|
**Example**
|
|
2141
2037
|
```js
|
|
2142
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2143
|
-
const api = new API();
|
|
2144
|
-
const orgId = '80443245000122';
|
|
2145
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2146
|
-
await api.user.organization.findById(idCard, session);
|
|
2038
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2147
2039
|
```
|
|
2148
2040
|
<a name="Organization+idCardExist"></a>
|
|
2149
2041
|
|
|
@@ -2161,11 +2053,7 @@ Check if id card exist
|
|
|
2161
2053
|
|
|
2162
2054
|
**Example**
|
|
2163
2055
|
```js
|
|
2164
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2165
|
-
const api = new API();
|
|
2166
|
-
const idCard = '80443245000122';
|
|
2167
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2168
|
-
await api.user.organization.idCardExist(idCard, session);
|
|
2056
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2169
2057
|
```
|
|
2170
2058
|
<a name="Organization+upsertAvatar"></a>
|
|
2171
2059
|
|
|
@@ -2185,14 +2073,7 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
2185
2073
|
|
|
2186
2074
|
**Example**
|
|
2187
2075
|
```js
|
|
2188
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2189
|
-
const api = new API();
|
|
2190
|
-
const params = {
|
|
2191
|
-
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
2192
|
-
type: 'image/png',
|
|
2193
|
-
};
|
|
2194
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2195
|
-
await api.user.profile.updateAvatar(params, session);
|
|
2076
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2196
2077
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
2197
2078
|
type: 'image/png',
|
|
2198
2079
|
```
|
|
2199
2080
|
<a name="Organization+removeAvatar"></a>
|
|
2200
2081
|
|
|
@@ -2209,10 +2090,7 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
2209
2090
|
|
|
2210
2091
|
**Example**
|
|
2211
2092
|
```js
|
|
2212
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2213
|
-
const api = new API();
|
|
2214
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2215
|
-
await api.user.profile.removeAvatar(session);
|
|
2093
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2216
2094
|
```
|
|
2217
2095
|
<a name="Organization+callFetch"></a>
|
|
2218
2096
|
|
|
@@ -2232,14 +2110,7 @@ Call URL internal, need auth JWT (session)
|
|
|
2232
2110
|
|
|
2233
2111
|
**Example**
|
|
2234
2112
|
```js
|
|
2235
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2236
|
-
const api = new API();
|
|
2237
|
-
|
|
2238
|
-
const params = {
|
|
2239
|
-
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
2240
|
-
method: 'POST'
|
|
2241
|
-
}
|
|
2242
|
-
await api.user.organization.callFetchs(params, session);
|
|
2113
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2243
2114
|
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
2244
2115
|
method: 'POST'
|
|
2245
2116
|
```
|
|
2246
2117
|
<a name="Page"></a>
|
|
2247
2118
|
|
|
@@ -2266,15 +2137,7 @@ Get the available page for an application inside an organization
|
|
|
2266
2137
|
|
|
2267
2138
|
**Example**
|
|
2268
2139
|
```js
|
|
2269
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2270
|
-
const api = new API();
|
|
2271
|
-
const params = {
|
|
2272
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2273
|
-
appId: '57e4a3bd6be6b45210833fa7',
|
|
2274
|
-
pageId: '57e4a3bd6be6b45210833fab'
|
|
2275
|
-
};
|
|
2276
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2277
|
-
await api.user.application.page.get(params, session);
|
|
2140
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2278
2141
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2279
2142
|
appId: '57e4a3bd6be6b45210833fa7',
|
|
2280
2143
|
pageId: '57e4a3bd6be6b45210833fab'
|
|
2281
2144
|
```
|
|
2282
2145
|
<a name="Process"></a>
|
|
2283
2146
|
|
|
@@ -2313,15 +2176,7 @@ Start process
|
|
|
2313
2176
|
|
|
2314
2177
|
**Example**
|
|
2315
2178
|
```js
|
|
2316
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2317
|
-
const api = new API();
|
|
2318
|
-
const params = {
|
|
2319
|
-
orgProcessId: '5dadd01dc4af3941d42f8c5c',
|
|
2320
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2321
|
-
payload: {}
|
|
2322
|
-
}
|
|
2323
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2324
|
-
await api.user.process.start(params, session);
|
|
2179
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2325
2180
|
orgProcessId: '5dadd01dc4af3941d42f8c5c',
|
|
2326
2181
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2327
2182
|
payload: {}
|
|
2328
2183
|
```
|
|
2329
2184
|
<a name="Process+getProcessProperties"></a>
|
|
2330
2185
|
|
|
@@ -2341,14 +2196,7 @@ Get process properties of process
|
|
|
2341
2196
|
|
|
2342
2197
|
**Example**
|
|
2343
2198
|
```js
|
|
2344
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2345
|
-
const api = new API();
|
|
2346
|
-
const params = {
|
|
2347
|
-
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2348
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2349
|
-
}
|
|
2350
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2351
|
-
await api.user.process.getProcessProperties(params, session);
|
|
2199
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2352
2200
|
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2353
2201
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2354
2202
|
```
|
|
2355
2203
|
<a name="Process+getOrgProcessSearchInfo"></a>
|
|
2356
2204
|
|
|
@@ -2356,8 +2204,7 @@ await api.user.process.getProcessProperties(params, session);
|
|
|
2356
2204
|
Get the search info of a organization process
|
|
2357
2205
|
|
|
2358
2206
|
**Kind**: instance method of [<code>Process</code>](#Process)
|
|
2359
|
-
**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
|
|
2360
|
-
@
|
|
2207
|
+
**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
|
|
2361
2208
|
**Access**: public
|
|
2362
2209
|
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2363
2210
|
|
|
@@ -2370,14 +2217,7 @@ Get the search info of a organization process
|
|
|
2370
2217
|
|
|
2371
2218
|
**Example**
|
|
2372
2219
|
```js
|
|
2373
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2374
|
-
const api = new API();
|
|
2375
|
-
const params = {
|
|
2376
|
-
orgProcessId: '5dadd01dc4af3941d42f8c67',
|
|
2377
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2378
|
-
}
|
|
2379
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2380
|
-
const retSearchInfo = await api.user.process.getOrgProcessSearchInfo(params, session);
|
|
2220
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2381
2221
|
orgProcessId: '5dadd01dc4af3941d42f8c67',
|
|
2382
2222
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2383
2223
|
```
|
|
2384
2224
|
<a name="Process+find"></a>
|
|
2385
2225
|
|
|
@@ -2398,14 +2238,7 @@ Method to search processes
|
|
|
2398
2238
|
|
|
2399
2239
|
**Example**
|
|
2400
2240
|
```js
|
|
2401
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2402
|
-
const api = new API();
|
|
2403
|
-
const params = {
|
|
2404
|
-
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2405
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2406
|
-
};
|
|
2407
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2408
|
-
const retSearch = await api.user.process.find(params, session);
|
|
2241
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2409
2242
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2410
2243
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2411
2244
|
```
|
|
2412
2245
|
<a name="Process+remove"></a>
|
|
2413
2246
|
|
|
@@ -2425,14 +2258,7 @@ Method to remove process
|
|
|
2425
2258
|
|
|
2426
2259
|
**Example**
|
|
2427
2260
|
```js
|
|
2428
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2429
|
-
const api = new API();
|
|
2430
|
-
const params = {
|
|
2431
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2432
|
-
processId: '55e4a3bd6be6b45210833fae'
|
|
2433
|
-
};
|
|
2434
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2435
|
-
const retSearch = await api.user.process.remove(params, session);
|
|
2261
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2436
2262
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2437
2263
|
processId: '55e4a3bd6be6b45210833fae'
|
|
2438
2264
|
```
|
|
2439
2265
|
<a name="Process+exportStatusData"></a>
|
|
2440
2266
|
|
|
@@ -2452,14 +2278,7 @@ Method to export status data
|
|
|
2452
2278
|
|
|
2453
2279
|
**Example**
|
|
2454
2280
|
```js
|
|
2455
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2456
|
-
const api = new API();
|
|
2457
|
-
const params = {
|
|
2458
|
-
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2459
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2460
|
-
};
|
|
2461
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2462
|
-
const retSearch = await api.user.process.exportStatusData(params, session);
|
|
2281
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2463
2282
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2464
2283
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2465
2284
|
```
|
|
2466
2285
|
<a name="Process+exportProcessData"></a>
|
|
2467
2286
|
|
|
@@ -2479,14 +2298,7 @@ Method to export process data
|
|
|
2479
2298
|
|
|
2480
2299
|
**Example**
|
|
2481
2300
|
```js
|
|
2482
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2483
|
-
const api = new API();
|
|
2484
|
-
const params = {
|
|
2485
|
-
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2486
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2487
|
-
};
|
|
2488
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2489
|
-
const retSearch = await api.user.process.exportProcessData(params, session);
|
|
2301
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2490
2302
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2491
2303
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2492
2304
|
```
|
|
2493
2305
|
<a name="Process+processDocs"></a>
|
|
2494
2306
|
|
|
@@ -2508,15 +2320,7 @@ Method to get Process Docs
|
|
|
2508
2320
|
|
|
2509
2321
|
**Example**
|
|
2510
2322
|
```js
|
|
2511
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2512
|
-
const api = new API();
|
|
2513
|
-
const params = {
|
|
2514
|
-
orgProcessId: '55e4a3bd6be6b45210833fae',
|
|
2515
|
-
processId: '55e4a3bd6be6b45210833fae',
|
|
2516
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2517
|
-
};
|
|
2518
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2519
|
-
const retSearch = await api.user.process.processDocs(params, session);
|
|
2323
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2520
2324
|
orgProcessId: '55e4a3bd6be6b45210833fae',
|
|
2521
2325
|
processId: '55e4a3bd6be6b45210833fae',
|
|
2522
2326
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2523
2327
|
```
|
|
2524
2328
|
<a name="Process+downloadDocs"></a>
|
|
2525
2329
|
|
|
@@ -2539,16 +2343,7 @@ Method to download the process documents
|
|
|
2539
2343
|
|
|
2540
2344
|
**Example**
|
|
2541
2345
|
```js
|
|
2542
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2543
|
-
const api = new API();
|
|
2544
|
-
const params = {
|
|
2545
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2546
|
-
type: 'Docs',
|
|
2547
|
-
docIds: ['55e4a3bd6be6b45210833fae'],
|
|
2548
|
-
footer: 'Documento - {page} de {pages}'
|
|
2549
|
-
};
|
|
2550
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2551
|
-
const result = await api.user.process.downloadDocs(params, session);
|
|
2346
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2552
2347
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2553
2348
|
type: 'Docs',
|
|
2554
2349
|
docIds: ['55e4a3bd6be6b45210833fae'],
|
|
2555
2350
|
footer: 'Documento - {page} de {pages}'
|
|
2556
2351
|
```
|
|
2557
2352
|
<a name="Register"></a>
|
|
2558
2353
|
|
|
@@ -2576,12 +2371,7 @@ Class for user registration in a user
|
|
|
2576
2371
|
|
|
2577
2372
|
**Example**
|
|
2578
2373
|
```js
|
|
2579
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2580
|
-
const api = new API();
|
|
2581
|
-
const params = {
|
|
2582
|
-
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...'
|
|
2583
|
-
};
|
|
2584
|
-
const orgname = await api.user.register.getOrgname(params);
|
|
2374
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2585
2375
|
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...'
|
|
2586
2376
|
```
|
|
2587
2377
|
<a name="Register+validateEmail"></a>
|
|
2588
2378
|
|
|
@@ -2601,13 +2391,7 @@ Method to find task by id
|
|
|
2601
2391
|
|
|
2602
2392
|
**Example**
|
|
2603
2393
|
```js
|
|
2604
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2605
|
-
const api = new API();
|
|
2606
|
-
const params = {
|
|
2607
|
-
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2608
|
-
email: 'myemail@company.com'
|
|
2609
|
-
};
|
|
2610
|
-
const retData = await api.user.register.validateEmail(params);
|
|
2394
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2611
2395
|
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2612
2396
|
email: 'myemail@company.com'
|
|
2613
2397
|
```
|
|
2614
2398
|
<a name="Register+execute"></a>
|
|
2615
2399
|
|
|
@@ -2641,30 +2425,7 @@ Method to register a user
|
|
|
2641
2425
|
|
|
2642
2426
|
**Example**
|
|
2643
2427
|
```js
|
|
2644
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2645
|
-
const api = new API();
|
|
2646
|
-
const params ={
|
|
2647
|
-
"registerId": 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2648
|
-
"type": 'sign',
|
|
2649
|
-
"login": false,
|
|
2650
|
-
"emailInfo": {
|
|
2651
|
-
"code": "5974",
|
|
2652
|
-
"email": "cbtoto_1@mailinator.com"
|
|
2653
|
-
},
|
|
2654
|
-
"registerData": {
|
|
2655
|
-
"name": "Augusto Totlo",
|
|
2656
|
-
"registerEmail": "cbtoto_1@mailinator.com",
|
|
2657
|
-
"phone": "",
|
|
2658
|
-
"idcard": "",
|
|
2659
|
-
"dob": "1978-01-12T03:00:00.000Z",
|
|
2660
|
-
"registerPassword": "123456",
|
|
2661
|
-
"emailValidationCode": "5974",
|
|
2662
|
-
"phoneValidationCode": "",
|
|
2663
|
-
"language": "en-US",
|
|
2664
|
-
"timezone": "Europe/Dublin"
|
|
2665
|
-
}
|
|
2666
|
-
};
|
|
2667
|
-
const retData = await api.user.register.execute(params);
|
|
2428
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2668
2429
|
"registerId": 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2669
2430
|
"type": 'sign',
|
|
2670
2431
|
"login": false,
|
|
2671
2432
|
"emailInfo": {
|
|
2672
2433
|
"code": "5974",
|
|
2673
2434
|
"email": "cbtoto_1@mailinator.com"
|
|
2674
2435
|
},
|
|
2675
2436
|
"registerData": {
|
|
2676
2437
|
"name": "Augusto Totlo",
|
|
2677
2438
|
"registerEmail": "cbtoto_1@mailinator.com",
|
|
2678
2439
|
"phone": "",
|
|
2679
2440
|
"idcard": "",
|
|
2680
2441
|
"dob": "1978-01-12T03:00:00.000Z",
|
|
2681
2442
|
"registerPassword": "123456",
|
|
2682
2443
|
"emailValidationCode": "5974",
|
|
2683
2444
|
"phoneValidationCode": "",
|
|
2684
2445
|
"language": "en-US",
|
|
2685
2446
|
"timezone": "Europe/Dublin"
|
|
2686
2447
|
}
|
|
2687
2448
|
};
|
|
2688
2449
|
```
|
|
2689
2450
|
<a name="Settings"></a>
|
|
2690
2451
|
|
|
@@ -2694,13 +2455,7 @@ Adds/updates a user settings
|
|
|
2694
2455
|
|
|
2695
2456
|
**Example**
|
|
2696
2457
|
```js
|
|
2697
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2698
|
-
const api = new API();
|
|
2699
|
-
const settings = {
|
|
2700
|
-
areaId: '55e4a3bd6be6b45210833fae'
|
|
2701
|
-
};
|
|
2702
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2703
|
-
await api.user.settings.upsert(settings, session);
|
|
2458
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2704
2459
|
areaId: '55e4a3bd6be6b45210833fae'
|
|
2705
2460
|
```
|
|
2706
2461
|
<a name="Settings+get"></a>
|
|
2707
2462
|
|
|
@@ -2717,10 +2472,7 @@ Gets the user settings. Returns an array of settings.
|
|
|
2717
2472
|
|
|
2718
2473
|
**Example**
|
|
2719
2474
|
```js
|
|
2720
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2721
|
-
const api = new API();
|
|
2722
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2723
|
-
ret settings = await api.user.settings.get(session);
|
|
2475
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2724
2476
|
```
|
|
2725
2477
|
<a name="Settings+remove"></a>
|
|
2726
2478
|
|
|
@@ -2737,10 +2489,60 @@ Removes the user settings
|
|
|
2737
2489
|
|
|
2738
2490
|
**Example**
|
|
2739
2491
|
```js
|
|
2740
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2492
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2493
|
+
```
|
|
2494
|
+
<a name="TaskAvailable"></a>
|
|
2495
|
+
|
|
2496
|
+
## TaskAvailable
|
|
2497
|
+
Class for available tasks, permission user
|
|
2498
|
+
|
|
2499
|
+
**Kind**: global class
|
|
2500
|
+
|
|
2501
|
+
* [TaskAvailable](#TaskAvailable)
|
|
2502
|
+
* [.find(params, session)](#TaskAvailable+find) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
2503
|
+
* [.claim(params, session)](#TaskAvailable+claim) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2504
|
+
|
|
2505
|
+
<a name="TaskAvailable+find"></a>
|
|
2506
|
+
|
|
2507
|
+
### taskAvailable.find(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
2508
|
+
Method to find available tasks for a user
|
|
2509
|
+
|
|
2510
|
+
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
2511
|
+
**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
|
|
2512
|
+
**Access**: public
|
|
2513
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2514
|
+
|
|
2515
|
+
| Param | Type | Description |
|
|
2516
|
+
| --- | --- | --- |
|
|
2517
|
+
| params | <code>object</code> | Params to get task |
|
|
2518
|
+
| params.query | <code>object</code> | Search available tasks query |
|
|
2519
|
+
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
2520
|
+
| session | <code>string</code> | Session, token JWT |
|
|
2521
|
+
|
|
2522
|
+
**Example**
|
|
2523
|
+
```js
|
|
2524
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2744
2525
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2745
2526
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2527
|
+
```
|
|
2528
|
+
<a name="TaskAvailable+claim"></a>
|
|
2529
|
+
|
|
2530
|
+
### taskAvailable.claim(params, session) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2531
|
+
Method for a user to claim an available task
|
|
2532
|
+
|
|
2533
|
+
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
2534
|
+
**Returns**: <code>promise</code> - returned data from the method call<code>boolean</code> - success true|false if the method was successful
|
|
2535
|
+
**Access**: public
|
|
2536
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2537
|
+
|
|
2538
|
+
| Param | Type | Description |
|
|
2539
|
+
| --- | --- | --- |
|
|
2540
|
+
| params | <code>object</code> | Params to get task |
|
|
2541
|
+
| params.taskId | <code>object</code> | the task id to claim |
|
|
2542
|
+
| params.orgname | <code>object</code> | Organization slug (short name of the orgnization) |
|
|
2543
|
+
| session | <code>string</code> | Session, token JWT |
|
|
2544
|
+
|
|
2545
|
+
**Example**
|
|
2546
|
+
```js
|
|
2547
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2746
2548
|
taskId: '55e4a3bd6be6b45210833f67',
|
|
2747
2549
|
orgname: 'acme',
|
|
2748
2550
|
```
|
|
2749
2551
|
<a name="Task"></a>
|
|
2750
2552
|
|
|
@@ -2773,15 +2575,7 @@ Method to find task by id
|
|
|
2773
2575
|
|
|
2774
2576
|
**Example**
|
|
2775
2577
|
```js
|
|
2776
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2777
|
-
const api = new API();
|
|
2778
|
-
const params = {
|
|
2779
|
-
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2780
|
-
taskId: '5df7f19618430c89a41a19d2',
|
|
2781
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2782
|
-
};
|
|
2783
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2784
|
-
await api.user.task.findById(params, session);
|
|
2578
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2785
2579
|
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2786
2580
|
taskId: '5df7f19618430c89a41a19d2',
|
|
2787
2581
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2788
2582
|
```
|
|
2789
2583
|
<a name="Task+findByIdAndUpdate"></a>
|
|
2790
2584
|
|
|
@@ -2807,17 +2601,7 @@ Find task by id and update
|
|
|
2807
2601
|
|
|
2808
2602
|
**Example**
|
|
2809
2603
|
```js
|
|
2810
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2811
|
-
const api = new API();
|
|
2812
|
-
const params = {
|
|
2813
|
-
userId: '5739d4c6ccb0ebc61f2a9557',
|
|
2814
|
-
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2815
|
-
taskId: '5df7f19618430c89a41a19d2',
|
|
2816
|
-
action: 1,
|
|
2817
|
-
formData: {name: 'CloudBrasil'},
|
|
2818
|
-
};
|
|
2819
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2820
|
-
await api.user.task.findByIdAndUpdate(params, session);
|
|
2604
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2821
2605
|
userId: '5739d4c6ccb0ebc61f2a9557',
|
|
2822
2606
|
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2823
2607
|
taskId: '5df7f19618430c89a41a19d2',
|
|
2824
2608
|
action: 1,
|
|
2825
2609
|
formData: {name: 'CloudBrasil'},
|
|
2826
2610
|
```
|
|
2827
2611
|
<a name="Task+executeActionFinalize"></a>
|
|
2828
2612
|
|
|
@@ -2839,109 +2623,30 @@ Find task by id and update
|
|
|
2839
2623
|
|
|
2840
2624
|
**Example**
|
|
2841
2625
|
```js
|
|
2842
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2843
|
-
const api = new API();
|
|
2844
|
-
const params = {
|
|
2845
|
-
taskId: '5df7f19618430c89a41a19d2',
|
|
2846
|
-
actionGuid: 'b3823a2ae52c7a05bfb9590fe427038d'
|
|
2847
|
-
orgId: '5df7f19618430c89a41a1bc3',
|
|
2848
|
-
payload: {}',
|
|
2849
|
-
};
|
|
2850
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2851
|
-
await api.user.task.executeActionFinalize(params, session);
|
|
2626
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2852
2627
|
taskId: '5df7f19618430c89a41a19d2',
|
|
2853
2628
|
actionGuid: 'b3823a2ae52c7a05bfb9590fe427038d'
|
|
2854
2629
|
orgId: '5df7f19618430c89a41a1bc3',
|
|
2855
2630
|
payload: {}',
|
|
2856
2631
|
```
|
|
2857
|
-
<a name="
|
|
2632
|
+
<a name="Updates"></a>
|
|
2858
2633
|
|
|
2859
|
-
##
|
|
2860
|
-
Class for
|
|
2634
|
+
## Updates
|
|
2635
|
+
Class for user registration in a user
|
|
2861
2636
|
|
|
2862
2637
|
**Kind**: global class
|
|
2638
|
+
<a name="Updates+get"></a>
|
|
2863
2639
|
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
* [.claim(params, session)](#TaskAvailable+claim) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2640
|
+
### updates.get(session)
|
|
2641
|
+
get updates
|
|
2867
2642
|
|
|
2868
|
-
<
|
|
2643
|
+
**Kind**: instance method of [<code>Updates</code>](#Updates)
|
|
2644
|
+
**Access**: public
|
|
2645
|
+
**Author**: Augusto Pissarra <abernardo.br@gmail.com>
|
|
2869
2646
|
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
2874
|
-
**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
|
|
2875
|
-
**Access**: public
|
|
2876
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2877
|
-
|
|
2878
|
-
| Param | Type | Description |
|
|
2879
|
-
| --- | --- | --- |
|
|
2880
|
-
| params | <code>object</code> | Params to get task |
|
|
2881
|
-
| params.query | <code>object</code> | Search available tasks query |
|
|
2882
|
-
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
2883
|
-
| session | <code>string</code> | Session, token JWT |
|
|
2647
|
+
| Param | Type | Description |
|
|
2648
|
+
| --- | --- | --- |
|
|
2649
|
+
| session | <code>string</code> | JWT token |
|
|
2884
2650
|
|
|
2885
2651
|
**Example**
|
|
2886
2652
|
```js
|
|
2887
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2888
|
-
const api = new API();
|
|
2889
|
-
const params = {
|
|
2890
|
-
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2891
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2892
|
-
};
|
|
2893
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2894
|
-
const retSearch = await api.user.task.available.find(params, session);
|
|
2895
|
-
```
|
|
2896
|
-
<a name="TaskAvailable+claim"></a>
|
|
2897
|
-
|
|
2898
|
-
### taskAvailable.claim(params, session) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2899
|
-
Method for a user to claim an available task
|
|
2900
|
-
|
|
2901
|
-
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
2902
|
-
**Returns**: <code>promise</code> - returned data from the method call<code>boolean</code> - success true|false if the method was successful
|
|
2903
|
-
**Access**: public
|
|
2904
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2905
|
-
|
|
2906
|
-
| Param | Type | Description |
|
|
2907
|
-
| --- | --- | --- |
|
|
2908
|
-
| params | <code>object</code> | Params to get task |
|
|
2909
|
-
| params.taskId | <code>object</code> | the task id to claim |
|
|
2910
|
-
| params.orgname | <code>object</code> | Organization slug (short name of the orgnization) |
|
|
2911
|
-
| session | <code>string</code> | Session, token JWT |
|
|
2912
|
-
|
|
2913
|
-
**Example**
|
|
2914
|
-
```js
|
|
2915
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2916
|
-
const api = new API();
|
|
2917
|
-
const params = {
|
|
2918
|
-
taskId: '55e4a3bd6be6b45210833f67',
|
|
2919
|
-
orgname: 'acme',
|
|
2920
|
-
};
|
|
2921
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2922
|
-
const success = await api.user.task.available.claim(params, session);
|
|
2923
|
-
```
|
|
2924
|
-
<a name="Updates"></a>
|
|
2925
|
-
|
|
2926
|
-
## Updates
|
|
2927
|
-
Class for user registration in a user
|
|
2928
|
-
|
|
2929
|
-
**Kind**: global class
|
|
2930
|
-
<a name="Updates+get"></a>
|
|
2931
|
-
|
|
2932
|
-
### updates.get(session)
|
|
2933
|
-
get updates
|
|
2934
|
-
|
|
2935
|
-
**Kind**: instance method of [<code>Updates</code>](#Updates)
|
|
2936
|
-
**Access**: public
|
|
2937
|
-
**Author**: Augusto Pissarra <abernardo.br@gmail.com>
|
|
2938
|
-
|
|
2939
|
-
| Param | Type | Description |
|
|
2940
|
-
| --- | --- | --- |
|
|
2941
|
-
| session | <code>string</code> | JWT token |
|
|
2942
|
-
|
|
2943
|
-
**Example**
|
|
2944
|
-
```js
|
|
2945
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2946
|
-
const api = new API();
|
|
2947
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2948
|
-
await api.user.updates.get(session);
|
|
2653
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2949
2654
|
```
|
|
2950
2655
|
<a name="User"></a>
|
|
2951
2656
|
|
|
@@ -2976,14 +2681,7 @@ Update avatar of user by session of user not allow session user SU
|
|
|
2976
2681
|
|
|
2977
2682
|
**Example**
|
|
2978
2683
|
```js
|
|
2979
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2980
|
-
const api = new API();
|
|
2981
|
-
const params = {
|
|
2982
|
-
avatar: '55e4a3bd6be6b45210833fae',
|
|
2983
|
-
type: '123456',
|
|
2984
|
-
};
|
|
2985
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2986
|
-
await api.user.profile.updateAvatar(params, session);
|
|
2684
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2987
2685
|
avatar: '55e4a3bd6be6b45210833fae',
|
|
2988
2686
|
type: '123456',
|
|
2989
2687
|
```
|
|
2990
2688
|
<a name="User+removeAvatar"></a>
|
|
2991
2689
|
|
|
@@ -3000,10 +2698,7 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
3000
2698
|
|
|
3001
2699
|
**Example**
|
|
3002
2700
|
```js
|
|
3003
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3004
|
-
const api = new API();
|
|
3005
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3006
|
-
await api.user.profile.removeAvatar(session);
|
|
2701
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3007
2702
|
```
|
|
3008
2703
|
<a name="User+removeSignature"></a>
|
|
3009
2704
|
|
|
@@ -3020,10 +2715,7 @@ Remove the signature of user by session
|
|
|
3020
2715
|
|
|
3021
2716
|
**Example**
|
|
3022
2717
|
```js
|
|
3023
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3024
|
-
const api = new API();
|
|
3025
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3026
|
-
await api.user.profile.removeSignature(session);
|
|
2718
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3027
2719
|
```
|
|
3028
2720
|
<a name="User+saveSignature"></a>
|
|
3029
2721
|
|
|
@@ -3043,23 +2735,7 @@ Sava a new signature of user by session
|
|
|
3043
2735
|
|
|
3044
2736
|
**Example**
|
|
3045
2737
|
```js
|
|
3046
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3047
|
-
const api = new API();
|
|
3048
|
-
const data = {
|
|
3049
|
-
type: 'CURSIVE',
|
|
3050
|
-
file: 'allura:Mary John Heart'
|
|
3051
|
-
};
|
|
3052
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3053
|
-
await api.user.profile.saveSignature(data, session);
|
|
3054
|
-
|
|
3055
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3056
|
-
const api = new API();
|
|
3057
|
-
const data = {
|
|
3058
|
-
type: 'HANDWRITE',
|
|
3059
|
-
file: 'iVBORw0KGgoAAAANSUhEUgAAAj...'
|
|
3060
|
-
};
|
|
3061
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3062
|
-
await api.user.profile.saveSignature(session);
|
|
2738
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3063
2739
|
type: 'CURSIVE',
|
|
3064
2740
|
file: 'allura:Mary John Heart'
|
|
3065
2741
|
type: 'HANDWRITE',
|
|
3066
2742
|
file: 'iVBORw0KGgoAAAANSUhEUgAAAj...'
|
|
3067
2743
|
```
|
|
3068
2744
|
<a name="User+findByIdAndUpdate"></a>
|
|
3069
2745
|
|
|
@@ -3093,13 +2769,7 @@ Update a user profile by id
|
|
|
3093
2769
|
|
|
3094
2770
|
**Example**
|
|
3095
2771
|
```js
|
|
3096
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3097
|
-
const api = new API();
|
|
3098
|
-
const params = {
|
|
3099
|
-
name: 'New Name'
|
|
3100
|
-
};
|
|
3101
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3102
|
-
await api.user.profile.findByIdAndUpdate(params, session);
|
|
2772
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3103
2773
|
name: 'New Name'
|
|
3104
2774
|
```
|
|
3105
2775
|
<a name="User+changeOrganization"></a>
|
|
3106
2776
|
|
|
@@ -3117,379 +2787,5 @@ Change a user's organization
|
|
|
3117
2787
|
|
|
3118
2788
|
**Example**
|
|
3119
2789
|
```js
|
|
3120
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3121
|
-
const api = new API();
|
|
3122
|
-
const id = '616eccaaa9360a05293b10fe';
|
|
3123
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3124
|
-
await api.user.changeOrganization.updateAvatar(id, session);
|
|
3125
|
-
```
|
|
3126
|
-
<a name="Dispatch"></a>
|
|
3127
|
-
|
|
3128
|
-
## Dispatch
|
|
3129
|
-
Api dispatch manager
|
|
3130
|
-
|
|
3131
|
-
**Kind**: global class
|
|
3132
|
-
|
|
3133
|
-
* [Dispatch](#Dispatch)
|
|
3134
|
-
* [.getContext(url, session)](#Dispatch+getContext) ⇒ <code>Promise.<object></code>
|
|
3135
|
-
* [.getClient()](#Dispatch+getClient) ⇒ <code>promise</code>
|
|
3136
|
-
|
|
3137
|
-
<a name="Dispatch+getContext"></a>
|
|
3138
|
-
|
|
3139
|
-
### dispatch.getContext(url, session) ⇒ <code>Promise.<object></code>
|
|
3140
|
-
Get the URL context
|
|
3141
|
-
|
|
3142
|
-
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
3143
|
-
**Returns**: <code>Promise.<object></code> - The full data context of the URL
|
|
3144
|
-
**Access**: public
|
|
3145
|
-
|
|
3146
|
-
| Param | Type | Default | Description |
|
|
3147
|
-
| --- | --- | --- | --- |
|
|
3148
|
-
| url | <code>string</code> | | Full url |
|
|
3149
|
-
| session | <code>session</code> | <code></code> | Session, token JWT |
|
|
3150
|
-
|
|
3151
|
-
**Example**
|
|
3152
|
-
```js
|
|
3153
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3154
|
-
const api = new API();
|
|
3155
|
-
const retContext = await api.dispatch.getContext('http://myndware.io/login/myorg);
|
|
3156
|
-
```
|
|
3157
|
-
<a name="Dispatch+getClient"></a>
|
|
3158
|
-
|
|
3159
|
-
### dispatch.getClient() ⇒ <code>promise</code>
|
|
3160
|
-
Get client Axios
|
|
3161
|
-
|
|
3162
|
-
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
3163
|
-
**Returns**: <code>promise</code> - return client axios
|
|
3164
|
-
**Access**: public
|
|
3165
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3166
|
-
**Example**
|
|
3167
|
-
```js
|
|
3168
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3169
|
-
const api = new API();
|
|
3170
|
-
await api.dispatch.getClient();
|
|
3171
|
-
```
|
|
3172
|
-
<a name="External"></a>
|
|
3173
|
-
|
|
3174
|
-
## External
|
|
3175
|
-
Class for documents, permission user
|
|
3176
|
-
|
|
3177
|
-
**Kind**: global class
|
|
3178
|
-
|
|
3179
|
-
* [External](#External)
|
|
3180
|
-
* [.context(params)](#External+context) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>array.<object></code>
|
|
3181
|
-
* [.getUploadDocumentSignedUrl(mime, authorization)](#External+getUploadDocumentSignedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3182
|
-
* [.getUploadDocumentsSignedUrl(docs, authorization)](#External+getUploadDocumentsSignedUrl) ⇒ <code>Promise.<array></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3183
|
-
* [.handle(authorization, params)](#External+handle) ⇒ <code>Promise.<boolean></code>
|
|
3184
|
-
|
|
3185
|
-
<a name="External+context"></a>
|
|
3186
|
-
|
|
3187
|
-
### external.context(params) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>array.<object></code>
|
|
3188
|
-
Create new document
|
|
3189
|
-
|
|
3190
|
-
**Kind**: instance method of [<code>External</code>](#External)
|
|
3191
|
-
**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
|
|
3192
|
-
The authorization is unique and is ONLY valid for this session.<code>array.<object></code> - groups the form groups to render
|
|
3193
|
-
**Access**: public
|
|
3194
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3195
|
-
|
|
3196
|
-
| Param | Type | Description |
|
|
3197
|
-
| --- | --- | --- |
|
|
3198
|
-
| params | <code>object</code> | Object for add new document |
|
|
3199
|
-
| params.id | <code>string</code> | Organization form id |
|
|
3200
|
-
|
|
3201
|
-
**Example**
|
|
3202
|
-
```js
|
|
3203
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3204
|
-
const api = new API();
|
|
3205
|
-
const params = {
|
|
3206
|
-
id: '611e679741cc63168c26d7ee'
|
|
3207
|
-
};
|
|
3208
|
-
const retForm = await api.external.context(params);
|
|
3209
|
-
```
|
|
3210
|
-
<a name="External+getUploadDocumentSignedUrl"></a>
|
|
3211
|
-
|
|
3212
|
-
### external.getUploadDocumentSignedUrl(mime, authorization) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3213
|
-
Get an upload signed url, so it will be possible to upload documents temporarily during the use of the external form
|
|
3214
|
-
|
|
3215
|
-
**Kind**: instance method of [<code>External</code>](#External)
|
|
3216
|
-
**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
|
|
3217
|
-
**Access**: public
|
|
3218
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3219
|
-
|
|
3220
|
-
| Param | Type | Description |
|
|
3221
|
-
| --- | --- | --- |
|
|
3222
|
-
| mime | <code>string</code> | the mime type of the document |
|
|
3223
|
-
| authorization | <code>string</code> | a legal authorization |
|
|
3224
|
-
|
|
3225
|
-
**Example**
|
|
3226
|
-
```js
|
|
3227
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3228
|
-
const api = new API();
|
|
3229
|
-
const authorization = '...';
|
|
3230
|
-
const doc = {
|
|
3231
|
-
mime: 'application/pdf'
|
|
3232
|
-
};
|
|
3233
|
-
const retDoc = await api.external.getUploadDocumentSignedUrl(doc, authorization);
|
|
3234
|
-
```
|
|
3235
|
-
<a name="External+getUploadDocumentsSignedUrl"></a>
|
|
3236
|
-
|
|
3237
|
-
### external.getUploadDocumentsSignedUrl(docs, authorization) ⇒ <code>Promise.<array></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3238
|
-
Get an upload signed url, for many documents. So it will be possible to upload documents temporarily during the use of the external form
|
|
3239
|
-
|
|
3240
|
-
**Kind**: instance method of [<code>External</code>](#External)
|
|
3241
|
-
**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
|
|
3242
|
-
**Access**: public
|
|
3243
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3244
|
-
|
|
3245
|
-
| Param | Type | Description |
|
|
3246
|
-
| --- | --- | --- |
|
|
3247
|
-
| docs | <code>array.<object></code> | the list of documents |
|
|
3248
|
-
| docs.mime | <code>string</code> | the mime type of the document |
|
|
3249
|
-
| authorization | <code>string</code> | a legal authorization |
|
|
3250
|
-
|
|
3251
|
-
**Example**
|
|
3252
|
-
```js
|
|
3253
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3254
|
-
const api = new API();
|
|
3255
|
-
const authorization = '...';
|
|
3256
|
-
const docs = [
|
|
3257
|
-
{
|
|
3258
|
-
mime: 'application/pdf'
|
|
3259
|
-
}
|
|
3260
|
-
];
|
|
3261
|
-
const retDocs = await api.external.getUploadDocumentsSignedUrl(docs, authorization);
|
|
3262
|
-
```
|
|
3263
|
-
<a name="External+handle"></a>
|
|
3264
|
-
|
|
3265
|
-
### external.handle(authorization, params) ⇒ <code>Promise.<boolean></code>
|
|
3266
|
-
Handles the execution of an external form
|
|
3267
|
-
|
|
3268
|
-
**Kind**: instance method of [<code>External</code>](#External)
|
|
3269
|
-
**Returns**: <code>Promise.<boolean></code> - true|false if success
|
|
3270
|
-
**Access**: public
|
|
3271
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3272
|
-
|
|
3273
|
-
| Param | Type | Description |
|
|
3274
|
-
| --- | --- | --- |
|
|
3275
|
-
| authorization | <code>string</code> | a legal authorization |
|
|
3276
|
-
| params | <code>object</code> | the parameters to handle the execution of an external form |
|
|
3277
|
-
| params.payload | <code>array.<object></code> | the payload of the external form. It should represent the form groups of the external form |
|
|
3278
|
-
| params.payload.name | <code>string</code> | the name of the group |
|
|
3279
|
-
| params.payload.fields | <code>array.<object></code> | the fields that belong to each group |
|
|
3280
|
-
| 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 |
|
|
3281
|
-
|
|
3282
|
-
**Example**
|
|
3283
|
-
```js
|
|
3284
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3285
|
-
const api = new API();
|
|
3286
|
-
const authorization = '...';
|
|
3287
|
-
const params = {
|
|
3288
|
-
payload: [
|
|
3289
|
-
{
|
|
3290
|
-
name: 'My Group One',
|
|
3291
|
-
fields: [
|
|
3292
|
-
{}
|
|
3293
|
-
]
|
|
3294
|
-
}
|
|
3295
|
-
]
|
|
3296
|
-
};
|
|
3297
|
-
const success = await api.external.handle(params, authorization);
|
|
3298
|
-
```
|
|
3299
|
-
<a name="Login"></a>
|
|
3300
|
-
|
|
3301
|
-
## Login
|
|
3302
|
-
Login manager
|
|
3303
|
-
|
|
3304
|
-
**Kind**: global class
|
|
3305
|
-
|
|
3306
|
-
* [Login](#Login)
|
|
3307
|
-
* [.facebook(params)](#Login+facebook) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3308
|
-
* [.google(params)](#Login+google) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3309
|
-
* [.apiKey(apikey)](#Login+apiKey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3310
|
-
* [.userPass(params)](#Login+userPass) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3311
|
-
* [.logout(session)](#Login+logout) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3312
|
-
* [.recover(username)](#Login+recover) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3313
|
-
|
|
3314
|
-
<a name="Login+facebook"></a>
|
|
3315
|
-
|
|
3316
|
-
### login.facebook(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3317
|
-
Login with social login Facebook
|
|
3318
|
-
|
|
3319
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3320
|
-
**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
|
|
3321
|
-
**Access**: public
|
|
3322
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3323
|
-
|
|
3324
|
-
| Param | Type | Description |
|
|
3325
|
-
| --- | --- | --- |
|
|
3326
|
-
| params | <code>object</code> | Params to login Facebook |
|
|
3327
|
-
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
3328
|
-
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
3329
|
-
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
3330
|
-
|
|
3331
|
-
**Example**
|
|
3332
|
-
```js
|
|
3333
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3334
|
-
|
|
3335
|
-
// Params of the instance
|
|
3336
|
-
const params = {...}
|
|
3337
|
-
const api = new API(params);
|
|
3338
|
-
const params = { accessToken: 'eyJhbGciOiJIUzI1NiIsInR5cC...' };
|
|
3339
|
-
const { auth, user } = await api.login.facebook(params);
|
|
3340
|
-
```
|
|
3341
|
-
<a name="Login+google"></a>
|
|
3342
|
-
|
|
3343
|
-
### login.google(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3344
|
-
Login with social login Google
|
|
3345
|
-
|
|
3346
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3347
|
-
**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
|
|
3348
|
-
**Access**: public
|
|
3349
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3350
|
-
|
|
3351
|
-
| Param | Type | Description |
|
|
3352
|
-
| --- | --- | --- |
|
|
3353
|
-
| params | <code>object</code> | Params to login Google |
|
|
3354
|
-
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
3355
|
-
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
3356
|
-
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
3357
|
-
|
|
3358
|
-
**Example**
|
|
3359
|
-
```js
|
|
3360
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3361
|
-
|
|
3362
|
-
// Params of the instance
|
|
3363
|
-
const params = {...}
|
|
3364
|
-
const api = new API(params);
|
|
3365
|
-
const accessToken = 'eyJhbGciOiJIUzI1NiIsInR5cC...';
|
|
3366
|
-
const { auth, user } = await api.login.google(accessToken);
|
|
3367
|
-
```
|
|
3368
|
-
<a name="Login+apiKey"></a>
|
|
3369
|
-
|
|
3370
|
-
### login.apiKey(apikey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3371
|
-
Login with apikey
|
|
3372
|
-
|
|
3373
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3374
|
-
**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
|
|
3375
|
-
**Access**: public
|
|
3376
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3377
|
-
|
|
3378
|
-
| Param | Type | Description |
|
|
3379
|
-
| --- | --- | --- |
|
|
3380
|
-
| apikey | <code>string</code> | Access key |
|
|
3381
|
-
|
|
3382
|
-
**Example**
|
|
3383
|
-
```js
|
|
3384
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3385
|
-
|
|
3386
|
-
// Params of the instance
|
|
3387
|
-
const params = {...}
|
|
3388
|
-
const api = new API(params);
|
|
3389
|
-
const apiKey = '043a0eb2-f5c3-4900-b781-7f229d00d092';
|
|
3390
|
-
const { auth, user } = await api.login.apiKey(apiKey);
|
|
3391
|
-
```
|
|
3392
|
-
<a name="Login+userPass"></a>
|
|
3393
|
-
|
|
3394
|
-
### login.userPass(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3395
|
-
Login with user and password
|
|
3396
|
-
|
|
3397
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3398
|
-
**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
|
|
3399
|
-
**Access**: public
|
|
3400
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3401
|
-
|
|
3402
|
-
| Param | Type | Description |
|
|
3403
|
-
| --- | --- | --- |
|
|
3404
|
-
| params | <code>object</code> | Object with user and password |
|
|
3405
|
-
| params.username | <code>string</code> | Username or email of the user |
|
|
3406
|
-
| params.password | <code>string</code> | Password of the user |
|
|
3407
|
-
| params.orgname | <code>string</code> | The organame of the user |
|
|
3408
|
-
|
|
3409
|
-
**Example**
|
|
3410
|
-
```js
|
|
3411
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3412
|
-
|
|
3413
|
-
// Params of the instance
|
|
3414
|
-
const params = {...}
|
|
3415
|
-
const api = new API(params);
|
|
3416
|
-
const params = {
|
|
3417
|
-
username: 'ana.silva@gmail.com',
|
|
3418
|
-
password: '123456'
|
|
3419
|
-
};
|
|
3420
|
-
const { auth, user } = await api.login.userPass(params);
|
|
3421
|
-
```
|
|
3422
|
-
<a name="Login+logout"></a>
|
|
3423
|
-
|
|
3424
|
-
### login.logout(session) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3425
|
-
Logout user system manager
|
|
3426
|
-
|
|
3427
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3428
|
-
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
3429
|
-
**Access**: public
|
|
3430
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3431
|
-
|
|
3432
|
-
| Param | Type | Description |
|
|
3433
|
-
| --- | --- | --- |
|
|
3434
|
-
| session | <code>string</code> | Session, token JWT |
|
|
3435
|
-
|
|
3436
|
-
**Example**
|
|
3437
|
-
```js
|
|
3438
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3439
|
-
|
|
3440
|
-
// Params of the instance
|
|
3441
|
-
const params = {...}
|
|
3442
|
-
const api = new API(params);
|
|
3443
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3444
|
-
const { success } = await api.login.logout(session);
|
|
3445
|
-
```
|
|
3446
|
-
<a name="Login+recover"></a>
|
|
3447
|
-
|
|
3448
|
-
### login.recover(username) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3449
|
-
Recover the password
|
|
3450
|
-
|
|
3451
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3452
|
-
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
3453
|
-
**Access**: public
|
|
3454
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3455
|
-
|
|
3456
|
-
| Param | Type | Description |
|
|
3457
|
-
| --- | --- | --- |
|
|
3458
|
-
| username | <code>string</code> | The username or email |
|
|
3459
|
-
|
|
3460
|
-
**Example**
|
|
3461
|
-
```js
|
|
3462
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3463
|
-
|
|
3464
|
-
// Params of the instance
|
|
3465
|
-
const params = {...}
|
|
3466
|
-
const api = new API(params);
|
|
3467
|
-
const { success } = await api.login.recover('myusername');
|
|
3468
|
-
```
|
|
3469
|
-
<a name="Session"></a>
|
|
3470
|
-
|
|
3471
|
-
## Session
|
|
3472
|
-
Session manager of the API
|
|
3473
|
-
|
|
3474
|
-
**Kind**: global class
|
|
3475
|
-
<a name="Session+information"></a>
|
|
3476
|
-
|
|
3477
|
-
### session.information(sessionId, suSessionId) ⇒ <code>Promise</code>
|
|
3478
|
-
Show information for session, thus validating the session (Valid token JWT)
|
|
3479
|
-
|
|
3480
|
-
**Kind**: instance method of [<code>Session</code>](#Session)
|
|
3481
|
-
**Access**: public
|
|
3482
|
-
|
|
3483
|
-
| Param | Type | Default | Description |
|
|
3484
|
-
| --- | --- | --- | --- |
|
|
3485
|
-
| sessionId | <code>string</code> | | The user session (JWT Token) |
|
|
3486
|
-
| suSessionId | <code>string</code> | <code>"sessionId"</code> | Given a JWT Token of a SU (SuperAdmin), allow to check session for another user. |
|
|
3487
|
-
|
|
3488
|
-
**Example**
|
|
3489
|
-
```js
|
|
3490
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3491
|
-
const api = new API();
|
|
3492
|
-
const sessionId = 'eyJhbFVBBiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3493
|
-
const suSessionId = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3494
|
-
await api.session.information(sessionId, suSessionId);
|
|
2790
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3495
2791
|
```
|