@docbrasil/api-systemmanager 1.1.1 → 1.1.4
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/application.js +2 -0
- package/api/user/index.js +1 -1
- package/api/user/my_tasks.js +95 -0
- package/api/user/task.js +2 -0
- package/dist/bundle.cjs +263 -1
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +540 -1233
- package/package.json +1 -1
- package/yarn-error.log +0 -4554
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>
|
|
@@ -58,6 +70,9 @@
|
|
|
58
70
|
<dt><a href="#Users">Users</a></dt>
|
|
59
71
|
<dd><p>API request, user permission level</p>
|
|
60
72
|
</dd>
|
|
73
|
+
<dt><a href="#MyTasks">MyTasks</a></dt>
|
|
74
|
+
<dd><p>Class for my tasks, permission user</p>
|
|
75
|
+
</dd>
|
|
61
76
|
<dt><a href="#Notification">Notification</a></dt>
|
|
62
77
|
<dd><p>Class for user registration in a user</p>
|
|
63
78
|
</dd>
|
|
@@ -73,30 +88,18 @@
|
|
|
73
88
|
<dt><a href="#Register">Register</a></dt>
|
|
74
89
|
<dd><p>Class for user registration in a user</p>
|
|
75
90
|
</dd>
|
|
76
|
-
<dt><a href="#Task">Task</a></dt>
|
|
77
|
-
<dd><p>Class for task, permission user</p>
|
|
78
|
-
</dd>
|
|
79
91
|
<dt><a href="#TaskAvailable">TaskAvailable</a></dt>
|
|
80
92
|
<dd><p>Class for available tasks, permission user</p>
|
|
81
93
|
</dd>
|
|
94
|
+
<dt><a href="#Task">Task</a></dt>
|
|
95
|
+
<dd><p>Class for task, permission user</p>
|
|
96
|
+
</dd>
|
|
82
97
|
<dt><a href="#Updates">Updates</a></dt>
|
|
83
98
|
<dd><p>Class for user registration in a user</p>
|
|
84
99
|
</dd>
|
|
85
100
|
<dt><a href="#User">User</a></dt>
|
|
86
101
|
<dd><p>Class for user, permission user</p>
|
|
87
102
|
</dd>
|
|
88
|
-
<dt><a href="#Dispatch">Dispatch</a></dt>
|
|
89
|
-
<dd><p>Api dispatch manager</p>
|
|
90
|
-
</dd>
|
|
91
|
-
<dt><a href="#External">External</a></dt>
|
|
92
|
-
<dd><p>Class for documents, permission user</p>
|
|
93
|
-
</dd>
|
|
94
|
-
<dt><a href="#Login">Login</a></dt>
|
|
95
|
-
<dd><p>Login manager</p>
|
|
96
|
-
</dd>
|
|
97
|
-
<dt><a href="#Session">Session</a></dt>
|
|
98
|
-
<dd><p>Session manager of the API</p>
|
|
99
|
-
</dd>
|
|
100
103
|
</dl>
|
|
101
104
|
|
|
102
105
|
<a name="AdminDocuments"></a>
|
|
@@ -132,33 +135,7 @@ Advanced search of document in elastic search ussing system manager
|
|
|
132
135
|
|
|
133
136
|
**Example**
|
|
134
137
|
```js
|
|
135
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
136
|
-
const api = new API();
|
|
137
|
-
const params = {
|
|
138
|
-
docId: '5edd11c46b6ce9729c2c297c',
|
|
139
|
-
query: {
|
|
140
|
-
"query": {
|
|
141
|
-
"bool": {
|
|
142
|
-
"minimum_should_match": 1,
|
|
143
|
-
"should": [
|
|
144
|
-
{
|
|
145
|
-
"match": {
|
|
146
|
-
"locationText.keyword": {
|
|
147
|
-
"query": "sao pau"
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
"wildcard": {
|
|
153
|
-
"locationText.normalized": "*sao pau*"
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
]
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
161
|
-
await api.admin.document.advancedSearch(params, session);
|
|
138
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
162
139
|
docId: '5edd11c46b6ce9729c2c297c',
|
|
163
140
|
query: {
|
|
164
141
|
"query": {
|
|
165
142
|
"bool": {
|
|
166
143
|
"minimum_should_match": 1,
|
|
167
144
|
"should": [
|
|
168
145
|
{
|
|
169
146
|
"match": {
|
|
170
147
|
"locationText.keyword": {
|
|
171
148
|
"query": "sao pau"
|
|
172
149
|
}
|
|
173
150
|
}
|
|
174
151
|
},
|
|
175
152
|
{
|
|
176
153
|
"wildcard": {
|
|
177
154
|
"locationText.normalized": "*sao pau*"
|
|
178
155
|
}
|
|
179
156
|
}
|
|
180
157
|
]
|
|
181
158
|
}
|
|
182
159
|
}
|
|
183
160
|
}
|
|
184
161
|
```
|
|
185
162
|
<a name="AdminDocuments+findById"></a>
|
|
186
163
|
|
|
@@ -178,14 +155,7 @@ Get document by id
|
|
|
178
155
|
|
|
179
156
|
**Example**
|
|
180
157
|
```js
|
|
181
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
182
|
-
const api = new API();
|
|
183
|
-
const params = {
|
|
184
|
-
docId: '5edd11c46b6ce9729c2c297c',
|
|
185
|
-
orgId: '55e4a3bd6be6b45210833fae'
|
|
186
|
-
};
|
|
187
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
188
|
-
await api.admin.document.findById(params, session);
|
|
158
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
189
159
|
docId: '5edd11c46b6ce9729c2c297c',
|
|
190
160
|
orgId: '55e4a3bd6be6b45210833fae'
|
|
191
161
|
```
|
|
192
162
|
<a name="AdminDocuments+signedUrl"></a>
|
|
193
163
|
|
|
@@ -206,25 +176,11 @@ Request signed url url to put or get
|
|
|
206
176
|
|
|
207
177
|
**Example**
|
|
208
178
|
```js
|
|
209
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
210
|
-
const api = new API();
|
|
211
|
-
const params - {
|
|
212
|
-
methodType: 'put',
|
|
213
|
-
docId: '5dadd01dc4af3941d42f8c5c'
|
|
214
|
-
};
|
|
215
|
-
const apiKey: '...';
|
|
216
|
-
const { docId, name, areaId, type, signedUrl } = await api.admin.document.signedUrl(params, apiKey);
|
|
179
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
217
180
|
methodType: 'put',
|
|
218
181
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
219
182
|
```
|
|
220
183
|
**Example**
|
|
221
184
|
```js
|
|
222
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
223
|
-
const api = new API();
|
|
224
|
-
const params - {
|
|
225
|
-
methodType: 'get',
|
|
226
|
-
docId: '5dadd01dc4af3941d42f8c5c'
|
|
227
|
-
};
|
|
228
|
-
const apiKey: '...';
|
|
229
|
-
const { signedUrl, imageType } = await api.admin.document.signedUrl(params, apiKey);
|
|
185
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
230
186
|
methodType: 'get',
|
|
231
187
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
232
188
|
```
|
|
233
189
|
<a name="AdminDocuments+updateContent"></a>
|
|
234
190
|
|
|
@@ -245,14 +201,7 @@ Update a document content
|
|
|
245
201
|
|
|
246
202
|
**Example**
|
|
247
203
|
```js
|
|
248
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
249
|
-
const api = new API();
|
|
250
|
-
const params - {
|
|
251
|
-
content: 'some text...',
|
|
252
|
-
docId: '5dadd01dc4af3941d42f8c5c'
|
|
253
|
-
};
|
|
254
|
-
const apiKey: '...';
|
|
255
|
-
await api.admin.document.updateContent(params, apiKey);
|
|
204
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
256
205
|
content: 'some text...',
|
|
257
206
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
258
207
|
```
|
|
259
208
|
<a name="AdminDocuments+updateAI"></a>
|
|
260
209
|
|
|
@@ -279,14 +228,7 @@ Update a document content
|
|
|
279
228
|
|
|
280
229
|
**Example**
|
|
281
230
|
```js
|
|
282
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
283
|
-
const api = new API();
|
|
284
|
-
const params - {
|
|
285
|
-
content: 'some text...',
|
|
286
|
-
docId: '5dadd01dc4af3941d42f8c5c'
|
|
287
|
-
};
|
|
288
|
-
const apiKey: '...';
|
|
289
|
-
await api.admin.document.updateContent(params, apiKey);
|
|
231
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
290
232
|
content: 'some text...',
|
|
291
233
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
292
234
|
```
|
|
293
235
|
<a name="AdminDocuments+getContent"></a>
|
|
294
236
|
|
|
@@ -307,14 +249,7 @@ Get the content of a document
|
|
|
307
249
|
|
|
308
250
|
**Example**
|
|
309
251
|
```js
|
|
310
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
311
|
-
const api = new API();
|
|
312
|
-
const params - {
|
|
313
|
-
page: '0',
|
|
314
|
-
docId: '5dadd01dc4af3941d42f8c5c'
|
|
315
|
-
};
|
|
316
|
-
const apiKey: '...';
|
|
317
|
-
await api.admin.document.getContent(params, apiKey);
|
|
252
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
318
253
|
page: '0',
|
|
319
254
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
320
255
|
```
|
|
321
256
|
<a name="AdminForm"></a>
|
|
322
257
|
|
|
@@ -345,14 +280,7 @@ Get advance form by ID
|
|
|
345
280
|
|
|
346
281
|
**Example**
|
|
347
282
|
```js
|
|
348
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
349
|
-
const api = new API();
|
|
350
|
-
const params = {
|
|
351
|
-
id: '55e4a3bd6be6b45210833fae',
|
|
352
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
353
|
-
};
|
|
354
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
355
|
-
await api.admin.form.findById(params, session);
|
|
283
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
356
284
|
id: '55e4a3bd6be6b45210833fae',
|
|
357
285
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
358
286
|
```
|
|
359
287
|
<a name="AdminForm+getFormList"></a>
|
|
360
288
|
|
|
@@ -376,13 +304,7 @@ Request signed url url to put or get
|
|
|
376
304
|
|
|
377
305
|
**Example**
|
|
378
306
|
```js
|
|
379
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
380
|
-
const api = new API();
|
|
381
|
-
const params - {
|
|
382
|
-
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
383
|
-
};
|
|
384
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
385
|
-
await api.user.form.getFormList(params, session);
|
|
307
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
386
308
|
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
387
309
|
```
|
|
388
310
|
<a name="Admin"></a>
|
|
389
311
|
|
|
@@ -429,14 +351,7 @@ Get list by ID
|
|
|
429
351
|
|
|
430
352
|
**Example**
|
|
431
353
|
```js
|
|
432
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
433
|
-
const api = new API();
|
|
434
|
-
const params = {
|
|
435
|
-
id: '55e4a3bd6be6b45210833fae',
|
|
436
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
437
|
-
};
|
|
438
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
439
|
-
await api.admin.list.findById(params, session);
|
|
354
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
440
355
|
id: '55e4a3bd6be6b45210833fae',
|
|
441
356
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
442
357
|
```
|
|
443
358
|
<a name="AdminLists+find"></a>
|
|
444
359
|
|
|
@@ -457,13 +372,7 @@ Get all lists
|
|
|
457
372
|
|
|
458
373
|
**Example**
|
|
459
374
|
```js
|
|
460
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
461
|
-
const api = new API();
|
|
462
|
-
const params = {
|
|
463
|
-
orgId: '55e4a3bd6be6b45210833fae'
|
|
464
|
-
};
|
|
465
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
466
|
-
await api.admin.list.find(params, session);
|
|
375
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
467
376
|
orgId: '55e4a3bd6be6b45210833fae'
|
|
468
377
|
```
|
|
469
378
|
<a name="AdminMessage"></a>
|
|
470
379
|
|
|
@@ -541,15 +450,7 @@ Send email, array with email list or send one email
|
|
|
541
450
|
|
|
542
451
|
**Example**
|
|
543
452
|
```js
|
|
544
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
545
|
-
const api = new API();
|
|
546
|
-
const params = {
|
|
547
|
-
subject: 'Test email',
|
|
548
|
-
message: '<h1>Hi!</h1>',
|
|
549
|
-
to: 'destination@gmail.com'
|
|
550
|
-
};
|
|
551
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
552
|
-
await api.admin.message.sendEmail(params, session);
|
|
453
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
553
454
|
subject: 'Test email',
|
|
554
455
|
message: '<h1>Hi!</h1>',
|
|
555
456
|
to: 'destination@gmail.com'
|
|
556
457
|
```
|
|
557
458
|
<a name="AdminNotification"></a>
|
|
558
459
|
|
|
@@ -598,15 +499,7 @@ Create notification
|
|
|
598
499
|
|
|
599
500
|
**Example**
|
|
600
501
|
```js
|
|
601
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
602
|
-
const api = new API();
|
|
603
|
-
const params = {
|
|
604
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
605
|
-
userId: '55e4a3bd6be6b45210833fae',
|
|
606
|
-
message: 'Olá como vai tudo bem?'
|
|
607
|
-
};
|
|
608
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
609
|
-
await api.admin.notifications.add(params, session);
|
|
502
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
610
503
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
611
504
|
userId: '55e4a3bd6be6b45210833fae',
|
|
612
505
|
message: 'Olá como vai tudo bem?'
|
|
613
506
|
```
|
|
614
507
|
<a name="AdminNotification+findById"></a>
|
|
615
508
|
|
|
@@ -626,14 +519,7 @@ Search notification using (notificationId or userId)
|
|
|
626
519
|
|
|
627
520
|
**Example**
|
|
628
521
|
```js
|
|
629
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
630
|
-
const api = new API();
|
|
631
|
-
const params = {
|
|
632
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
633
|
-
id: '55e4a3bd6be6b45210833fae',
|
|
634
|
-
};
|
|
635
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
636
|
-
await api.admin.notifications.findById(params, session);
|
|
522
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
637
523
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
638
524
|
id: '55e4a3bd6be6b45210833fae',
|
|
639
525
|
```
|
|
640
526
|
<a name="AdminNotification+findByIdAndUpdate"></a>
|
|
641
527
|
|
|
@@ -654,15 +540,7 @@ Update notification using (notificationId or userId)
|
|
|
654
540
|
|
|
655
541
|
**Example**
|
|
656
542
|
```js
|
|
657
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
658
|
-
const api = new API();
|
|
659
|
-
const params = {
|
|
660
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
661
|
-
id: '55e4a3bd6be6b45210833fae',
|
|
662
|
-
read: true
|
|
663
|
-
};
|
|
664
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
665
|
-
await api.admin.notifications.findByIdAndUpdate(params, session);
|
|
543
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
666
544
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
667
545
|
id: '55e4a3bd6be6b45210833fae',
|
|
668
546
|
read: true
|
|
669
547
|
```
|
|
670
548
|
<a name="AdminNotification+findByIdAndRemove"></a>
|
|
671
549
|
|
|
@@ -682,14 +560,7 @@ Delete notification using (notificationId or userId)
|
|
|
682
560
|
|
|
683
561
|
**Example**
|
|
684
562
|
```js
|
|
685
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
686
|
-
const api = new API();
|
|
687
|
-
const params = {
|
|
688
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
689
|
-
id: '55e4a3bd6be6b45210833fae',
|
|
690
|
-
};
|
|
691
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
692
|
-
await api.admin.notifications.findByIdAndDelete(params, session);
|
|
563
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
693
564
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
694
565
|
id: '55e4a3bd6be6b45210833fae',
|
|
695
566
|
```
|
|
696
567
|
<a name="Organization"></a>
|
|
697
568
|
|
|
@@ -726,15 +597,7 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
726
597
|
|
|
727
598
|
**Example**
|
|
728
599
|
```js
|
|
729
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
730
|
-
const api = new API();
|
|
731
|
-
const params = {
|
|
732
|
-
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
733
|
-
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
734
|
-
type: 'image/png',
|
|
735
|
-
};
|
|
736
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
737
|
-
await api.admin.organizations.upsertAvatar(params, session);
|
|
600
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
738
601
|
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
739
602
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
740
603
|
type: 'image/png',
|
|
741
604
|
```
|
|
742
605
|
<a name="Organization+removeAvatar"></a>
|
|
743
606
|
|
|
@@ -752,11 +615,7 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
752
615
|
|
|
753
616
|
**Example**
|
|
754
617
|
```js
|
|
755
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
756
|
-
const api = new API();
|
|
757
|
-
const orgId = '5dadd01dc4af3941d42f8c5c';
|
|
758
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
759
|
-
await api.admin.organizations.removeAvatar(orgId, session);
|
|
618
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
760
619
|
```
|
|
761
620
|
<a name="Organization+findById"></a>
|
|
762
621
|
|
|
@@ -774,11 +633,7 @@ Find organization by id
|
|
|
774
633
|
|
|
775
634
|
**Example**
|
|
776
635
|
```js
|
|
777
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
778
|
-
const api = new API();
|
|
779
|
-
const orgId = '80443245000122';
|
|
780
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
781
|
-
await api.user.organization.findById(idCard, session);
|
|
636
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
782
637
|
```
|
|
783
638
|
<a name="Organization+idCardExist"></a>
|
|
784
639
|
|
|
@@ -796,11 +651,7 @@ Check if id card exist
|
|
|
796
651
|
|
|
797
652
|
**Example**
|
|
798
653
|
```js
|
|
799
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
800
|
-
const api = new API();
|
|
801
|
-
const idCard = '80443245000122';
|
|
802
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
803
|
-
await api.user.organization.idCardExist(idCard, session);
|
|
654
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
804
655
|
```
|
|
805
656
|
<a name="Organization+upsertAvatar"></a>
|
|
806
657
|
|
|
@@ -820,14 +671,7 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
820
671
|
|
|
821
672
|
**Example**
|
|
822
673
|
```js
|
|
823
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
824
|
-
const api = new API();
|
|
825
|
-
const params = {
|
|
826
|
-
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
827
|
-
type: 'image/png',
|
|
828
|
-
};
|
|
829
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
830
|
-
await api.user.profile.updateAvatar(params, session);
|
|
674
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
831
675
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
832
676
|
type: 'image/png',
|
|
833
677
|
```
|
|
834
678
|
<a name="Organization+removeAvatar"></a>
|
|
835
679
|
|
|
@@ -844,10 +688,7 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
844
688
|
|
|
845
689
|
**Example**
|
|
846
690
|
```js
|
|
847
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
848
|
-
const api = new API();
|
|
849
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
850
|
-
await api.user.profile.removeAvatar(session);
|
|
691
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
851
692
|
```
|
|
852
693
|
<a name="Organization+callFetch"></a>
|
|
853
694
|
|
|
@@ -867,14 +708,7 @@ Call URL internal, need auth JWT (session)
|
|
|
867
708
|
|
|
868
709
|
**Example**
|
|
869
710
|
```js
|
|
870
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
871
|
-
const api = new API();
|
|
872
|
-
|
|
873
|
-
const params = {
|
|
874
|
-
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
875
|
-
method: 'POST'
|
|
876
|
-
}
|
|
877
|
-
await api.user.organization.callFetchs(params, session);
|
|
711
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
878
712
|
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
879
713
|
method: 'POST'
|
|
880
714
|
```
|
|
881
715
|
<a name="AdminPlugin"></a>
|
|
882
716
|
|
|
@@ -904,11 +738,7 @@ Find plugins
|
|
|
904
738
|
|
|
905
739
|
**Example**
|
|
906
740
|
```js
|
|
907
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
908
|
-
const api = new API();
|
|
909
|
-
const params = {page: 1, perPage: 200};
|
|
910
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
911
|
-
await api.user.organization.findById(params, session);
|
|
741
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
912
742
|
```
|
|
913
743
|
<a name="AdminPlugin+findById"></a>
|
|
914
744
|
|
|
@@ -926,11 +756,7 @@ Get plugin by ID
|
|
|
926
756
|
|
|
927
757
|
**Example**
|
|
928
758
|
```js
|
|
929
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
930
|
-
const api = new API();
|
|
931
|
-
const id ='55e4a3bd6be6b45210833fae',
|
|
932
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
933
|
-
await api.admin.plugin.findById(id, session);
|
|
759
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
934
760
|
```
|
|
935
761
|
<a name="AdminPolicy"></a>
|
|
936
762
|
|
|
@@ -953,10 +779,7 @@ Find all policies
|
|
|
953
779
|
|
|
954
780
|
**Example**
|
|
955
781
|
```js
|
|
956
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
957
|
-
const api = new API();
|
|
958
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
959
|
-
await api.admin.policy.find(session);
|
|
782
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
960
783
|
```
|
|
961
784
|
<a name="AdminProcesses"></a>
|
|
962
785
|
|
|
@@ -980,16 +803,7 @@ Advanced search of processes, check documentation, to verify all params, pass to
|
|
|
980
803
|
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
981
804
|
**Example**
|
|
982
805
|
```js
|
|
983
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
984
|
-
const api = new API();
|
|
985
|
-
const params = {
|
|
986
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
987
|
-
...
|
|
988
|
-
...
|
|
989
|
-
...
|
|
990
|
-
};
|
|
991
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
992
|
-
await api.admin.processes.search(params, session);
|
|
806
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
993
807
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
994
808
|
...
|
|
995
809
|
...
|
|
996
810
|
...
|
|
997
811
|
```
|
|
998
812
|
<a name="AdminProcesses+advancedSearch"></a>
|
|
999
813
|
|
|
@@ -1009,23 +823,7 @@ Advanced search of process in elastic search ussing system manager
|
|
|
1009
823
|
|
|
1010
824
|
**Example**
|
|
1011
825
|
```js
|
|
1012
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1013
|
-
const api = new API();
|
|
1014
|
-
const params = {
|
|
1015
|
-
orgProcessId: '5edd11c46b6ce9729c2c297c',
|
|
1016
|
-
query: {
|
|
1017
|
-
"_source": "processData.properties.processProperties",
|
|
1018
|
-
"query": {
|
|
1019
|
-
"term": {
|
|
1020
|
-
"initParams.email.keyword": {
|
|
1021
|
-
"value": "clintes001@gmail.com"
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1028
|
-
await api.admin.processes.advancedSearch(params, session);
|
|
826
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1029
827
|
orgProcessId: '5edd11c46b6ce9729c2c297c',
|
|
1030
828
|
query: {
|
|
1031
829
|
"_source": "processData.properties.processProperties",
|
|
1032
830
|
"query": {
|
|
1033
831
|
"term": {
|
|
1034
832
|
"initParams.email.keyword": {
|
|
1035
833
|
"value": "clintes001@gmail.com"
|
|
1036
834
|
}
|
|
1037
835
|
}
|
|
1038
836
|
}
|
|
1039
837
|
}
|
|
1040
838
|
```
|
|
1041
839
|
<a name="AdminTask"></a>
|
|
1042
840
|
|
|
@@ -1056,13 +854,7 @@ Get task by user Id
|
|
|
1056
854
|
|
|
1057
855
|
**Example**
|
|
1058
856
|
```js
|
|
1059
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1060
|
-
const api = new API();
|
|
1061
|
-
const params = {
|
|
1062
|
-
userId: '55e4a3bd6be6b45210833fae',
|
|
1063
|
-
};
|
|
1064
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1065
|
-
await api.admin.task.find(params, session);
|
|
857
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1066
858
|
userId: '55e4a3bd6be6b45210833fae',
|
|
1067
859
|
```
|
|
1068
860
|
<a name="AdminUser"></a>
|
|
1069
861
|
|
|
@@ -1096,11 +888,7 @@ Request profile by userId
|
|
|
1096
888
|
|
|
1097
889
|
**Example**
|
|
1098
890
|
```js
|
|
1099
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1100
|
-
const api = new API();
|
|
1101
|
-
const userId = '55e4a3bd6be6b45210833fae';
|
|
1102
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1103
|
-
await api.admin.user.findById(userId, session);
|
|
891
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1104
892
|
```
|
|
1105
893
|
<a name="AdminUser+findByIds"></a>
|
|
1106
894
|
|
|
@@ -1118,11 +906,7 @@ Request profile by userId
|
|
|
1118
906
|
|
|
1119
907
|
**Example**
|
|
1120
908
|
```js
|
|
1121
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1122
|
-
const api = new API();
|
|
1123
|
-
const userIds = ['55e4a3bd6be6b45210833fae', '55e4a3bd6be6b45210833fae'];
|
|
1124
|
-
const apiKey = 'c9bbd652-d112-454e-8595-f1669f49dde0';
|
|
1125
|
-
await api.admin.user.findByIds(userIds, apiKey);
|
|
909
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1126
910
|
```
|
|
1127
911
|
<a name="AdminUser+findByIdAndUpdatePassword"></a>
|
|
1128
912
|
|
|
@@ -1143,15 +927,7 @@ Update password by userId
|
|
|
1143
927
|
|
|
1144
928
|
**Example**
|
|
1145
929
|
```js
|
|
1146
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1147
|
-
const api = new API();
|
|
1148
|
-
const params = {
|
|
1149
|
-
userId: '55e4a3bd6be6b45210833fae',
|
|
1150
|
-
oldPassword: '123456',
|
|
1151
|
-
newPassword: '123456789'
|
|
1152
|
-
};
|
|
1153
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1154
|
-
await api.admin.user.findByIdAndUpdatePassword(params, session);
|
|
930
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1155
931
|
userId: '55e4a3bd6be6b45210833fae',
|
|
1156
932
|
oldPassword: '123456',
|
|
1157
933
|
newPassword: '123456789'
|
|
1158
934
|
```
|
|
1159
935
|
<a name="AdminUser+emailExist"></a>
|
|
1160
936
|
|
|
@@ -1169,11 +945,7 @@ Check if email is unique
|
|
|
1169
945
|
|
|
1170
946
|
**Example**
|
|
1171
947
|
```js
|
|
1172
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1173
|
-
const api = new API();
|
|
1174
|
-
const email = 'ana.silva@gmail.com';
|
|
1175
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1176
|
-
await api.admin.user.emailExist(email, session);
|
|
948
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1177
949
|
```
|
|
1178
950
|
<a name="AdminUser+findByIdAndUpdate"></a>
|
|
1179
951
|
|
|
@@ -1191,12 +963,7 @@ update userData by userSMId
|
|
|
1191
963
|
|
|
1192
964
|
**Example**
|
|
1193
965
|
```js
|
|
1194
|
-
const userId = '55e4a3bd6be6b45210833fae';
|
|
1195
|
-
const payload = {
|
|
1196
|
-
name: 'Maria joaquina',
|
|
1197
|
-
email: 'maria@gmail.com'
|
|
1198
|
-
};
|
|
1199
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
966
|
+
const userId = '55e4a3bd6be6b45210833fae';
|
|
1200
967
|
name: 'Maria joaquina',
|
|
1201
968
|
email: 'maria@gmail.com'
|
|
1202
969
|
```
|
|
1203
970
|
<a name="AdminUser+getChangePasswordGuid"></a>
|
|
1204
971
|
|
|
@@ -1212,10 +979,7 @@ Request GUID to change the password
|
|
|
1212
979
|
|
|
1213
980
|
**Example**
|
|
1214
981
|
```js
|
|
1215
|
-
const payload = {
|
|
1216
|
-
email: 'maria@gmail.com'
|
|
1217
|
-
};
|
|
1218
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
982
|
+
const payload = {
|
|
1219
983
|
email: 'maria@gmail.com'
|
|
1220
984
|
```
|
|
1221
985
|
<a name="AdminUser+changePasswordGuid"></a>
|
|
1222
986
|
|
|
@@ -1233,11 +997,143 @@ Change password guid
|
|
|
1233
997
|
|
|
1234
998
|
**Example**
|
|
1235
999
|
```js
|
|
1236
|
-
const payload = {
|
|
1237
|
-
guid: '5b3c049c-4861-4353-a423-5e3f14242642',
|
|
1238
|
-
newPassword: '123456789'
|
|
1239
|
-
};
|
|
1240
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1000
|
+
const payload = {
|
|
1241
1001
|
guid: '5b3c049c-4861-4353-a423-5e3f14242642',
|
|
1242
1002
|
newPassword: '123456789'
|
|
1003
|
+
```
|
|
1004
|
+
<a name="Dispatch"></a>
|
|
1005
|
+
|
|
1006
|
+
## Dispatch
|
|
1007
|
+
Api dispatch manager
|
|
1008
|
+
|
|
1009
|
+
**Kind**: global class
|
|
1010
|
+
|
|
1011
|
+
* [Dispatch](#Dispatch)
|
|
1012
|
+
* [.getContext(url, session)](#Dispatch+getContext) ⇒ <code>Promise.<object></code>
|
|
1013
|
+
* [.getClient()](#Dispatch+getClient) ⇒ <code>promise</code>
|
|
1014
|
+
|
|
1015
|
+
<a name="Dispatch+getContext"></a>
|
|
1016
|
+
|
|
1017
|
+
### dispatch.getContext(url, session) ⇒ <code>Promise.<object></code>
|
|
1018
|
+
Get the URL context
|
|
1019
|
+
|
|
1020
|
+
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
1021
|
+
**Returns**: <code>Promise.<object></code> - The full data context of the URL
|
|
1022
|
+
**Access**: public
|
|
1023
|
+
|
|
1024
|
+
| Param | Type | Default | Description |
|
|
1025
|
+
| --- | --- | --- | --- |
|
|
1026
|
+
| url | <code>string</code> | | Full url |
|
|
1027
|
+
| session | <code>session</code> | <code></code> | Session, token JWT |
|
|
1028
|
+
|
|
1029
|
+
**Example**
|
|
1030
|
+
```js
|
|
1031
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1032
|
+
```
|
|
1033
|
+
<a name="Dispatch+getClient"></a>
|
|
1034
|
+
|
|
1035
|
+
### dispatch.getClient() ⇒ <code>promise</code>
|
|
1036
|
+
Get client Axios
|
|
1037
|
+
|
|
1038
|
+
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
1039
|
+
**Returns**: <code>promise</code> - return client axios
|
|
1040
|
+
**Access**: public
|
|
1041
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1042
|
+
**Example**
|
|
1043
|
+
```js
|
|
1044
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1045
|
+
```
|
|
1046
|
+
<a name="External"></a>
|
|
1047
|
+
|
|
1048
|
+
## External
|
|
1049
|
+
Class for documents, permission user
|
|
1050
|
+
|
|
1051
|
+
**Kind**: global class
|
|
1052
|
+
|
|
1053
|
+
* [External](#External)
|
|
1054
|
+
* [.context(params)](#External+context) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>array.<object></code>
|
|
1055
|
+
* [.getUploadDocumentSignedUrl(mime, authorization)](#External+getUploadDocumentSignedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1056
|
+
* [.getUploadDocumentsSignedUrl(docs, authorization)](#External+getUploadDocumentsSignedUrl) ⇒ <code>Promise.<array></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1057
|
+
* [.handle(authorization, params)](#External+handle) ⇒ <code>Promise.<boolean></code>
|
|
1058
|
+
|
|
1059
|
+
<a name="External+context"></a>
|
|
1060
|
+
|
|
1061
|
+
### external.context(params) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>array.<object></code>
|
|
1062
|
+
Create new document
|
|
1063
|
+
|
|
1064
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
1065
|
+
**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
|
|
1243
1066
|
The authorization is unique and is ONLY valid for this session.<code>array.<object></code> - groups the form groups to render
|
|
1067
|
+
**Access**: public
|
|
1068
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1069
|
+
|
|
1070
|
+
| Param | Type | Description |
|
|
1071
|
+
| --- | --- | --- |
|
|
1072
|
+
| params | <code>object</code> | Object for add new document |
|
|
1073
|
+
| params.id | <code>string</code> | Organization form id |
|
|
1074
|
+
|
|
1075
|
+
**Example**
|
|
1076
|
+
```js
|
|
1077
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1244
1078
|
id: '611e679741cc63168c26d7ee'
|
|
1079
|
+
```
|
|
1080
|
+
<a name="External+getUploadDocumentSignedUrl"></a>
|
|
1081
|
+
|
|
1082
|
+
### external.getUploadDocumentSignedUrl(mime, authorization) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1083
|
+
Get an upload signed url, so it will be possible to upload documents temporarily during the use of the external form
|
|
1084
|
+
|
|
1085
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
1086
|
+
**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
|
|
1087
|
+
**Access**: public
|
|
1088
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1089
|
+
|
|
1090
|
+
| Param | Type | Description |
|
|
1091
|
+
| --- | --- | --- |
|
|
1092
|
+
| mime | <code>string</code> | the mime type of the document |
|
|
1093
|
+
| authorization | <code>string</code> | a legal authorization |
|
|
1094
|
+
|
|
1095
|
+
**Example**
|
|
1096
|
+
```js
|
|
1097
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1245
1098
|
mime: 'application/pdf'
|
|
1099
|
+
```
|
|
1100
|
+
<a name="External+getUploadDocumentsSignedUrl"></a>
|
|
1101
|
+
|
|
1102
|
+
### external.getUploadDocumentsSignedUrl(docs, authorization) ⇒ <code>Promise.<array></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1103
|
+
Get an upload signed url, for many documents. So it will be possible to upload documents temporarily during the use of the external form
|
|
1104
|
+
|
|
1105
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
1106
|
+
**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
|
|
1107
|
+
**Access**: public
|
|
1108
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1109
|
+
|
|
1110
|
+
| Param | Type | Description |
|
|
1111
|
+
| --- | --- | --- |
|
|
1112
|
+
| docs | <code>array.<object></code> | the list of documents |
|
|
1113
|
+
| docs.mime | <code>string</code> | the mime type of the document |
|
|
1114
|
+
| authorization | <code>string</code> | a legal authorization |
|
|
1115
|
+
|
|
1116
|
+
**Example**
|
|
1117
|
+
```js
|
|
1118
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1246
1119
|
{
|
|
1247
1120
|
mime: 'application/pdf'
|
|
1248
1121
|
}
|
|
1122
|
+
```
|
|
1123
|
+
<a name="External+handle"></a>
|
|
1124
|
+
|
|
1125
|
+
### external.handle(authorization, params) ⇒ <code>Promise.<boolean></code>
|
|
1126
|
+
Handles the execution of an external form
|
|
1127
|
+
|
|
1128
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
1129
|
+
**Returns**: <code>Promise.<boolean></code> - true|false if success
|
|
1130
|
+
**Access**: public
|
|
1131
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1132
|
+
|
|
1133
|
+
| Param | Type | Description |
|
|
1134
|
+
| --- | --- | --- |
|
|
1135
|
+
| authorization | <code>string</code> | a legal authorization |
|
|
1136
|
+
| params | <code>object</code> | the parameters to handle the execution of an external form |
|
|
1137
|
+
| params.payload | <code>array.<object></code> | the payload of the external form. It should represent the form groups of the external form |
|
|
1138
|
+
| params.payload.name | <code>string</code> | the name of the group |
|
|
1139
|
+
| params.payload.fields | <code>array.<object></code> | the fields that belong to each group |
|
|
1140
|
+
| 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 |
|
|
1141
|
+
|
|
1142
|
+
**Example**
|
|
1143
|
+
```js
|
|
1144
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1249
1145
|
payload: [
|
|
1250
1146
|
{
|
|
1251
1147
|
name: 'My Group One',
|
|
1252
1148
|
fields: [
|
|
1253
1149
|
{}
|
|
1254
1150
|
]
|
|
1255
1151
|
}
|
|
1256
1152
|
]
|
|
1257
1153
|
```
|
|
1258
1154
|
<a name="GeoLocation"></a>
|
|
1259
1155
|
|
|
@@ -1262,13 +1158,7 @@ Get geo location of the address
|
|
|
1262
1158
|
|
|
1263
1159
|
**Example**
|
|
1264
1160
|
```js
|
|
1265
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1266
|
-
const api = new API();
|
|
1267
|
-
const params = {
|
|
1268
|
-
address: 'Rua Sud Menucci, 615 - Vila Camilopolis, Santo André - SP',
|
|
1269
|
-
apiKey: 'AIzaSyC7gJFOkuT-Mel3WZbX5uKuJ1USqLVkGnY',
|
|
1270
|
-
};
|
|
1271
|
-
await api.general.geo.location(params);
|
|
1161
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1272
1162
|
address: 'Rua Sud Menucci, 615 - Vila Camilopolis, Santo André - SP',
|
|
1273
1163
|
apiKey: 'AIzaSyC7gJFOkuT-Mel3WZbX5uKuJ1USqLVkGnY',
|
|
1274
1164
|
```
|
|
1275
1165
|
<a name="Users"></a>
|
|
1276
1166
|
|
|
@@ -1300,100 +1190,241 @@ API request, user permission level
|
|
|
1300
1190
|
| options | <code>object</code> | Params of the constructor |
|
|
1301
1191
|
| options.parent | <code>object</code> | This of the pararent |
|
|
1302
1192
|
|
|
1303
|
-
<a name="
|
|
1193
|
+
<a name="Login"></a>
|
|
1304
1194
|
|
|
1305
|
-
##
|
|
1306
|
-
|
|
1195
|
+
## Login
|
|
1196
|
+
Login manager
|
|
1307
1197
|
|
|
1308
1198
|
**Kind**: global class
|
|
1309
|
-
<a name="Application+list"></a>
|
|
1310
1199
|
|
|
1311
|
-
|
|
1312
|
-
|
|
1200
|
+
* [Login](#Login)
|
|
1201
|
+
* [.facebook(params)](#Login+facebook) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1202
|
+
* [.google(params)](#Login+google) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1203
|
+
* [.apiKey(apikey)](#Login+apiKey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1204
|
+
* [.userPass(params)](#Login+userPass) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1205
|
+
* [.logout(session)](#Login+logout) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1206
|
+
* [.recover(username)](#Login+recover) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1313
1207
|
|
|
1314
|
-
|
|
1208
|
+
<a name="Login+facebook"></a>
|
|
1209
|
+
|
|
1210
|
+
### login.facebook(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1211
|
+
Login with social login Facebook
|
|
1212
|
+
|
|
1213
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1214
|
+
**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
|
|
1315
1215
|
**Access**: public
|
|
1316
1216
|
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1317
1217
|
|
|
1318
1218
|
| Param | Type | Description |
|
|
1319
1219
|
| --- | --- | --- |
|
|
1320
|
-
| params | <code>object</code> | Params to
|
|
1321
|
-
| params.
|
|
1322
|
-
|
|
|
1220
|
+
| params | <code>object</code> | Params to login Facebook |
|
|
1221
|
+
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
1222
|
+
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
1223
|
+
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
1323
1224
|
|
|
1324
1225
|
**Example**
|
|
1325
1226
|
```js
|
|
1326
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1327
|
-
const api = new API();
|
|
1328
|
-
const params = {
|
|
1329
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
1330
|
-
};
|
|
1331
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1332
|
-
await api.user.application.list(params, session);
|
|
1227
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1333
1228
|
```
|
|
1334
|
-
<a name="
|
|
1335
|
-
|
|
1336
|
-
## Datasource
|
|
1337
|
-
Class for user datasource access, to be used with when creating new documents
|
|
1338
|
-
|
|
1339
|
-
**Kind**: global class
|
|
1340
|
-
<a name="Datasource+autocomplete"></a>
|
|
1229
|
+
<a name="Login+google"></a>
|
|
1341
1230
|
|
|
1342
|
-
###
|
|
1343
|
-
|
|
1231
|
+
### login.google(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1232
|
+
Login with social login Google
|
|
1344
1233
|
|
|
1345
|
-
**Kind**: instance method of [<code>
|
|
1346
|
-
**Returns**: <code>promise.<
|
|
1234
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1235
|
+
**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
|
|
1347
1236
|
**Access**: public
|
|
1348
1237
|
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1349
1238
|
|
|
1350
1239
|
| Param | Type | Description |
|
|
1351
1240
|
| --- | --- | --- |
|
|
1352
|
-
| params | <code>object</code> | Params to
|
|
1353
|
-
| params.
|
|
1354
|
-
| params.
|
|
1355
|
-
| params.
|
|
1356
|
-
| params.dataSources.fields | <code>array.<object></code> | The document type data sources list of fields |
|
|
1357
|
-
| params.documents | <code>array.<object></code> | The document list |
|
|
1358
|
-
| params.documents._id | <code>string</code> | The document _id |
|
|
1359
|
-
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
1241
|
+
| params | <code>object</code> | Params to login Google |
|
|
1242
|
+
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
1243
|
+
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
1244
|
+
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
1360
1245
|
|
|
1361
1246
|
**Example**
|
|
1362
1247
|
```js
|
|
1363
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1364
|
-
const api = new API();
|
|
1365
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1366
|
-
const params = {
|
|
1367
|
-
orgId: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
|
|
1368
|
-
dataSources: [{}],
|
|
1369
|
-
documents: [{}]
|
|
1370
|
-
};
|
|
1371
|
-
const retData = await api.user.datasource.autocomplete(params, session);
|
|
1248
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1372
1249
|
```
|
|
1373
|
-
<a name="
|
|
1250
|
+
<a name="Login+apiKey"></a>
|
|
1374
1251
|
|
|
1375
|
-
|
|
1376
|
-
|
|
1252
|
+
### login.apiKey(apikey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1253
|
+
Login with apikey
|
|
1377
1254
|
|
|
1378
|
-
**Kind**:
|
|
1255
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1256
|
+
**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
|
|
1257
|
+
**Access**: public
|
|
1258
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1379
1259
|
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
* [.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>
|
|
1384
|
-
* [.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>
|
|
1385
|
-
* [.signedUrl(params, session)](#Documents+signedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1386
|
-
* [.signedUrls(params, session)](#Documents+signedUrls) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1387
|
-
* [.uploadSignedDocument(params)](#Documents+uploadSignedDocument) ⇒ <code>Promise.<boolean></code>
|
|
1388
|
-
* [.checkPrimaryKeys(params, session)](#Documents+checkPrimaryKeys) ⇒ <code>Promise.<array></code> \| <code>array.<string></code>
|
|
1389
|
-
* [.searchDocuments(params, session)](#Documents+searchDocuments) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
1260
|
+
| Param | Type | Description |
|
|
1261
|
+
| --- | --- | --- |
|
|
1262
|
+
| apikey | <code>string</code> | Access key |
|
|
1390
1263
|
|
|
1391
|
-
|
|
1264
|
+
**Example**
|
|
1265
|
+
```js
|
|
1266
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1267
|
+
```
|
|
1268
|
+
<a name="Login+userPass"></a>
|
|
1392
1269
|
|
|
1393
|
-
###
|
|
1394
|
-
|
|
1270
|
+
### login.userPass(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1271
|
+
Login with user and password
|
|
1395
1272
|
|
|
1396
|
-
**Kind**: instance method of [<code>
|
|
1273
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1274
|
+
**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
|
|
1275
|
+
**Access**: public
|
|
1276
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1277
|
+
|
|
1278
|
+
| Param | Type | Description |
|
|
1279
|
+
| --- | --- | --- |
|
|
1280
|
+
| params | <code>object</code> | Object with user and password |
|
|
1281
|
+
| params.username | <code>string</code> | Username or email of the user |
|
|
1282
|
+
| params.password | <code>string</code> | Password of the user |
|
|
1283
|
+
| params.orgname | <code>string</code> | The organame of the user |
|
|
1284
|
+
|
|
1285
|
+
**Example**
|
|
1286
|
+
```js
|
|
1287
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1397
1288
|
username: 'ana.silva@gmail.com',
|
|
1398
1289
|
password: '123456'
|
|
1290
|
+
```
|
|
1291
|
+
<a name="Login+logout"></a>
|
|
1292
|
+
|
|
1293
|
+
### login.logout(session) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1294
|
+
Logout user system manager
|
|
1295
|
+
|
|
1296
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1297
|
+
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
1298
|
+
**Access**: public
|
|
1299
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1300
|
+
|
|
1301
|
+
| Param | Type | Description |
|
|
1302
|
+
| --- | --- | --- |
|
|
1303
|
+
| session | <code>string</code> | Session, token JWT |
|
|
1304
|
+
|
|
1305
|
+
**Example**
|
|
1306
|
+
```js
|
|
1307
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1308
|
+
```
|
|
1309
|
+
<a name="Login+recover"></a>
|
|
1310
|
+
|
|
1311
|
+
### login.recover(username) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1312
|
+
Recover the password
|
|
1313
|
+
|
|
1314
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1315
|
+
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
1316
|
+
**Access**: public
|
|
1317
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1318
|
+
|
|
1319
|
+
| Param | Type | Description |
|
|
1320
|
+
| --- | --- | --- |
|
|
1321
|
+
| username | <code>string</code> | The username or email |
|
|
1322
|
+
|
|
1323
|
+
**Example**
|
|
1324
|
+
```js
|
|
1325
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1326
|
+
```
|
|
1327
|
+
<a name="Session"></a>
|
|
1328
|
+
|
|
1329
|
+
## Session
|
|
1330
|
+
Session manager of the API
|
|
1331
|
+
|
|
1332
|
+
**Kind**: global class
|
|
1333
|
+
<a name="Session+information"></a>
|
|
1334
|
+
|
|
1335
|
+
### session.information(sessionId, suSessionId) ⇒ <code>Promise</code>
|
|
1336
|
+
Show information for session, thus validating the session (Valid token JWT)
|
|
1337
|
+
|
|
1338
|
+
**Kind**: instance method of [<code>Session</code>](#Session)
|
|
1339
|
+
**Access**: public
|
|
1340
|
+
|
|
1341
|
+
| Param | Type | Default | Description |
|
|
1342
|
+
| --- | --- | --- | --- |
|
|
1343
|
+
| sessionId | <code>string</code> | | The user session (JWT Token) |
|
|
1344
|
+
| suSessionId | <code>string</code> | <code>"sessionId"</code> | Given a JWT Token of a SU (SuperAdmin), allow to check session for another user. |
|
|
1345
|
+
|
|
1346
|
+
**Example**
|
|
1347
|
+
```js
|
|
1348
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1349
|
+
```
|
|
1350
|
+
<a name="Application"></a>
|
|
1351
|
+
|
|
1352
|
+
## Application
|
|
1353
|
+
Class for Applications, permission user
|
|
1354
|
+
|
|
1355
|
+
**Kind**: global class
|
|
1356
|
+
<a name="Application+list"></a>
|
|
1357
|
+
|
|
1358
|
+
### application.list(params, session) ⇒ <code>promise</code>
|
|
1359
|
+
Get the available applications for this user in this organizations
|
|
1360
|
+
|
|
1361
|
+
**Kind**: instance method of [<code>Application</code>](#Application)
|
|
1362
|
+
**Access**: public
|
|
1363
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1364
|
+
|
|
1365
|
+
| Param | Type | Description |
|
|
1366
|
+
| --- | --- | --- |
|
|
1367
|
+
| params | <code>object</code> | Params to get task |
|
|
1368
|
+
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
1369
|
+
| session | <code>string</code> | Session, token JWT |
|
|
1370
|
+
|
|
1371
|
+
**Example**
|
|
1372
|
+
```js
|
|
1373
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1399
1374
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
1375
|
+
```
|
|
1376
|
+
<a name="Datasource"></a>
|
|
1377
|
+
|
|
1378
|
+
## Datasource
|
|
1379
|
+
Class for user datasource access, to be used with when creating new documents
|
|
1380
|
+
|
|
1381
|
+
**Kind**: global class
|
|
1382
|
+
<a name="Datasource+autocomplete"></a>
|
|
1383
|
+
|
|
1384
|
+
### datasource.autocomplete(params, session) ⇒ <code>promise.<array></code> \| <code>string</code> \| <code>object</code>
|
|
1385
|
+
Method to get autocomplete data from a datasource
|
|
1386
|
+
|
|
1387
|
+
**Kind**: instance method of [<code>Datasource</code>](#Datasource)
|
|
1388
|
+
**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
|
|
1389
|
+
**Access**: public
|
|
1390
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1391
|
+
|
|
1392
|
+
| Param | Type | Description |
|
|
1393
|
+
| --- | --- | --- |
|
|
1394
|
+
| params | <code>object</code> | Params to add notification token |
|
|
1395
|
+
| params.orgId | <code>string</code> | The user organization _id |
|
|
1396
|
+
| params.dataSources | <code>array.<object></code> | The document type data sources information |
|
|
1397
|
+
| params.dataSources._id | <code>string</code> | The document type data sources _id |
|
|
1398
|
+
| params.dataSources.fields | <code>array.<object></code> | The document type data sources list of fields |
|
|
1399
|
+
| params.documents | <code>array.<object></code> | The document list |
|
|
1400
|
+
| params.documents._id | <code>string</code> | The document _id |
|
|
1401
|
+
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
1402
|
+
|
|
1403
|
+
**Example**
|
|
1404
|
+
```js
|
|
1405
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1400
1406
|
orgId: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
|
|
1401
1407
|
dataSources: [{}],
|
|
1402
1408
|
documents: [{}]
|
|
1409
|
+
```
|
|
1410
|
+
<a name="Documents"></a>
|
|
1411
|
+
|
|
1412
|
+
## Documents
|
|
1413
|
+
Class for documents, permission user
|
|
1414
|
+
|
|
1415
|
+
**Kind**: global class
|
|
1416
|
+
|
|
1417
|
+
* [Documents](#Documents)
|
|
1418
|
+
* [.add(params, session)](#Documents+add) ⇒ <code>Promise</code>
|
|
1419
|
+
* [.find(params, session)](#Documents+find) ⇒ <code>Promise</code>
|
|
1420
|
+
* [.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>
|
|
1421
|
+
* [.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>
|
|
1422
|
+
* [.signedUrl(params, session)](#Documents+signedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1423
|
+
* [.signedUrls(params, session)](#Documents+signedUrls) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1424
|
+
* [.uploadSignedDocument(params)](#Documents+uploadSignedDocument) ⇒ <code>Promise.<boolean></code>
|
|
1425
|
+
* [.checkPrimaryKeys(params, session)](#Documents+checkPrimaryKeys) ⇒ <code>Promise.<array></code> \| <code>array.<string></code>
|
|
1426
|
+
* [.searchDocuments(params, session)](#Documents+searchDocuments) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
1427
|
+
|
|
1428
|
+
<a name="Documents+add"></a>
|
|
1429
|
+
|
|
1430
|
+
### documents.add(params, session) ⇒ <code>Promise</code>
|
|
1431
|
+
Create new document
|
|
1432
|
+
|
|
1433
|
+
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1403
1434
|
**Access**: public
|
|
1404
1435
|
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1405
1436
|
|
|
@@ -1428,23 +1459,7 @@ Create new document
|
|
|
1428
1459
|
|
|
1429
1460
|
**Example**
|
|
1430
1461
|
```js
|
|
1431
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1432
|
-
const api = new API();
|
|
1433
|
-
const params = {
|
|
1434
|
-
orgname: 'cloundbrasil',
|
|
1435
|
-
areaId: '5edf9f8ee896b817e45b8dac',
|
|
1436
|
-
docId: '5edf86fbe896b817e45b8da6',
|
|
1437
|
-
fileName: 'foto',
|
|
1438
|
-
type: 'image/png',
|
|
1439
|
-
name: 'Fotografia',
|
|
1440
|
-
docTypeId = '5edf9f8ee896b817e45b8dac',
|
|
1441
|
-
bytes: 12345,
|
|
1442
|
-
signedUrl: 'https://s3.amazonaws.com...'
|
|
1443
|
-
docTypeFieldsData: {extraUser: '12349f8ee896b817e45b8dac'},
|
|
1444
|
-
orgId: '5df7f19618430c89a41a19d2',
|
|
1445
|
-
};
|
|
1446
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1447
|
-
await api.user.document.add(params, session);
|
|
1462
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1448
1463
|
orgname: 'cloundbrasil',
|
|
1449
1464
|
areaId: '5edf9f8ee896b817e45b8dac',
|
|
1450
1465
|
docId: '5edf86fbe896b817e45b8da6',
|
|
1451
1466
|
fileName: 'foto',
|
|
1452
1467
|
type: 'image/png',
|
|
1453
1468
|
name: 'Fotografia',
|
|
1454
1469
|
docTypeId = '5edf9f8ee896b817e45b8dac',
|
|
1455
1470
|
bytes: 12345,
|
|
1456
1471
|
signedUrl: 'https://s3.amazonaws.com...'
|
|
1457
1472
|
docTypeFieldsData: {extraUser: '12349f8ee896b817e45b8dac'},
|
|
1458
1473
|
orgId: '5df7f19618430c89a41a19d2',
|
|
1459
1474
|
```
|
|
1460
1475
|
<a name="Documents+find"></a>
|
|
1461
1476
|
|
|
@@ -1472,18 +1487,7 @@ await api.user.document.add(params, session);
|
|
|
1472
1487
|
|
|
1473
1488
|
**Example**
|
|
1474
1489
|
```js
|
|
1475
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1476
|
-
const api = new API();
|
|
1477
|
-
const params - {
|
|
1478
|
-
index: 'extraCity',
|
|
1479
|
-
txtToSearch: 'São',
|
|
1480
|
-
docId: '5df7f19618430c89a41a19d2',
|
|
1481
|
-
docAreaId: '5edd11c46b6ce9729c2c297c',
|
|
1482
|
-
tag: 'Nome da cidade',
|
|
1483
|
-
orgId: '1234d01dc4af3941d42f8c5c'
|
|
1484
|
-
};
|
|
1485
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1486
|
-
await api.user.document.findByIdAndRemove(params, session);
|
|
1490
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1487
1491
|
index: 'extraCity',
|
|
1488
1492
|
txtToSearch: 'São',
|
|
1489
1493
|
docId: '5df7f19618430c89a41a19d2',
|
|
1490
1494
|
docAreaId: '5edd11c46b6ce9729c2c297c',
|
|
1491
1495
|
tag: 'Nome da cidade',
|
|
1492
1496
|
orgId: '1234d01dc4af3941d42f8c5c'
|
|
1493
1497
|
```
|
|
1494
1498
|
<a name="Documents+findByIdAndRemove"></a>
|
|
1495
1499
|
|
|
@@ -1504,14 +1508,7 @@ Remove document by id
|
|
|
1504
1508
|
|
|
1505
1509
|
**Example**
|
|
1506
1510
|
```js
|
|
1507
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1508
|
-
const api = new API();
|
|
1509
|
-
const params - {
|
|
1510
|
-
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1511
|
-
orgIdId: '5df7f19618430c89a41a19d2',
|
|
1512
|
-
};
|
|
1513
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1514
|
-
await api.user.document.findByIdAndRemove(params, session);
|
|
1511
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1515
1512
|
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1516
1513
|
orgIdId: '5df7f19618430c89a41a19d2',
|
|
1517
1514
|
```
|
|
1518
1515
|
<a name="Documents+findByIdsAndRemove"></a>
|
|
1519
1516
|
|
|
@@ -1533,14 +1530,7 @@ Remove documents
|
|
|
1533
1530
|
|
|
1534
1531
|
**Example**
|
|
1535
1532
|
```js
|
|
1536
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1537
|
-
const api = new API();
|
|
1538
|
-
const params - {
|
|
1539
|
-
documents: [{ _id: '5dadd01dc4af3941d42f8c5c' }],
|
|
1540
|
-
orgId: '5df7f19618430c89a41a19d2',
|
|
1541
|
-
};
|
|
1542
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1543
|
-
await api.user.document.findByIdsAndRemove(params, session);
|
|
1533
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1544
1534
|
documents: [{ _id: '5dadd01dc4af3941d42f8c5c' }],
|
|
1545
1535
|
orgId: '5df7f19618430c89a41a19d2',
|
|
1546
1536
|
```
|
|
1547
1537
|
<a name="Documents+signedUrl"></a>
|
|
1548
1538
|
|
|
@@ -1566,30 +1556,11 @@ Request signed url url to put or get
|
|
|
1566
1556
|
|
|
1567
1557
|
**Example**
|
|
1568
1558
|
```js
|
|
1569
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1570
|
-
const api = new API();
|
|
1571
|
-
const params - {
|
|
1572
|
-
methodType: 'put',
|
|
1573
|
-
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1574
|
-
docAreaId: '5df7f19618430c89a41a19d2',
|
|
1575
|
-
fileName: 'Foto',
|
|
1576
|
-
type: 'image/png'
|
|
1577
|
-
orgId: '5df7f19618430c89a41a19f8'
|
|
1578
|
-
};
|
|
1579
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1580
|
-
// each doc: { docId, name, areaId, type, signedUrl }
|
|
1581
|
-
const { docs } = await api.user.document.signedUrl(params, session);
|
|
1559
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1582
1560
|
methodType: 'put',
|
|
1583
1561
|
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1584
1562
|
docAreaId: '5df7f19618430c89a41a19d2',
|
|
1585
1563
|
fileName: 'Foto',
|
|
1586
1564
|
type: 'image/png'
|
|
1587
1565
|
orgId: '5df7f19618430c89a41a19f8'
|
|
1588
1566
|
```
|
|
1589
1567
|
**Example**
|
|
1590
1568
|
```js
|
|
1591
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1592
|
-
const api = new API();
|
|
1593
|
-
const params - {
|
|
1594
|
-
methodType: 'get',
|
|
1595
|
-
document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf',
|
|
1596
|
-
};
|
|
1597
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1598
|
-
const base64Data = await api.user.document.signedUrl(params, session);
|
|
1569
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1599
1570
|
methodType: 'get',
|
|
1600
1571
|
document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf',
|
|
1601
1572
|
```
|
|
1602
1573
|
<a name="Documents+signedUrls"></a>
|
|
1603
1574
|
|
|
@@ -1616,36 +1587,11 @@ Request signed url url to put or get
|
|
|
1616
1587
|
|
|
1617
1588
|
**Example**
|
|
1618
1589
|
```js
|
|
1619
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1620
|
-
const api = new API();
|
|
1621
|
-
const params - {
|
|
1622
|
-
methodType: 'put',
|
|
1623
|
-
orgId: '5df7f19618430c89a41a19f8'
|
|
1624
|
-
docs: [
|
|
1625
|
-
{
|
|
1626
|
-
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1627
|
-
areaId: '5df7f19618430c89a41a19d2',
|
|
1628
|
-
name: 'Foto.png',
|
|
1629
|
-
type: 'image/png'
|
|
1630
|
-
}
|
|
1631
|
-
]
|
|
1632
|
-
};
|
|
1633
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1634
|
-
// each doc: { docId, name, areaId, type, signedUrl }
|
|
1635
|
-
const { docs } = await api.user.document.signedUrls(params, session);
|
|
1636
|
-
```
|
|
1637
|
-
**Example**
|
|
1638
|
-
```js
|
|
1639
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1640
|
-
const api = new API();
|
|
1641
|
-
const params - {
|
|
1642
|
-
methodType: 'get',
|
|
1643
|
-
docs: [
|
|
1644
|
-
{ document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf' }
|
|
1645
|
-
],
|
|
1646
|
-
};
|
|
1647
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1648
|
-
const base64Data = await api.user.document.signedUrls(params, session);
|
|
1590
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1649
1591
|
methodType: 'put',
|
|
1650
1592
|
orgId: '5df7f19618430c89a41a19f8'
|
|
1651
1593
|
docs: [
|
|
1652
1594
|
{
|
|
1653
1595
|
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1654
1596
|
areaId: '5df7f19618430c89a41a19d2',
|
|
1655
1597
|
name: 'Foto.png',
|
|
1656
1598
|
type: 'image/png'
|
|
1657
1599
|
}
|
|
1658
1600
|
]
|
|
1601
|
+
```
|
|
1602
|
+
**Example**
|
|
1603
|
+
```js
|
|
1604
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1659
1605
|
methodType: 'get',
|
|
1660
1606
|
docs: [
|
|
1661
1607
|
{ document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf' }
|
|
1662
1608
|
],
|
|
1663
1609
|
```
|
|
1664
1610
|
<a name="Documents+uploadSignedDocument"></a>
|
|
1665
1611
|
|
|
@@ -1666,21 +1612,7 @@ Uploads the file
|
|
|
1666
1612
|
|
|
1667
1613
|
**Example**
|
|
1668
1614
|
```js
|
|
1669
|
-
const FS = require('fs');
|
|
1670
|
-
const Path = require('path');
|
|
1671
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1672
|
-
const api = new API();
|
|
1673
|
-
const params - {
|
|
1674
|
-
content: FS.readFileSync(Path.join(__dirname, '.mypdf.pdf')),
|
|
1675
|
-
signedUrl: 'https://signedurl.com/token...',
|
|
1676
|
-
type: 'application/pdf'
|
|
1677
|
-
};
|
|
1678
|
-
const retData = await api.user.document.uploadSignedDocument(params);
|
|
1679
|
-
|
|
1680
|
-
onUploadProgress return the progressEvent
|
|
1681
|
-
- lengthComputable: A Boolean that indicates whether or not the total number of bytes is known.
|
|
1682
|
-
- loaded: The number of bytes of the file that have been uploaded.
|
|
1683
|
-
- total: The total number of bytes in the file.
|
|
1615
|
+
const FS = require('fs');
|
|
1684
1616
|
content: FS.readFileSync(Path.join(__dirname, '.mypdf.pdf')),
|
|
1685
1617
|
signedUrl: 'https://signedurl.com/token...',
|
|
1686
1618
|
type: 'application/pdf'
|
|
1687
1619
|
- lengthComputable: A Boolean that indicates whether or not the total number of bytes is known.
|
|
1688
1620
|
- loaded: The number of bytes of the file that have been uploaded.
|
|
1689
1621
|
- total: The total number of bytes in the file.
|
|
1690
1622
|
```
|
|
1691
1623
|
<a name="Documents+checkPrimaryKeys"></a>
|
|
1692
1624
|
|
|
@@ -1688,8 +1620,7 @@ onUploadProgress return the progressEvent
|
|
|
1688
1620
|
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1689
1621
|
**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
|
|
1690
1622
|
**Access**: public
|
|
1691
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1692
|
-
Checks if a document can be added and it does not repeat its primary key
|
|
1623
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1693
1624
|
|
|
1694
1625
|
| Param | Type | Description |
|
|
1695
1626
|
| --- | --- | --- |
|
|
@@ -1704,17 +1635,7 @@ Checks if a document can be added and it does not repeat its primary key
|
|
|
1704
1635
|
|
|
1705
1636
|
**Example**
|
|
1706
1637
|
```js
|
|
1707
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1708
|
-
const api = new API();
|
|
1709
|
-
const docTypeFields = [...]; // the doc type fields array
|
|
1710
|
-
const docTypeFieldsData = {...}; // the data of this fields
|
|
1711
|
-
const params - {
|
|
1712
|
-
docs: [{ id: '5dadd01dc4af3941d42f8c5c', docTypeFields, docTypeFieldsData }],
|
|
1713
|
-
orgId: '5df7f19618430c89a41a19d2',
|
|
1714
|
-
docTypeId: '5df7f19618430c89a41a19d5',
|
|
1715
|
-
};
|
|
1716
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1717
|
-
const retDocs = await api.user.document.checkPrimaryKeys(params, session);
|
|
1638
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1718
1639
|
docs: [{ id: '5dadd01dc4af3941d42f8c5c', docTypeFields, docTypeFieldsData }],
|
|
1719
1640
|
orgId: '5df7f19618430c89a41a19d2',
|
|
1720
1641
|
docTypeId: '5df7f19618430c89a41a19d5',
|
|
1721
1642
|
```
|
|
1722
1643
|
<a name="Documents+searchDocuments"></a>
|
|
1723
1644
|
|
|
@@ -1735,14 +1656,7 @@ Method to search documents for
|
|
|
1735
1656
|
|
|
1736
1657
|
**Example**
|
|
1737
1658
|
```js
|
|
1738
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1739
|
-
const api = new API();
|
|
1740
|
-
const params = {
|
|
1741
|
-
query: {p: 20, i: 1, s: 'Mais recentes', as: '', m: 'w', ai: '57e6a3bd6be6b45210833fae'},
|
|
1742
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
1743
|
-
};
|
|
1744
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1745
|
-
const retSearch = await api.user.document.searchDocuments(params, session);
|
|
1659
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1746
1660
|
query: {p: 20, i: 1, s: 'Mais recentes', as: '', m: 'w', ai: '57e6a3bd6be6b45210833fae'},
|
|
1747
1661
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
1748
1662
|
```
|
|
1749
1663
|
<a name="Help"></a>
|
|
1750
1664
|
|
|
@@ -1770,10 +1684,7 @@ get heps topics
|
|
|
1770
1684
|
|
|
1771
1685
|
**Example**
|
|
1772
1686
|
```js
|
|
1773
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1774
|
-
const api = new API();
|
|
1775
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1776
|
-
await api.user.help.getTopics(session);
|
|
1687
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1777
1688
|
```
|
|
1778
1689
|
<a name="Help+get"></a>
|
|
1779
1690
|
|
|
@@ -1792,13 +1703,7 @@ Method to find helps from a topic
|
|
|
1792
1703
|
|
|
1793
1704
|
**Example**
|
|
1794
1705
|
```js
|
|
1795
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1796
|
-
const api = new API();
|
|
1797
|
-
const params = {
|
|
1798
|
-
id: '5dadd01dc4af3941d42f8c5c'
|
|
1799
|
-
};
|
|
1800
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1801
|
-
await api.user.help.get(params, session);
|
|
1706
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1802
1707
|
id: '5dadd01dc4af3941d42f8c5c'
|
|
1803
1708
|
```
|
|
1804
1709
|
<a name="Users"></a>
|
|
1805
1710
|
|
|
@@ -1830,6 +1735,33 @@ API request, user permission level
|
|
|
1830
1735
|
| options | <code>object</code> | Params of the constructor |
|
|
1831
1736
|
| options.parent | <code>object</code> | This of the pararent |
|
|
1832
1737
|
|
|
1738
|
+
<a name="MyTasks"></a>
|
|
1739
|
+
|
|
1740
|
+
## MyTasks
|
|
1741
|
+
Class for my tasks, permission user
|
|
1742
|
+
|
|
1743
|
+
**Kind**: global class
|
|
1744
|
+
<a name="MyTasks+find"></a>
|
|
1745
|
+
|
|
1746
|
+
### myTasks.find(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
1747
|
+
Method to find my tasks for a user
|
|
1748
|
+
|
|
1749
|
+
**Kind**: instance method of [<code>MyTasks</code>](#MyTasks)
|
|
1750
|
+
**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
|
|
1751
|
+
**Access**: public
|
|
1752
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1753
|
+
|
|
1754
|
+
| Param | Type | Description |
|
|
1755
|
+
| --- | --- | --- |
|
|
1756
|
+
| params | <code>object</code> | Params to get tasks |
|
|
1757
|
+
| params.query | <code>object</code> | Search my tasks query |
|
|
1758
|
+
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
1759
|
+
| session | <code>string</code> | Session, token JWT |
|
|
1760
|
+
|
|
1761
|
+
**Example**
|
|
1762
|
+
```js
|
|
1763
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1833
1764
|
query: {"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
1834
1765
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
1766
|
+
```
|
|
1835
1767
|
<a name="Notification"></a>
|
|
1836
1768
|
|
|
1837
1769
|
## Notification
|
|
@@ -1870,14 +1802,7 @@ Method to add a notification token
|
|
|
1870
1802
|
|
|
1871
1803
|
**Example**
|
|
1872
1804
|
```js
|
|
1873
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1874
|
-
const api = new API();
|
|
1875
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1876
|
-
const params = {
|
|
1877
|
-
token: 'V6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz2',
|
|
1878
|
-
type: 'FCM_WEB'
|
|
1879
|
-
};
|
|
1880
|
-
const retData = await api.user.notification.addToken(params, session);
|
|
1805
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1881
1806
|
token: 'V6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz2',
|
|
1882
1807
|
type: 'FCM_WEB'
|
|
1883
1808
|
```
|
|
1884
1809
|
<a name="Notification+getNew"></a>
|
|
1885
1810
|
|
|
@@ -1894,10 +1819,7 @@ get new notifications
|
|
|
1894
1819
|
|
|
1895
1820
|
**Example**
|
|
1896
1821
|
```js
|
|
1897
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1898
|
-
const api = new API();
|
|
1899
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1900
|
-
await api.user.notification.getNew(session);
|
|
1822
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1901
1823
|
```
|
|
1902
1824
|
<a name="Notification+getOld"></a>
|
|
1903
1825
|
|
|
@@ -1914,10 +1836,7 @@ get old notifications
|
|
|
1914
1836
|
|
|
1915
1837
|
**Example**
|
|
1916
1838
|
```js
|
|
1917
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1918
|
-
const api = new API();
|
|
1919
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1920
|
-
await api.user.notification.getOld(session);
|
|
1839
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1921
1840
|
```
|
|
1922
1841
|
<a name="Notification+setRead"></a>
|
|
1923
1842
|
|
|
@@ -1936,13 +1855,7 @@ Set notification as readed
|
|
|
1936
1855
|
|
|
1937
1856
|
**Example**
|
|
1938
1857
|
```js
|
|
1939
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1940
|
-
const api = new API();
|
|
1941
|
-
const params = {
|
|
1942
|
-
id: '34c344c43c34c344c43c'
|
|
1943
|
-
};
|
|
1944
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1945
|
-
await api.user.notification.setRead(params, session);
|
|
1858
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1946
1859
|
id: '34c344c43c34c344c43c'
|
|
1947
1860
|
```
|
|
1948
1861
|
<a name="Notification+setUnread"></a>
|
|
1949
1862
|
|
|
@@ -1961,13 +1874,7 @@ Set notification as unreaded
|
|
|
1961
1874
|
|
|
1962
1875
|
**Example**
|
|
1963
1876
|
```js
|
|
1964
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1965
|
-
const api = new API();
|
|
1966
|
-
const params = {
|
|
1967
|
-
id: '34c344c43c34c344c43c'
|
|
1968
|
-
};
|
|
1969
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1970
|
-
await api.user.notification.setUnread(params, session);
|
|
1877
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1971
1878
|
id: '34c344c43c34c344c43c'
|
|
1972
1879
|
```
|
|
1973
1880
|
<a name="Organization"></a>
|
|
1974
1881
|
|
|
@@ -2004,15 +1911,7 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
2004
1911
|
|
|
2005
1912
|
**Example**
|
|
2006
1913
|
```js
|
|
2007
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2008
|
-
const api = new API();
|
|
2009
|
-
const params = {
|
|
2010
|
-
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
2011
|
-
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
2012
|
-
type: 'image/png',
|
|
2013
|
-
};
|
|
2014
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2015
|
-
await api.admin.organizations.upsertAvatar(params, session);
|
|
1914
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2016
1915
|
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
2017
1916
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
2018
1917
|
type: 'image/png',
|
|
2019
1918
|
```
|
|
2020
1919
|
<a name="Organization+removeAvatar"></a>
|
|
2021
1920
|
|
|
@@ -2030,11 +1929,7 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
2030
1929
|
|
|
2031
1930
|
**Example**
|
|
2032
1931
|
```js
|
|
2033
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2034
|
-
const api = new API();
|
|
2035
|
-
const orgId = '5dadd01dc4af3941d42f8c5c';
|
|
2036
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2037
|
-
await api.admin.organizations.removeAvatar(orgId, session);
|
|
1932
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2038
1933
|
```
|
|
2039
1934
|
<a name="Organization+findById"></a>
|
|
2040
1935
|
|
|
@@ -2052,11 +1947,7 @@ Find organization by id
|
|
|
2052
1947
|
|
|
2053
1948
|
**Example**
|
|
2054
1949
|
```js
|
|
2055
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2056
|
-
const api = new API();
|
|
2057
|
-
const orgId = '80443245000122';
|
|
2058
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2059
|
-
await api.user.organization.findById(idCard, session);
|
|
1950
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2060
1951
|
```
|
|
2061
1952
|
<a name="Organization+idCardExist"></a>
|
|
2062
1953
|
|
|
@@ -2074,11 +1965,7 @@ Check if id card exist
|
|
|
2074
1965
|
|
|
2075
1966
|
**Example**
|
|
2076
1967
|
```js
|
|
2077
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2078
|
-
const api = new API();
|
|
2079
|
-
const idCard = '80443245000122';
|
|
2080
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2081
|
-
await api.user.organization.idCardExist(idCard, session);
|
|
1968
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2082
1969
|
```
|
|
2083
1970
|
<a name="Organization+upsertAvatar"></a>
|
|
2084
1971
|
|
|
@@ -2098,14 +1985,7 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
2098
1985
|
|
|
2099
1986
|
**Example**
|
|
2100
1987
|
```js
|
|
2101
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2102
|
-
const api = new API();
|
|
2103
|
-
const params = {
|
|
2104
|
-
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
2105
|
-
type: 'image/png',
|
|
2106
|
-
};
|
|
2107
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2108
|
-
await api.user.profile.updateAvatar(params, session);
|
|
1988
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2109
1989
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
2110
1990
|
type: 'image/png',
|
|
2111
1991
|
```
|
|
2112
1992
|
<a name="Organization+removeAvatar"></a>
|
|
2113
1993
|
|
|
@@ -2122,10 +2002,7 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
2122
2002
|
|
|
2123
2003
|
**Example**
|
|
2124
2004
|
```js
|
|
2125
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2126
|
-
const api = new API();
|
|
2127
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2128
|
-
await api.user.profile.removeAvatar(session);
|
|
2005
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2129
2006
|
```
|
|
2130
2007
|
<a name="Organization+callFetch"></a>
|
|
2131
2008
|
|
|
@@ -2145,14 +2022,7 @@ Call URL internal, need auth JWT (session)
|
|
|
2145
2022
|
|
|
2146
2023
|
**Example**
|
|
2147
2024
|
```js
|
|
2148
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2149
|
-
const api = new API();
|
|
2150
|
-
|
|
2151
|
-
const params = {
|
|
2152
|
-
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
2153
|
-
method: 'POST'
|
|
2154
|
-
}
|
|
2155
|
-
await api.user.organization.callFetchs(params, session);
|
|
2025
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2156
2026
|
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
2157
2027
|
method: 'POST'
|
|
2158
2028
|
```
|
|
2159
2029
|
<a name="Page"></a>
|
|
2160
2030
|
|
|
@@ -2179,15 +2049,7 @@ Get the available page for an application inside an organization
|
|
|
2179
2049
|
|
|
2180
2050
|
**Example**
|
|
2181
2051
|
```js
|
|
2182
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2183
|
-
const api = new API();
|
|
2184
|
-
const params = {
|
|
2185
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2186
|
-
appId: '57e4a3bd6be6b45210833fa7',
|
|
2187
|
-
pageId: '57e4a3bd6be6b45210833fab'
|
|
2188
|
-
};
|
|
2189
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2190
|
-
await api.user.application.page.get(params, session);
|
|
2052
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2191
2053
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2192
2054
|
appId: '57e4a3bd6be6b45210833fa7',
|
|
2193
2055
|
pageId: '57e4a3bd6be6b45210833fab'
|
|
2194
2056
|
```
|
|
2195
2057
|
<a name="Process"></a>
|
|
2196
2058
|
|
|
@@ -2226,15 +2088,7 @@ Start process
|
|
|
2226
2088
|
|
|
2227
2089
|
**Example**
|
|
2228
2090
|
```js
|
|
2229
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2230
|
-
const api = new API();
|
|
2231
|
-
const params = {
|
|
2232
|
-
orgProcessId: '5dadd01dc4af3941d42f8c5c',
|
|
2233
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2234
|
-
payload: {}
|
|
2235
|
-
}
|
|
2236
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2237
|
-
await api.user.process.start(params, session);
|
|
2091
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2238
2092
|
orgProcessId: '5dadd01dc4af3941d42f8c5c',
|
|
2239
2093
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2240
2094
|
payload: {}
|
|
2241
2095
|
```
|
|
2242
2096
|
<a name="Process+getProcessProperties"></a>
|
|
2243
2097
|
|
|
@@ -2254,14 +2108,7 @@ Get process properties of process
|
|
|
2254
2108
|
|
|
2255
2109
|
**Example**
|
|
2256
2110
|
```js
|
|
2257
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2258
|
-
const api = new API();
|
|
2259
|
-
const params = {
|
|
2260
|
-
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2261
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2262
|
-
}
|
|
2263
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2264
|
-
await api.user.process.getProcessProperties(params, session);
|
|
2111
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2265
2112
|
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2266
2113
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2267
2114
|
```
|
|
2268
2115
|
<a name="Process+getOrgProcessSearchInfo"></a>
|
|
2269
2116
|
|
|
@@ -2269,8 +2116,7 @@ await api.user.process.getProcessProperties(params, session);
|
|
|
2269
2116
|
Get the search info of a organization process
|
|
2270
2117
|
|
|
2271
2118
|
**Kind**: instance method of [<code>Process</code>](#Process)
|
|
2272
|
-
**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
|
|
2273
|
-
@
|
|
2119
|
+
**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
|
|
2274
2120
|
**Access**: public
|
|
2275
2121
|
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2276
2122
|
|
|
@@ -2283,14 +2129,7 @@ Get the search info of a organization process
|
|
|
2283
2129
|
|
|
2284
2130
|
**Example**
|
|
2285
2131
|
```js
|
|
2286
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2287
|
-
const api = new API();
|
|
2288
|
-
const params = {
|
|
2289
|
-
orgProcessId: '5dadd01dc4af3941d42f8c67',
|
|
2290
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2291
|
-
}
|
|
2292
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2293
|
-
const retSearchInfo = await api.user.process.getOrgProcessSearchInfo(params, session);
|
|
2132
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2294
2133
|
orgProcessId: '5dadd01dc4af3941d42f8c67',
|
|
2295
2134
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2296
2135
|
```
|
|
2297
2136
|
<a name="Process+find"></a>
|
|
2298
2137
|
|
|
@@ -2311,14 +2150,7 @@ Method to search processes
|
|
|
2311
2150
|
|
|
2312
2151
|
**Example**
|
|
2313
2152
|
```js
|
|
2314
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2315
|
-
const api = new API();
|
|
2316
|
-
const params = {
|
|
2317
|
-
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2318
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2319
|
-
};
|
|
2320
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2321
|
-
const retSearch = await api.user.process.find(params, session);
|
|
2153
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2322
2154
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2323
2155
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2324
2156
|
```
|
|
2325
2157
|
<a name="Process+remove"></a>
|
|
2326
2158
|
|
|
@@ -2338,14 +2170,7 @@ Method to remove process
|
|
|
2338
2170
|
|
|
2339
2171
|
**Example**
|
|
2340
2172
|
```js
|
|
2341
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2342
|
-
const api = new API();
|
|
2343
|
-
const params = {
|
|
2344
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2345
|
-
processId: '55e4a3bd6be6b45210833fae'
|
|
2346
|
-
};
|
|
2347
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2348
|
-
const retSearch = await api.user.process.remove(params, session);
|
|
2173
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2349
2174
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2350
2175
|
processId: '55e4a3bd6be6b45210833fae'
|
|
2351
2176
|
```
|
|
2352
2177
|
<a name="Process+exportStatusData"></a>
|
|
2353
2178
|
|
|
@@ -2365,14 +2190,7 @@ Method to export status data
|
|
|
2365
2190
|
|
|
2366
2191
|
**Example**
|
|
2367
2192
|
```js
|
|
2368
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2369
|
-
const api = new API();
|
|
2370
|
-
const params = {
|
|
2371
|
-
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2372
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2373
|
-
};
|
|
2374
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2375
|
-
const retSearch = await api.user.process.exportStatusData(params, session);
|
|
2193
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2376
2194
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2377
2195
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2378
2196
|
```
|
|
2379
2197
|
<a name="Process+exportProcessData"></a>
|
|
2380
2198
|
|
|
@@ -2392,14 +2210,7 @@ Method to export process data
|
|
|
2392
2210
|
|
|
2393
2211
|
**Example**
|
|
2394
2212
|
```js
|
|
2395
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2396
|
-
const api = new API();
|
|
2397
|
-
const params = {
|
|
2398
|
-
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2399
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2400
|
-
};
|
|
2401
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2402
|
-
const retSearch = await api.user.process.exportProcessData(params, session);
|
|
2213
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2403
2214
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2404
2215
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2405
2216
|
```
|
|
2406
2217
|
<a name="Process+processDocs"></a>
|
|
2407
2218
|
|
|
@@ -2421,15 +2232,7 @@ Method to get Process Docs
|
|
|
2421
2232
|
|
|
2422
2233
|
**Example**
|
|
2423
2234
|
```js
|
|
2424
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2425
|
-
const api = new API();
|
|
2426
|
-
const params = {
|
|
2427
|
-
orgProcessId: '55e4a3bd6be6b45210833fae',
|
|
2428
|
-
processId: '55e4a3bd6be6b45210833fae',
|
|
2429
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2430
|
-
};
|
|
2431
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2432
|
-
const retSearch = await api.user.process.processDocs(params, session);
|
|
2235
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2433
2236
|
orgProcessId: '55e4a3bd6be6b45210833fae',
|
|
2434
2237
|
processId: '55e4a3bd6be6b45210833fae',
|
|
2435
2238
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2436
2239
|
```
|
|
2437
2240
|
<a name="Process+downloadDocs"></a>
|
|
2438
2241
|
|
|
@@ -2452,16 +2255,7 @@ Method to download the process documents
|
|
|
2452
2255
|
|
|
2453
2256
|
**Example**
|
|
2454
2257
|
```js
|
|
2455
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2456
|
-
const api = new API();
|
|
2457
|
-
const params = {
|
|
2458
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2459
|
-
type: 'Docs',
|
|
2460
|
-
docIds: ['55e4a3bd6be6b45210833fae'],
|
|
2461
|
-
footer: 'Documento - {page} de {pages}'
|
|
2462
|
-
};
|
|
2463
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2464
|
-
const result = await api.user.process.downloadDocs(params, session);
|
|
2258
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2465
2259
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2466
2260
|
type: 'Docs',
|
|
2467
2261
|
docIds: ['55e4a3bd6be6b45210833fae'],
|
|
2468
2262
|
footer: 'Documento - {page} de {pages}'
|
|
2469
2263
|
```
|
|
2470
2264
|
<a name="Register"></a>
|
|
2471
2265
|
|
|
@@ -2489,12 +2283,7 @@ Class for user registration in a user
|
|
|
2489
2283
|
|
|
2490
2284
|
**Example**
|
|
2491
2285
|
```js
|
|
2492
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2493
|
-
const api = new API();
|
|
2494
|
-
const params = {
|
|
2495
|
-
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...'
|
|
2496
|
-
};
|
|
2497
|
-
const orgname = await api.user.register.getOrgname(params);
|
|
2286
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2498
2287
|
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...'
|
|
2499
2288
|
```
|
|
2500
2289
|
<a name="Register+validateEmail"></a>
|
|
2501
2290
|
|
|
@@ -2514,13 +2303,7 @@ Method to find task by id
|
|
|
2514
2303
|
|
|
2515
2304
|
**Example**
|
|
2516
2305
|
```js
|
|
2517
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2518
|
-
const api = new API();
|
|
2519
|
-
const params = {
|
|
2520
|
-
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2521
|
-
email: 'myemail@company.com'
|
|
2522
|
-
};
|
|
2523
|
-
const retData = await api.user.register.validateEmail(params);
|
|
2306
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2524
2307
|
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2525
2308
|
email: 'myemail@company.com'
|
|
2526
2309
|
```
|
|
2527
2310
|
<a name="Register+execute"></a>
|
|
2528
2311
|
|
|
@@ -2554,30 +2337,60 @@ Method to register a user
|
|
|
2554
2337
|
|
|
2555
2338
|
**Example**
|
|
2556
2339
|
```js
|
|
2557
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2558
|
-
const api = new API();
|
|
2559
|
-
const params ={
|
|
2560
|
-
"registerId": 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2561
|
-
"type": 'sign',
|
|
2562
|
-
"login": false,
|
|
2563
|
-
"emailInfo": {
|
|
2564
|
-
"code": "5974",
|
|
2565
|
-
"email": "cbtoto_1@mailinator.com"
|
|
2566
|
-
},
|
|
2567
|
-
"registerData": {
|
|
2568
|
-
"name": "Augusto Totlo",
|
|
2569
|
-
"registerEmail": "cbtoto_1@mailinator.com",
|
|
2570
|
-
"phone": "",
|
|
2571
|
-
"idcard": "",
|
|
2572
|
-
"dob": "1978-01-12T03:00:00.000Z",
|
|
2573
|
-
"registerPassword": "123456",
|
|
2574
|
-
"emailValidationCode": "5974",
|
|
2575
|
-
"phoneValidationCode": "",
|
|
2576
|
-
"language": "en-US",
|
|
2577
|
-
"timezone": "Europe/Dublin"
|
|
2578
|
-
}
|
|
2579
|
-
};
|
|
2580
|
-
const retData = await api.user.register.execute(params);
|
|
2340
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2581
2341
|
"registerId": 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2582
2342
|
"type": 'sign',
|
|
2583
2343
|
"login": false,
|
|
2584
2344
|
"emailInfo": {
|
|
2585
2345
|
"code": "5974",
|
|
2586
2346
|
"email": "cbtoto_1@mailinator.com"
|
|
2587
2347
|
},
|
|
2588
2348
|
"registerData": {
|
|
2589
2349
|
"name": "Augusto Totlo",
|
|
2590
2350
|
"registerEmail": "cbtoto_1@mailinator.com",
|
|
2591
2351
|
"phone": "",
|
|
2592
2352
|
"idcard": "",
|
|
2593
2353
|
"dob": "1978-01-12T03:00:00.000Z",
|
|
2594
2354
|
"registerPassword": "123456",
|
|
2595
2355
|
"emailValidationCode": "5974",
|
|
2596
2356
|
"phoneValidationCode": "",
|
|
2597
2357
|
"language": "en-US",
|
|
2598
2358
|
"timezone": "Europe/Dublin"
|
|
2599
2359
|
}
|
|
2600
2360
|
};
|
|
2361
|
+
```
|
|
2362
|
+
<a name="TaskAvailable"></a>
|
|
2363
|
+
|
|
2364
|
+
## TaskAvailable
|
|
2365
|
+
Class for available tasks, permission user
|
|
2366
|
+
|
|
2367
|
+
**Kind**: global class
|
|
2368
|
+
|
|
2369
|
+
* [TaskAvailable](#TaskAvailable)
|
|
2370
|
+
* [.find(params, session)](#TaskAvailable+find) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
2371
|
+
* [.claim(params, session)](#TaskAvailable+claim) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2372
|
+
|
|
2373
|
+
<a name="TaskAvailable+find"></a>
|
|
2374
|
+
|
|
2375
|
+
### taskAvailable.find(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
2376
|
+
Method to find available tasks for a user
|
|
2377
|
+
|
|
2378
|
+
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
2379
|
+
**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
|
|
2380
|
+
**Access**: public
|
|
2381
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2382
|
+
|
|
2383
|
+
| Param | Type | Description |
|
|
2384
|
+
| --- | --- | --- |
|
|
2385
|
+
| params | <code>object</code> | Params to get task |
|
|
2386
|
+
| params.query | <code>object</code> | Search available tasks query |
|
|
2387
|
+
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
2388
|
+
| session | <code>string</code> | Session, token JWT |
|
|
2389
|
+
|
|
2390
|
+
**Example**
|
|
2391
|
+
```js
|
|
2392
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2601
2393
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2602
2394
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2395
|
+
```
|
|
2396
|
+
<a name="TaskAvailable+claim"></a>
|
|
2397
|
+
|
|
2398
|
+
### taskAvailable.claim(params, session) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2399
|
+
Method for a user to claim an available task
|
|
2400
|
+
|
|
2401
|
+
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
2402
|
+
**Returns**: <code>promise</code> - returned data from the method call<code>boolean</code> - success true|false if the method was successful
|
|
2403
|
+
**Access**: public
|
|
2404
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2405
|
+
|
|
2406
|
+
| Param | Type | Description |
|
|
2407
|
+
| --- | --- | --- |
|
|
2408
|
+
| params | <code>object</code> | Params to get task |
|
|
2409
|
+
| params.taskId | <code>object</code> | the task id to claim |
|
|
2410
|
+
| params.orgname | <code>object</code> | Organization slug (short name of the orgnization) |
|
|
2411
|
+
| session | <code>string</code> | Session, token JWT |
|
|
2412
|
+
|
|
2413
|
+
**Example**
|
|
2414
|
+
```js
|
|
2415
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2603
2416
|
taskId: '55e4a3bd6be6b45210833f67',
|
|
2604
2417
|
orgname: 'acme',
|
|
2605
2418
|
```
|
|
2606
2419
|
<a name="Task"></a>
|
|
2607
2420
|
|
|
@@ -2610,15 +2423,7 @@ Method to find task by id
|
|
|
2610
2423
|
|
|
2611
2424
|
**Example**
|
|
2612
2425
|
```js
|
|
2613
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2614
|
-
const api = new API();
|
|
2615
|
-
const params = {
|
|
2616
|
-
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2617
|
-
taskId: '5df7f19618430c89a41a19d2',
|
|
2618
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2619
|
-
};
|
|
2620
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2621
|
-
await api.user.task.findById(params, session);
|
|
2426
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2622
2427
|
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2623
2428
|
taskId: '5df7f19618430c89a41a19d2',
|
|
2624
2429
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2625
2430
|
```
|
|
2626
2431
|
<a name="Task+findByIdAndUpdate"></a>
|
|
2627
2432
|
|
|
@@ -2644,17 +2449,7 @@ Find task by id and update
|
|
|
2644
2449
|
|
|
2645
2450
|
**Example**
|
|
2646
2451
|
```js
|
|
2647
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2648
|
-
const api = new API();
|
|
2649
|
-
const params = {
|
|
2650
|
-
userId: '5739d4c6ccb0ebc61f2a9557',
|
|
2651
|
-
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2652
|
-
taskId: '5df7f19618430c89a41a19d2',
|
|
2653
|
-
action: 1,
|
|
2654
|
-
formData: {name: 'CloudBrasil'},
|
|
2655
|
-
};
|
|
2656
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2657
|
-
await api.user.task.findByIdAndUpdate(params, session);
|
|
2452
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2658
2453
|
userId: '5739d4c6ccb0ebc61f2a9557',
|
|
2659
2454
|
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2660
2455
|
taskId: '5df7f19618430c89a41a19d2',
|
|
2661
2456
|
action: 1,
|
|
2662
2457
|
formData: {name: 'CloudBrasil'},
|
|
2663
2458
|
```
|
|
2664
2459
|
<a name="Task+executeActionFinalize"></a>
|
|
2665
2460
|
|
|
@@ -2676,114 +2471,35 @@ Find task by id and update
|
|
|
2676
2471
|
|
|
2677
2472
|
**Example**
|
|
2678
2473
|
```js
|
|
2679
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2680
|
-
const api = new API();
|
|
2681
|
-
const params = {
|
|
2682
|
-
taskId: '5df7f19618430c89a41a19d2',
|
|
2683
|
-
actionGuid: 'b3823a2ae52c7a05bfb9590fe427038d'
|
|
2684
|
-
orgId: '5df7f19618430c89a41a1bc3',
|
|
2685
|
-
payload: {}',
|
|
2686
|
-
};
|
|
2687
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2688
|
-
await api.user.task.executeActionFinalize(params, session);
|
|
2474
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2689
2475
|
taskId: '5df7f19618430c89a41a19d2',
|
|
2690
2476
|
actionGuid: 'b3823a2ae52c7a05bfb9590fe427038d'
|
|
2691
2477
|
orgId: '5df7f19618430c89a41a1bc3',
|
|
2692
2478
|
payload: {}',
|
|
2693
2479
|
```
|
|
2694
|
-
<a name="
|
|
2480
|
+
<a name="Updates"></a>
|
|
2695
2481
|
|
|
2696
|
-
##
|
|
2697
|
-
Class for
|
|
2482
|
+
## Updates
|
|
2483
|
+
Class for user registration in a user
|
|
2698
2484
|
|
|
2699
2485
|
**Kind**: global class
|
|
2486
|
+
<a name="Updates+get"></a>
|
|
2700
2487
|
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
* [.claim(params, session)](#TaskAvailable+claim) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2704
|
-
|
|
2705
|
-
<a name="TaskAvailable+find"></a>
|
|
2706
|
-
|
|
2707
|
-
### taskAvailable.find(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
2708
|
-
Method to find available tasks for a user
|
|
2488
|
+
### updates.get(session)
|
|
2489
|
+
get updates
|
|
2709
2490
|
|
|
2710
|
-
**Kind**: instance method of [<code>
|
|
2711
|
-
**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
|
|
2491
|
+
**Kind**: instance method of [<code>Updates</code>](#Updates)
|
|
2712
2492
|
**Access**: public
|
|
2713
|
-
**Author**:
|
|
2493
|
+
**Author**: Augusto Pissarra <abernardo.br@gmail.com>
|
|
2714
2494
|
|
|
2715
2495
|
| Param | Type | Description |
|
|
2716
2496
|
| --- | --- | --- |
|
|
2717
|
-
|
|
|
2718
|
-
| params.query | <code>object</code> | Search available tasks query |
|
|
2719
|
-
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
2720
|
-
| session | <code>string</code> | Session, token JWT |
|
|
2497
|
+
| session | <code>string</code> | JWT token |
|
|
2721
2498
|
|
|
2722
2499
|
**Example**
|
|
2723
2500
|
```js
|
|
2724
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2725
|
-
const api = new API();
|
|
2726
|
-
const params = {
|
|
2727
|
-
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2728
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2729
|
-
};
|
|
2730
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2731
|
-
const retSearch = await api.user.task.available.find(params, session);
|
|
2501
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2732
2502
|
```
|
|
2733
|
-
<a name="
|
|
2503
|
+
<a name="User"></a>
|
|
2734
2504
|
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
2739
|
-
**Returns**: <code>promise</code> - returned data from the method call<code>boolean</code> - success true|false if the method was successful
|
|
2740
|
-
**Access**: public
|
|
2741
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2742
|
-
|
|
2743
|
-
| Param | Type | Description |
|
|
2744
|
-
| --- | --- | --- |
|
|
2745
|
-
| params | <code>object</code> | Params to get task |
|
|
2746
|
-
| params.taskId | <code>object</code> | the task id to claim |
|
|
2747
|
-
| params.orgname | <code>object</code> | Organization slug (short name of the orgnization) |
|
|
2748
|
-
| session | <code>string</code> | Session, token JWT |
|
|
2749
|
-
|
|
2750
|
-
**Example**
|
|
2751
|
-
```js
|
|
2752
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2753
|
-
const api = new API();
|
|
2754
|
-
const params = {
|
|
2755
|
-
taskId: '55e4a3bd6be6b45210833f67',
|
|
2756
|
-
orgname: 'acme',
|
|
2757
|
-
};
|
|
2758
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2759
|
-
const success = await api.user.task.available.claim(params, session);
|
|
2760
|
-
```
|
|
2761
|
-
<a name="Updates"></a>
|
|
2762
|
-
|
|
2763
|
-
## Updates
|
|
2764
|
-
Class for user registration in a user
|
|
2765
|
-
|
|
2766
|
-
**Kind**: global class
|
|
2767
|
-
<a name="Updates+get"></a>
|
|
2768
|
-
|
|
2769
|
-
### updates.get(session)
|
|
2770
|
-
get updates
|
|
2771
|
-
|
|
2772
|
-
**Kind**: instance method of [<code>Updates</code>](#Updates)
|
|
2773
|
-
**Access**: public
|
|
2774
|
-
**Author**: Augusto Pissarra <abernardo.br@gmail.com>
|
|
2775
|
-
|
|
2776
|
-
| Param | Type | Description |
|
|
2777
|
-
| --- | --- | --- |
|
|
2778
|
-
| session | <code>string</code> | JWT token |
|
|
2779
|
-
|
|
2780
|
-
**Example**
|
|
2781
|
-
```js
|
|
2782
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2783
|
-
const api = new API();
|
|
2784
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2785
|
-
await api.user.updates.get(session);
|
|
2786
|
-
```
|
|
2787
|
-
<a name="User"></a>
|
|
2788
|
-
|
|
2789
|
-
## User
|
|
2790
|
-
Class for user, permission user
|
|
2505
|
+
## User
|
|
2506
|
+
Class for user, permission user
|
|
2791
2507
|
|
|
2792
2508
|
**Kind**: global class
|
|
2793
2509
|
|
|
@@ -2813,14 +2529,7 @@ Update avatar of user by session of user not allow session user SU
|
|
|
2813
2529
|
|
|
2814
2530
|
**Example**
|
|
2815
2531
|
```js
|
|
2816
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2817
|
-
const api = new API();
|
|
2818
|
-
const params = {
|
|
2819
|
-
avatar: '55e4a3bd6be6b45210833fae',
|
|
2820
|
-
type: '123456',
|
|
2821
|
-
};
|
|
2822
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2823
|
-
await api.user.profile.updateAvatar(params, session);
|
|
2532
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2824
2533
|
avatar: '55e4a3bd6be6b45210833fae',
|
|
2825
2534
|
type: '123456',
|
|
2826
2535
|
```
|
|
2827
2536
|
<a name="User+removeAvatar"></a>
|
|
2828
2537
|
|
|
@@ -2837,10 +2546,7 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
2837
2546
|
|
|
2838
2547
|
**Example**
|
|
2839
2548
|
```js
|
|
2840
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2841
|
-
const api = new API();
|
|
2842
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2843
|
-
await api.user.profile.removeAvatar(session);
|
|
2549
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2844
2550
|
```
|
|
2845
2551
|
<a name="User+removeSignature"></a>
|
|
2846
2552
|
|
|
@@ -2857,10 +2563,7 @@ Remove the signature of user by session
|
|
|
2857
2563
|
|
|
2858
2564
|
**Example**
|
|
2859
2565
|
```js
|
|
2860
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2861
|
-
const api = new API();
|
|
2862
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2863
|
-
await api.user.profile.removeSignature(session);
|
|
2566
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2864
2567
|
```
|
|
2865
2568
|
<a name="User+saveSignature"></a>
|
|
2866
2569
|
|
|
@@ -2880,23 +2583,7 @@ Sava a new signature of user by session
|
|
|
2880
2583
|
|
|
2881
2584
|
**Example**
|
|
2882
2585
|
```js
|
|
2883
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2884
|
-
const api = new API();
|
|
2885
|
-
const data = {
|
|
2886
|
-
type: 'CURSIVE',
|
|
2887
|
-
file: 'allura:Mary John Heart'
|
|
2888
|
-
};
|
|
2889
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2890
|
-
await api.user.profile.saveSignature(data, session);
|
|
2891
|
-
|
|
2892
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2893
|
-
const api = new API();
|
|
2894
|
-
const data = {
|
|
2895
|
-
type: 'HANDWRITE',
|
|
2896
|
-
file: 'iVBORw0KGgoAAAANSUhEUgAAAj...'
|
|
2897
|
-
};
|
|
2898
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2899
|
-
await api.user.profile.saveSignature(session);
|
|
2586
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2900
2587
|
type: 'CURSIVE',
|
|
2901
2588
|
file: 'allura:Mary John Heart'
|
|
2902
2589
|
type: 'HANDWRITE',
|
|
2903
2590
|
file: 'iVBORw0KGgoAAAANSUhEUgAAAj...'
|
|
2904
2591
|
```
|
|
2905
2592
|
<a name="User+findByIdAndUpdate"></a>
|
|
2906
2593
|
|
|
@@ -2930,13 +2617,7 @@ Update a user profile by id
|
|
|
2930
2617
|
|
|
2931
2618
|
**Example**
|
|
2932
2619
|
```js
|
|
2933
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2934
|
-
const api = new API();
|
|
2935
|
-
const params = {
|
|
2936
|
-
name: 'New Name'
|
|
2937
|
-
};
|
|
2938
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2939
|
-
await api.user.profile.findByIdAndUpdate(params, session);
|
|
2620
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2940
2621
|
name: 'New Name'
|
|
2941
2622
|
```
|
|
2942
2623
|
<a name="User+changeOrganization"></a>
|
|
2943
2624
|
|
|
@@ -2954,379 +2635,5 @@ Change a user's organization
|
|
|
2954
2635
|
|
|
2955
2636
|
**Example**
|
|
2956
2637
|
```js
|
|
2957
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2958
|
-
const api = new API();
|
|
2959
|
-
const id = '616eccaaa9360a05293b10fe';
|
|
2960
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2961
|
-
await api.user.changeOrganization.updateAvatar(id, session);
|
|
2962
|
-
```
|
|
2963
|
-
<a name="Dispatch"></a>
|
|
2964
|
-
|
|
2965
|
-
## Dispatch
|
|
2966
|
-
Api dispatch manager
|
|
2967
|
-
|
|
2968
|
-
**Kind**: global class
|
|
2969
|
-
|
|
2970
|
-
* [Dispatch](#Dispatch)
|
|
2971
|
-
* [.getContext(url, session)](#Dispatch+getContext) ⇒ <code>Promise.<object></code>
|
|
2972
|
-
* [.getClient()](#Dispatch+getClient) ⇒ <code>promise</code>
|
|
2973
|
-
|
|
2974
|
-
<a name="Dispatch+getContext"></a>
|
|
2975
|
-
|
|
2976
|
-
### dispatch.getContext(url, session) ⇒ <code>Promise.<object></code>
|
|
2977
|
-
Get the URL context
|
|
2978
|
-
|
|
2979
|
-
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
2980
|
-
**Returns**: <code>Promise.<object></code> - The full data context of the URL
|
|
2981
|
-
**Access**: public
|
|
2982
|
-
|
|
2983
|
-
| Param | Type | Default | Description |
|
|
2984
|
-
| --- | --- | --- | --- |
|
|
2985
|
-
| url | <code>string</code> | | Full url |
|
|
2986
|
-
| session | <code>session</code> | <code></code> | Session, token JWT |
|
|
2987
|
-
|
|
2988
|
-
**Example**
|
|
2989
|
-
```js
|
|
2990
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2991
|
-
const api = new API();
|
|
2992
|
-
const retContext = await api.dispatch.getContext('http://myndware.io/login/myorg);
|
|
2993
|
-
```
|
|
2994
|
-
<a name="Dispatch+getClient"></a>
|
|
2995
|
-
|
|
2996
|
-
### dispatch.getClient() ⇒ <code>promise</code>
|
|
2997
|
-
Get client Axios
|
|
2998
|
-
|
|
2999
|
-
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
3000
|
-
**Returns**: <code>promise</code> - return client axios
|
|
3001
|
-
**Access**: public
|
|
3002
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3003
|
-
**Example**
|
|
3004
|
-
```js
|
|
3005
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3006
|
-
const api = new API();
|
|
3007
|
-
await api.dispatch.getClient();
|
|
3008
|
-
```
|
|
3009
|
-
<a name="External"></a>
|
|
3010
|
-
|
|
3011
|
-
## External
|
|
3012
|
-
Class for documents, permission user
|
|
3013
|
-
|
|
3014
|
-
**Kind**: global class
|
|
3015
|
-
|
|
3016
|
-
* [External](#External)
|
|
3017
|
-
* [.context(params)](#External+context) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>array.<object></code>
|
|
3018
|
-
* [.getUploadDocumentSignedUrl(mime, authorization)](#External+getUploadDocumentSignedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3019
|
-
* [.getUploadDocumentsSignedUrl(docs, authorization)](#External+getUploadDocumentsSignedUrl) ⇒ <code>Promise.<array></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3020
|
-
* [.handle(authorization, params)](#External+handle) ⇒ <code>Promise.<boolean></code>
|
|
3021
|
-
|
|
3022
|
-
<a name="External+context"></a>
|
|
3023
|
-
|
|
3024
|
-
### external.context(params) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>array.<object></code>
|
|
3025
|
-
Create new document
|
|
3026
|
-
|
|
3027
|
-
**Kind**: instance method of [<code>External</code>](#External)
|
|
3028
|
-
**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
|
|
3029
|
-
The authorization is unique and is ONLY valid for this session.<code>array.<object></code> - groups the form groups to render
|
|
3030
|
-
**Access**: public
|
|
3031
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3032
|
-
|
|
3033
|
-
| Param | Type | Description |
|
|
3034
|
-
| --- | --- | --- |
|
|
3035
|
-
| params | <code>object</code> | Object for add new document |
|
|
3036
|
-
| params.id | <code>string</code> | Organization form id |
|
|
3037
|
-
|
|
3038
|
-
**Example**
|
|
3039
|
-
```js
|
|
3040
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3041
|
-
const api = new API();
|
|
3042
|
-
const params = {
|
|
3043
|
-
id: '611e679741cc63168c26d7ee'
|
|
3044
|
-
};
|
|
3045
|
-
const retForm = await api.external.context(params);
|
|
3046
|
-
```
|
|
3047
|
-
<a name="External+getUploadDocumentSignedUrl"></a>
|
|
3048
|
-
|
|
3049
|
-
### external.getUploadDocumentSignedUrl(mime, authorization) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3050
|
-
Get an upload signed url, so it will be possible to upload documents temporarily during the use of the external form
|
|
3051
|
-
|
|
3052
|
-
**Kind**: instance method of [<code>External</code>](#External)
|
|
3053
|
-
**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
|
|
3054
|
-
**Access**: public
|
|
3055
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3056
|
-
|
|
3057
|
-
| Param | Type | Description |
|
|
3058
|
-
| --- | --- | --- |
|
|
3059
|
-
| mime | <code>string</code> | the mime type of the document |
|
|
3060
|
-
| authorization | <code>string</code> | a legal authorization |
|
|
3061
|
-
|
|
3062
|
-
**Example**
|
|
3063
|
-
```js
|
|
3064
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3065
|
-
const api = new API();
|
|
3066
|
-
const authorization = '...';
|
|
3067
|
-
const doc = {
|
|
3068
|
-
mime: 'application/pdf'
|
|
3069
|
-
};
|
|
3070
|
-
const retDoc = await api.external.getUploadDocumentSignedUrl(doc, authorization);
|
|
3071
|
-
```
|
|
3072
|
-
<a name="External+getUploadDocumentsSignedUrl"></a>
|
|
3073
|
-
|
|
3074
|
-
### external.getUploadDocumentsSignedUrl(docs, authorization) ⇒ <code>Promise.<array></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3075
|
-
Get an upload signed url, for many documents. So it will be possible to upload documents temporarily during the use of the external form
|
|
3076
|
-
|
|
3077
|
-
**Kind**: instance method of [<code>External</code>](#External)
|
|
3078
|
-
**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
|
|
3079
|
-
**Access**: public
|
|
3080
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3081
|
-
|
|
3082
|
-
| Param | Type | Description |
|
|
3083
|
-
| --- | --- | --- |
|
|
3084
|
-
| docs | <code>array.<object></code> | the list of documents |
|
|
3085
|
-
| docs.mime | <code>string</code> | the mime type of the document |
|
|
3086
|
-
| authorization | <code>string</code> | a legal authorization |
|
|
3087
|
-
|
|
3088
|
-
**Example**
|
|
3089
|
-
```js
|
|
3090
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3091
|
-
const api = new API();
|
|
3092
|
-
const authorization = '...';
|
|
3093
|
-
const docs = [
|
|
3094
|
-
{
|
|
3095
|
-
mime: 'application/pdf'
|
|
3096
|
-
}
|
|
3097
|
-
];
|
|
3098
|
-
const retDocs = await api.external.getUploadDocumentsSignedUrl(docs, authorization);
|
|
3099
|
-
```
|
|
3100
|
-
<a name="External+handle"></a>
|
|
3101
|
-
|
|
3102
|
-
### external.handle(authorization, params) ⇒ <code>Promise.<boolean></code>
|
|
3103
|
-
Handles the execution of an external form
|
|
3104
|
-
|
|
3105
|
-
**Kind**: instance method of [<code>External</code>](#External)
|
|
3106
|
-
**Returns**: <code>Promise.<boolean></code> - true|false if success
|
|
3107
|
-
**Access**: public
|
|
3108
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3109
|
-
|
|
3110
|
-
| Param | Type | Description |
|
|
3111
|
-
| --- | --- | --- |
|
|
3112
|
-
| authorization | <code>string</code> | a legal authorization |
|
|
3113
|
-
| params | <code>object</code> | the parameters to handle the execution of an external form |
|
|
3114
|
-
| params.payload | <code>array.<object></code> | the payload of the external form. It should represent the form groups of the external form |
|
|
3115
|
-
| params.payload.name | <code>string</code> | the name of the group |
|
|
3116
|
-
| params.payload.fields | <code>array.<object></code> | the fields that belong to each group |
|
|
3117
|
-
| 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 |
|
|
3118
|
-
|
|
3119
|
-
**Example**
|
|
3120
|
-
```js
|
|
3121
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3122
|
-
const api = new API();
|
|
3123
|
-
const authorization = '...';
|
|
3124
|
-
const params = {
|
|
3125
|
-
payload: [
|
|
3126
|
-
{
|
|
3127
|
-
name: 'My Group One',
|
|
3128
|
-
fields: [
|
|
3129
|
-
{}
|
|
3130
|
-
]
|
|
3131
|
-
}
|
|
3132
|
-
]
|
|
3133
|
-
};
|
|
3134
|
-
const success = await api.external.handle(params, authorization);
|
|
3135
|
-
```
|
|
3136
|
-
<a name="Login"></a>
|
|
3137
|
-
|
|
3138
|
-
## Login
|
|
3139
|
-
Login manager
|
|
3140
|
-
|
|
3141
|
-
**Kind**: global class
|
|
3142
|
-
|
|
3143
|
-
* [Login](#Login)
|
|
3144
|
-
* [.facebook(params)](#Login+facebook) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3145
|
-
* [.google(params)](#Login+google) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3146
|
-
* [.apiKey(apikey)](#Login+apiKey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3147
|
-
* [.userPass(params)](#Login+userPass) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3148
|
-
* [.logout(session)](#Login+logout) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3149
|
-
* [.recover(username)](#Login+recover) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3150
|
-
|
|
3151
|
-
<a name="Login+facebook"></a>
|
|
3152
|
-
|
|
3153
|
-
### login.facebook(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3154
|
-
Login with social login Facebook
|
|
3155
|
-
|
|
3156
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3157
|
-
**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
|
|
3158
|
-
**Access**: public
|
|
3159
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3160
|
-
|
|
3161
|
-
| Param | Type | Description |
|
|
3162
|
-
| --- | --- | --- |
|
|
3163
|
-
| params | <code>object</code> | Params to login Facebook |
|
|
3164
|
-
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
3165
|
-
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
3166
|
-
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
3167
|
-
|
|
3168
|
-
**Example**
|
|
3169
|
-
```js
|
|
3170
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3171
|
-
|
|
3172
|
-
// Params of the instance
|
|
3173
|
-
const params = {...}
|
|
3174
|
-
const api = new API(params);
|
|
3175
|
-
const params = { accessToken: 'eyJhbGciOiJIUzI1NiIsInR5cC...' };
|
|
3176
|
-
const { auth, user } = await api.login.facebook(params);
|
|
3177
|
-
```
|
|
3178
|
-
<a name="Login+google"></a>
|
|
3179
|
-
|
|
3180
|
-
### login.google(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3181
|
-
Login with social login Google
|
|
3182
|
-
|
|
3183
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3184
|
-
**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
|
|
3185
|
-
**Access**: public
|
|
3186
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3187
|
-
|
|
3188
|
-
| Param | Type | Description |
|
|
3189
|
-
| --- | --- | --- |
|
|
3190
|
-
| params | <code>object</code> | Params to login Google |
|
|
3191
|
-
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
3192
|
-
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
3193
|
-
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
3194
|
-
|
|
3195
|
-
**Example**
|
|
3196
|
-
```js
|
|
3197
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3198
|
-
|
|
3199
|
-
// Params of the instance
|
|
3200
|
-
const params = {...}
|
|
3201
|
-
const api = new API(params);
|
|
3202
|
-
const accessToken = 'eyJhbGciOiJIUzI1NiIsInR5cC...';
|
|
3203
|
-
const { auth, user } = await api.login.google(accessToken);
|
|
3204
|
-
```
|
|
3205
|
-
<a name="Login+apiKey"></a>
|
|
3206
|
-
|
|
3207
|
-
### login.apiKey(apikey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3208
|
-
Login with apikey
|
|
3209
|
-
|
|
3210
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3211
|
-
**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
|
|
3212
|
-
**Access**: public
|
|
3213
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3214
|
-
|
|
3215
|
-
| Param | Type | Description |
|
|
3216
|
-
| --- | --- | --- |
|
|
3217
|
-
| apikey | <code>string</code> | Access key |
|
|
3218
|
-
|
|
3219
|
-
**Example**
|
|
3220
|
-
```js
|
|
3221
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3222
|
-
|
|
3223
|
-
// Params of the instance
|
|
3224
|
-
const params = {...}
|
|
3225
|
-
const api = new API(params);
|
|
3226
|
-
const apiKey = '043a0eb2-f5c3-4900-b781-7f229d00d092';
|
|
3227
|
-
const { auth, user } = await api.login.apiKey(apiKey);
|
|
3228
|
-
```
|
|
3229
|
-
<a name="Login+userPass"></a>
|
|
3230
|
-
|
|
3231
|
-
### login.userPass(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3232
|
-
Login with user and password
|
|
3233
|
-
|
|
3234
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3235
|
-
**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
|
|
3236
|
-
**Access**: public
|
|
3237
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3238
|
-
|
|
3239
|
-
| Param | Type | Description |
|
|
3240
|
-
| --- | --- | --- |
|
|
3241
|
-
| params | <code>object</code> | Object with user and password |
|
|
3242
|
-
| params.username | <code>string</code> | Username or email of the user |
|
|
3243
|
-
| params.password | <code>string</code> | Password of the user |
|
|
3244
|
-
| params.orgname | <code>string</code> | The organame of the user |
|
|
3245
|
-
|
|
3246
|
-
**Example**
|
|
3247
|
-
```js
|
|
3248
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3249
|
-
|
|
3250
|
-
// Params of the instance
|
|
3251
|
-
const params = {...}
|
|
3252
|
-
const api = new API(params);
|
|
3253
|
-
const params = {
|
|
3254
|
-
username: 'ana.silva@gmail.com',
|
|
3255
|
-
password: '123456'
|
|
3256
|
-
};
|
|
3257
|
-
const { auth, user } = await api.login.userPass(params);
|
|
3258
|
-
```
|
|
3259
|
-
<a name="Login+logout"></a>
|
|
3260
|
-
|
|
3261
|
-
### login.logout(session) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3262
|
-
Logout user system manager
|
|
3263
|
-
|
|
3264
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3265
|
-
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
3266
|
-
**Access**: public
|
|
3267
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3268
|
-
|
|
3269
|
-
| Param | Type | Description |
|
|
3270
|
-
| --- | --- | --- |
|
|
3271
|
-
| session | <code>string</code> | Session, token JWT |
|
|
3272
|
-
|
|
3273
|
-
**Example**
|
|
3274
|
-
```js
|
|
3275
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3276
|
-
|
|
3277
|
-
// Params of the instance
|
|
3278
|
-
const params = {...}
|
|
3279
|
-
const api = new API(params);
|
|
3280
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3281
|
-
const { success } = await api.login.logout(session);
|
|
3282
|
-
```
|
|
3283
|
-
<a name="Login+recover"></a>
|
|
3284
|
-
|
|
3285
|
-
### login.recover(username) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3286
|
-
Recover the password
|
|
3287
|
-
|
|
3288
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3289
|
-
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
3290
|
-
**Access**: public
|
|
3291
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3292
|
-
|
|
3293
|
-
| Param | Type | Description |
|
|
3294
|
-
| --- | --- | --- |
|
|
3295
|
-
| username | <code>string</code> | The username or email |
|
|
3296
|
-
|
|
3297
|
-
**Example**
|
|
3298
|
-
```js
|
|
3299
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3300
|
-
|
|
3301
|
-
// Params of the instance
|
|
3302
|
-
const params = {...}
|
|
3303
|
-
const api = new API(params);
|
|
3304
|
-
const { success } = await api.login.recover('myusername');
|
|
3305
|
-
```
|
|
3306
|
-
<a name="Session"></a>
|
|
3307
|
-
|
|
3308
|
-
## Session
|
|
3309
|
-
Session manager of the API
|
|
3310
|
-
|
|
3311
|
-
**Kind**: global class
|
|
3312
|
-
<a name="Session+information"></a>
|
|
3313
|
-
|
|
3314
|
-
### session.information(sessionId, suSessionId) ⇒ <code>Promise</code>
|
|
3315
|
-
Show information for session, thus validating the session (Valid token JWT)
|
|
3316
|
-
|
|
3317
|
-
**Kind**: instance method of [<code>Session</code>](#Session)
|
|
3318
|
-
**Access**: public
|
|
3319
|
-
|
|
3320
|
-
| Param | Type | Default | Description |
|
|
3321
|
-
| --- | --- | --- | --- |
|
|
3322
|
-
| sessionId | <code>string</code> | | The user session (JWT Token) |
|
|
3323
|
-
| suSessionId | <code>string</code> | <code>"sessionId"</code> | Given a JWT Token of a SU (SuperAdmin), allow to check session for another user. |
|
|
3324
|
-
|
|
3325
|
-
**Example**
|
|
3326
|
-
```js
|
|
3327
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3328
|
-
const api = new API();
|
|
3329
|
-
const sessionId = 'eyJhbFVBBiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3330
|
-
const suSessionId = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3331
|
-
await api.session.information(sessionId, suSessionId);
|
|
2638
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3332
2639
|
```
|