@docbrasil/api-systemmanager 1.0.87 → 1.0.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/admin/doctypes.js +76 -76
- package/api/admin/document.js +332 -332
- package/api/admin/form.js +151 -151
- package/api/admin/index.js +46 -46
- package/api/admin/list.js +133 -133
- package/api/admin/message.js +194 -194
- package/api/admin/notification.js +233 -233
- package/api/admin/organization.js +124 -124
- package/api/admin/plugin.js +116 -116
- package/api/admin/policy.js +78 -78
- package/api/admin/processes.js +370 -370
- package/api/admin/task.js +125 -125
- package/api/admin/user.js +185 -185
- package/api/dispatch.js +101 -101
- package/api/general/geoLocation.js +88 -88
- package/api/general/index.js +22 -22
- package/api/login.js +267 -267
- package/api/session.js +85 -85
- package/api/user/datasource.js +144 -144
- package/api/user/document.js +731 -687
- package/api/user/index.js +39 -39
- package/api/user/notification.js +101 -101
- package/api/user/organization.js +230 -230
- package/api/user/process.js +191 -191
- package/api/user/register.js +205 -205
- package/api/user/task.js +201 -201
- package/api/user/task_available.js +135 -135
- package/api/user/user.js +287 -287
- package/api/utils/cypher.js +37 -37
- package/api/utils/promises.js +118 -118
- package/bundleRollup.js +158 -158
- package/dist/bundle.cjs +4876 -4832
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +372 -666
- package/doc.md +653 -653
- package/helper/boom.js +487 -487
- package/helper/cryptojs.js +6067 -6067
- package/index.js +85 -85
- package/package-lock.json +4635 -4635
- package/package.json +68 -67
- package/readme.md +25 -25
- package/tests/admin/document.spec.js +45 -45
- package/tests/admin/form.spec.js +74 -74
- package/tests/admin/list.spec.js +86 -86
- package/tests/admin/message.js +92 -92
- package/tests/admin/notification.spec.js +174 -174
- package/tests/admin/pluginspec..js +71 -71
- package/tests/admin/policy.spec.js +71 -71
- package/tests/admin/processes.spec.js +119 -119
- package/tests/admin/users.spec.js +127 -127
- package/tests/documents.spec.js +164 -164
- package/tests/login.spec.js +91 -91
- package/tests/session.spec..js +58 -58
- package/tests/user/documents.js +164 -164
- package/tests/user/organization.js +122 -122
- package/tests/user/process.js +71 -71
- package/tests/user/user.js +88 -88
package/doc/api.md
CHANGED
|
@@ -37,12 +37,21 @@
|
|
|
37
37
|
<dt><a href="#AdminUser">AdminUser</a></dt>
|
|
38
38
|
<dd><p>Admin Class for user, permission admin</p>
|
|
39
39
|
</dd>
|
|
40
|
+
<dt><a href="#Dispatch">Dispatch</a></dt>
|
|
41
|
+
<dd><p>Api dispatch manager</p>
|
|
42
|
+
</dd>
|
|
40
43
|
<dt><a href="#GeoLocation">GeoLocation</a></dt>
|
|
41
44
|
<dd><p>General Class for user, permission organization</p>
|
|
42
45
|
</dd>
|
|
43
46
|
<dt><a href="#Users">Users</a></dt>
|
|
44
47
|
<dd><p>API request, user permission level</p>
|
|
45
48
|
</dd>
|
|
49
|
+
<dt><a href="#Login">Login</a></dt>
|
|
50
|
+
<dd><p>Login manager</p>
|
|
51
|
+
</dd>
|
|
52
|
+
<dt><a href="#Session">Session</a></dt>
|
|
53
|
+
<dd><p>Session manager of the API</p>
|
|
54
|
+
</dd>
|
|
46
55
|
<dt><a href="#Datasource">Datasource</a></dt>
|
|
47
56
|
<dd><p>Class for user datasource access, to be used with when creating new documents</p>
|
|
48
57
|
</dd>
|
|
@@ -64,12 +73,12 @@
|
|
|
64
73
|
<dt><a href="#Register">Register</a></dt>
|
|
65
74
|
<dd><p>Class for user registration in a user</p>
|
|
66
75
|
</dd>
|
|
67
|
-
<dt><a href="#Task">Task</a></dt>
|
|
68
|
-
<dd><p>Class for task, permission user</p>
|
|
69
|
-
</dd>
|
|
70
76
|
<dt><a href="#TaskAvailable">TaskAvailable</a></dt>
|
|
71
77
|
<dd><p>Class for available tasks, permission user</p>
|
|
72
78
|
</dd>
|
|
79
|
+
<dt><a href="#Task">Task</a></dt>
|
|
80
|
+
<dd><p>Class for task, permission user</p>
|
|
81
|
+
</dd>
|
|
73
82
|
<dt><a href="#User">User</a></dt>
|
|
74
83
|
<dd><p>Class for user, permission user</p>
|
|
75
84
|
</dd>
|
|
@@ -108,33 +117,7 @@ Advanced search of document in elastic search ussing system manager
|
|
|
108
117
|
|
|
109
118
|
**Example**
|
|
110
119
|
```js
|
|
111
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
112
|
-
const api = new API();
|
|
113
|
-
const params = {
|
|
114
|
-
docId: '5edd11c46b6ce9729c2c297c',
|
|
115
|
-
query: {
|
|
116
|
-
"query": {
|
|
117
|
-
"bool": {
|
|
118
|
-
"minimum_should_match": 1,
|
|
119
|
-
"should": [
|
|
120
|
-
{
|
|
121
|
-
"match": {
|
|
122
|
-
"locationText.keyword": {
|
|
123
|
-
"query": "sao pau"
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
"wildcard": {
|
|
129
|
-
"locationText.normalized": "*sao pau*"
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
]
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
137
|
-
await api.admin.document.advancedSearch(params, session);
|
|
120
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
138
121
|
docId: '5edd11c46b6ce9729c2c297c',
|
|
139
122
|
query: {
|
|
140
123
|
"query": {
|
|
141
124
|
"bool": {
|
|
142
125
|
"minimum_should_match": 1,
|
|
143
126
|
"should": [
|
|
144
127
|
{
|
|
145
128
|
"match": {
|
|
146
129
|
"locationText.keyword": {
|
|
147
130
|
"query": "sao pau"
|
|
148
131
|
}
|
|
149
132
|
}
|
|
150
133
|
},
|
|
151
134
|
{
|
|
152
135
|
"wildcard": {
|
|
153
136
|
"locationText.normalized": "*sao pau*"
|
|
154
137
|
}
|
|
155
138
|
}
|
|
156
139
|
]
|
|
157
140
|
}
|
|
158
141
|
}
|
|
159
142
|
}
|
|
160
143
|
```
|
|
161
144
|
<a name="AdminDocuments+findById"></a>
|
|
162
145
|
|
|
@@ -154,14 +137,7 @@ Get document by id
|
|
|
154
137
|
|
|
155
138
|
**Example**
|
|
156
139
|
```js
|
|
157
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
158
|
-
const api = new API();
|
|
159
|
-
const params = {
|
|
160
|
-
docId: '5edd11c46b6ce9729c2c297c',
|
|
161
|
-
orgId: '55e4a3bd6be6b45210833fae'
|
|
162
|
-
};
|
|
163
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
164
|
-
await api.admin.document.findById(params, session);
|
|
140
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
165
141
|
docId: '5edd11c46b6ce9729c2c297c',
|
|
166
142
|
orgId: '55e4a3bd6be6b45210833fae'
|
|
167
143
|
```
|
|
168
144
|
<a name="AdminDocuments+signedUrl"></a>
|
|
169
145
|
|
|
@@ -182,25 +158,11 @@ Request signed url url to put or get
|
|
|
182
158
|
|
|
183
159
|
**Example**
|
|
184
160
|
```js
|
|
185
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
186
|
-
const api = new API();
|
|
187
|
-
const params - {
|
|
188
|
-
methodType: 'put',
|
|
189
|
-
docId: '5dadd01dc4af3941d42f8c5c'
|
|
190
|
-
};
|
|
191
|
-
const apiKey: '...';
|
|
192
|
-
const { docId, name, areaId, type, signedUrl } = await api.admin.document.signedUrl(params, apiKey);
|
|
161
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
193
162
|
methodType: 'put',
|
|
194
163
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
195
164
|
```
|
|
196
165
|
**Example**
|
|
197
166
|
```js
|
|
198
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
199
|
-
const api = new API();
|
|
200
|
-
const params - {
|
|
201
|
-
methodType: 'get',
|
|
202
|
-
docId: '5dadd01dc4af3941d42f8c5c'
|
|
203
|
-
};
|
|
204
|
-
const apiKey: '...';
|
|
205
|
-
const { signedUrl, imageType } = await api.admin.document.signedUrl(params, apiKey);
|
|
167
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
206
168
|
methodType: 'get',
|
|
207
169
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
208
170
|
```
|
|
209
171
|
<a name="AdminDocuments+updateContent"></a>
|
|
210
172
|
|
|
@@ -221,14 +183,7 @@ Update a document content
|
|
|
221
183
|
|
|
222
184
|
**Example**
|
|
223
185
|
```js
|
|
224
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
225
|
-
const api = new API();
|
|
226
|
-
const params - {
|
|
227
|
-
content: 'some text...',
|
|
228
|
-
docId: '5dadd01dc4af3941d42f8c5c'
|
|
229
|
-
};
|
|
230
|
-
const apiKey: '...';
|
|
231
|
-
await api.admin.document.updateContent(params, apiKey);
|
|
186
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
232
187
|
content: 'some text...',
|
|
233
188
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
234
189
|
```
|
|
235
190
|
<a name="AdminDocuments+updateAI"></a>
|
|
236
191
|
|
|
@@ -255,14 +210,7 @@ Update a document content
|
|
|
255
210
|
|
|
256
211
|
**Example**
|
|
257
212
|
```js
|
|
258
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
259
|
-
const api = new API();
|
|
260
|
-
const params - {
|
|
261
|
-
content: 'some text...',
|
|
262
|
-
docId: '5dadd01dc4af3941d42f8c5c'
|
|
263
|
-
};
|
|
264
|
-
const apiKey: '...';
|
|
265
|
-
await api.admin.document.updateContent(params, apiKey);
|
|
213
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
266
214
|
content: 'some text...',
|
|
267
215
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
268
216
|
```
|
|
269
217
|
<a name="AdminDocuments+getContent"></a>
|
|
270
218
|
|
|
@@ -283,14 +231,7 @@ Get the content of a document
|
|
|
283
231
|
|
|
284
232
|
**Example**
|
|
285
233
|
```js
|
|
286
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
287
|
-
const api = new API();
|
|
288
|
-
const params - {
|
|
289
|
-
page: '0',
|
|
290
|
-
docId: '5dadd01dc4af3941d42f8c5c'
|
|
291
|
-
};
|
|
292
|
-
const apiKey: '...';
|
|
293
|
-
await api.admin.document.getContent(params, apiKey);
|
|
234
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
294
235
|
page: '0',
|
|
295
236
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
296
237
|
```
|
|
297
238
|
<a name="AdminForm"></a>
|
|
298
239
|
|
|
@@ -321,14 +262,7 @@ Get advance form by ID
|
|
|
321
262
|
|
|
322
263
|
**Example**
|
|
323
264
|
```js
|
|
324
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
325
|
-
const api = new API();
|
|
326
|
-
const params = {
|
|
327
|
-
id: '55e4a3bd6be6b45210833fae',
|
|
328
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
329
|
-
};
|
|
330
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
331
|
-
await api.admin.form.findById(params, session);
|
|
265
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
332
266
|
id: '55e4a3bd6be6b45210833fae',
|
|
333
267
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
334
268
|
```
|
|
335
269
|
<a name="AdminForm+getFormList"></a>
|
|
336
270
|
|
|
@@ -352,13 +286,7 @@ Request signed url url to put or get
|
|
|
352
286
|
|
|
353
287
|
**Example**
|
|
354
288
|
```js
|
|
355
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
356
|
-
const api = new API();
|
|
357
|
-
const params - {
|
|
358
|
-
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
359
|
-
};
|
|
360
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
361
|
-
await api.user.form.getFormList(params, session);
|
|
289
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
362
290
|
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
363
291
|
```
|
|
364
292
|
<a name="Admin"></a>
|
|
365
293
|
|
|
@@ -405,14 +333,7 @@ Get list by ID
|
|
|
405
333
|
|
|
406
334
|
**Example**
|
|
407
335
|
```js
|
|
408
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
409
|
-
const api = new API();
|
|
410
|
-
const params = {
|
|
411
|
-
id: '55e4a3bd6be6b45210833fae',
|
|
412
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
413
|
-
};
|
|
414
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
415
|
-
await api.admin.list.findById(params, session);
|
|
336
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
416
337
|
id: '55e4a3bd6be6b45210833fae',
|
|
417
338
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
418
339
|
```
|
|
419
340
|
<a name="AdminLists+find"></a>
|
|
420
341
|
|
|
@@ -433,13 +354,7 @@ Get all lists
|
|
|
433
354
|
|
|
434
355
|
**Example**
|
|
435
356
|
```js
|
|
436
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
437
|
-
const api = new API();
|
|
438
|
-
const params = {
|
|
439
|
-
orgId: '55e4a3bd6be6b45210833fae'
|
|
440
|
-
};
|
|
441
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
442
|
-
await api.admin.list.find(params, session);
|
|
357
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
443
358
|
orgId: '55e4a3bd6be6b45210833fae'
|
|
444
359
|
```
|
|
445
360
|
<a name="AdminMessage"></a>
|
|
446
361
|
|
|
@@ -517,15 +432,7 @@ Send email, array with email list or send one email
|
|
|
517
432
|
|
|
518
433
|
**Example**
|
|
519
434
|
```js
|
|
520
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
521
|
-
const api = new API();
|
|
522
|
-
const params = {
|
|
523
|
-
subject: 'Test email',
|
|
524
|
-
message: '<h1>Hi!</h1>',
|
|
525
|
-
to: 'destination@gmail.com'
|
|
526
|
-
};
|
|
527
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
528
|
-
await api.admin.message.sendEmail(params, session);
|
|
435
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
529
436
|
subject: 'Test email',
|
|
530
437
|
message: '<h1>Hi!</h1>',
|
|
531
438
|
to: 'destination@gmail.com'
|
|
532
439
|
```
|
|
533
440
|
<a name="AdminNotification"></a>
|
|
534
441
|
|
|
@@ -535,11 +442,26 @@ Admin Class for notification, permission admin
|
|
|
535
442
|
**Kind**: global class
|
|
536
443
|
|
|
537
444
|
* [AdminNotification](#AdminNotification)
|
|
445
|
+
* [.realTime(params, session)](#AdminNotification+realTime) ⇒ <code>Promise.<\*></code>
|
|
538
446
|
* [.add(params, session)](#AdminNotification+add) ⇒ <code>Promise</code>
|
|
539
447
|
* [.findById(params, session)](#AdminNotification+findById) ⇒ <code>Promise</code>
|
|
540
448
|
* [.findByIdAndUpdate(params, session)](#AdminNotification+findByIdAndUpdate) ⇒ <code>Promise</code>
|
|
541
449
|
* [.findByIdAndRemove(params, session)](#AdminNotification+findByIdAndRemove) ⇒ <code>Promise</code>
|
|
542
450
|
|
|
451
|
+
<a name="AdminNotification+realTime"></a>
|
|
452
|
+
|
|
453
|
+
### adminNotification.realTime(params, session) ⇒ <code>Promise.<\*></code>
|
|
454
|
+
Send real time notification
|
|
455
|
+
|
|
456
|
+
**Kind**: instance method of [<code>AdminNotification</code>](#AdminNotification)
|
|
457
|
+
|
|
458
|
+
| Param | Type | Description |
|
|
459
|
+
| --- | --- | --- |
|
|
460
|
+
| params | <code>object</code> | Params to send notification |
|
|
461
|
+
| params.userIds | <code>string</code> | Users to send notification |
|
|
462
|
+
| params.message | <code>object</code> | Object with data to send user |
|
|
463
|
+
| session | <code>object</code> | Session, token JWT |
|
|
464
|
+
|
|
543
465
|
<a name="AdminNotification+add"></a>
|
|
544
466
|
|
|
545
467
|
### adminNotification.add(params, session) ⇒ <code>Promise</code>
|
|
@@ -559,15 +481,7 @@ Create notification
|
|
|
559
481
|
|
|
560
482
|
**Example**
|
|
561
483
|
```js
|
|
562
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
563
|
-
const api = new API();
|
|
564
|
-
const params = {
|
|
565
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
566
|
-
userId: '55e4a3bd6be6b45210833fae',
|
|
567
|
-
message: 'Olá como vai tudo bem?'
|
|
568
|
-
};
|
|
569
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
570
|
-
await api.admin.notifications.add(params, session);
|
|
484
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
571
485
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
572
486
|
userId: '55e4a3bd6be6b45210833fae',
|
|
573
487
|
message: 'Olá como vai tudo bem?'
|
|
574
488
|
```
|
|
575
489
|
<a name="AdminNotification+findById"></a>
|
|
576
490
|
|
|
@@ -587,14 +501,7 @@ Search notification using (notificationId or userId)
|
|
|
587
501
|
|
|
588
502
|
**Example**
|
|
589
503
|
```js
|
|
590
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
591
|
-
const api = new API();
|
|
592
|
-
const params = {
|
|
593
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
594
|
-
id: '55e4a3bd6be6b45210833fae',
|
|
595
|
-
};
|
|
596
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
597
|
-
await api.admin.notifications.findById(params, session);
|
|
504
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
598
505
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
599
506
|
id: '55e4a3bd6be6b45210833fae',
|
|
600
507
|
```
|
|
601
508
|
<a name="AdminNotification+findByIdAndUpdate"></a>
|
|
602
509
|
|
|
@@ -615,15 +522,7 @@ Update notification using (notificationId or userId)
|
|
|
615
522
|
|
|
616
523
|
**Example**
|
|
617
524
|
```js
|
|
618
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
619
|
-
const api = new API();
|
|
620
|
-
const params = {
|
|
621
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
622
|
-
id: '55e4a3bd6be6b45210833fae',
|
|
623
|
-
read: true
|
|
624
|
-
};
|
|
625
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
626
|
-
await api.admin.notifications.findByIdAndUpdate(params, session);
|
|
525
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
627
526
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
628
527
|
id: '55e4a3bd6be6b45210833fae',
|
|
629
528
|
read: true
|
|
630
529
|
```
|
|
631
530
|
<a name="AdminNotification+findByIdAndRemove"></a>
|
|
632
531
|
|
|
@@ -643,14 +542,7 @@ Delete notification using (notificationId or userId)
|
|
|
643
542
|
|
|
644
543
|
**Example**
|
|
645
544
|
```js
|
|
646
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
647
|
-
const api = new API();
|
|
648
|
-
const params = {
|
|
649
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
650
|
-
id: '55e4a3bd6be6b45210833fae',
|
|
651
|
-
};
|
|
652
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
653
|
-
await api.admin.notifications.findByIdAndDelete(params, session);
|
|
545
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
654
546
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
655
547
|
id: '55e4a3bd6be6b45210833fae',
|
|
656
548
|
```
|
|
657
549
|
<a name="Organization"></a>
|
|
658
550
|
|
|
@@ -687,15 +579,7 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
687
579
|
|
|
688
580
|
**Example**
|
|
689
581
|
```js
|
|
690
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
691
|
-
const api = new API();
|
|
692
|
-
const params = {
|
|
693
|
-
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
694
|
-
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
695
|
-
type: 'image/png',
|
|
696
|
-
};
|
|
697
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
698
|
-
await api.admin.organizations.upsertAvatar(params, session);
|
|
582
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
699
583
|
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
700
584
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
701
585
|
type: 'image/png',
|
|
702
586
|
```
|
|
703
587
|
<a name="Organization+removeAvatar"></a>
|
|
704
588
|
|
|
@@ -713,11 +597,7 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
713
597
|
|
|
714
598
|
**Example**
|
|
715
599
|
```js
|
|
716
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
717
|
-
const api = new API();
|
|
718
|
-
const orgId = '5dadd01dc4af3941d42f8c5c';
|
|
719
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
720
|
-
await api.admin.organizations.removeAvatar(orgId, session);
|
|
600
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
721
601
|
```
|
|
722
602
|
<a name="Organization+findById"></a>
|
|
723
603
|
|
|
@@ -735,11 +615,7 @@ Find organization by id
|
|
|
735
615
|
|
|
736
616
|
**Example**
|
|
737
617
|
```js
|
|
738
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
739
|
-
const api = new API();
|
|
740
|
-
const orgId = '80443245000122';
|
|
741
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
742
|
-
await api.user.organization.findById(idCard, session);
|
|
618
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
743
619
|
```
|
|
744
620
|
<a name="Organization+idCardExist"></a>
|
|
745
621
|
|
|
@@ -757,11 +633,7 @@ Check if id card exist
|
|
|
757
633
|
|
|
758
634
|
**Example**
|
|
759
635
|
```js
|
|
760
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
761
|
-
const api = new API();
|
|
762
|
-
const idCard = '80443245000122';
|
|
763
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
764
|
-
await api.user.organization.idCardExist(idCard, session);
|
|
636
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
765
637
|
```
|
|
766
638
|
<a name="Organization+upsertAvatar"></a>
|
|
767
639
|
|
|
@@ -781,14 +653,7 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
781
653
|
|
|
782
654
|
**Example**
|
|
783
655
|
```js
|
|
784
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
785
|
-
const api = new API();
|
|
786
|
-
const params = {
|
|
787
|
-
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
788
|
-
type: 'image/png',
|
|
789
|
-
};
|
|
790
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
791
|
-
await api.user.profile.updateAvatar(params, session);
|
|
656
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
792
657
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
793
658
|
type: 'image/png',
|
|
794
659
|
```
|
|
795
660
|
<a name="Organization+removeAvatar"></a>
|
|
796
661
|
|
|
@@ -805,10 +670,7 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
805
670
|
|
|
806
671
|
**Example**
|
|
807
672
|
```js
|
|
808
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
809
|
-
const api = new API();
|
|
810
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
811
|
-
await api.user.profile.removeAvatar(session);
|
|
673
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
812
674
|
```
|
|
813
675
|
<a name="Organization+callFetch"></a>
|
|
814
676
|
|
|
@@ -828,14 +690,7 @@ Call URL internal, need auth JWT (session)
|
|
|
828
690
|
|
|
829
691
|
**Example**
|
|
830
692
|
```js
|
|
831
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
832
|
-
const api = new API();
|
|
833
|
-
|
|
834
|
-
const params = {
|
|
835
|
-
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
836
|
-
method: 'POST'
|
|
837
|
-
}
|
|
838
|
-
await api.user.organization.callFetchs(params, session);
|
|
693
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
839
694
|
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
840
695
|
method: 'POST'
|
|
841
696
|
```
|
|
842
697
|
<a name="AdminPlugin"></a>
|
|
843
698
|
|
|
@@ -865,11 +720,7 @@ Find plugins
|
|
|
865
720
|
|
|
866
721
|
**Example**
|
|
867
722
|
```js
|
|
868
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
869
|
-
const api = new API();
|
|
870
|
-
const params = {page: 1, perPage: 200};
|
|
871
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
872
|
-
await api.user.organization.findById(params, session);
|
|
723
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
873
724
|
```
|
|
874
725
|
<a name="AdminPlugin+findById"></a>
|
|
875
726
|
|
|
@@ -887,11 +738,7 @@ Get plugin by ID
|
|
|
887
738
|
|
|
888
739
|
**Example**
|
|
889
740
|
```js
|
|
890
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
891
|
-
const api = new API();
|
|
892
|
-
const id ='55e4a3bd6be6b45210833fae',
|
|
893
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
894
|
-
await api.admin.plugin.findById(id, session);
|
|
741
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
895
742
|
```
|
|
896
743
|
<a name="AdminPolicy"></a>
|
|
897
744
|
|
|
@@ -914,10 +761,7 @@ Find all policies
|
|
|
914
761
|
|
|
915
762
|
**Example**
|
|
916
763
|
```js
|
|
917
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
918
|
-
const api = new API();
|
|
919
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
920
|
-
await api.admin.policy.find(session);
|
|
764
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
921
765
|
```
|
|
922
766
|
<a name="AdminProcesses"></a>
|
|
923
767
|
|
|
@@ -941,16 +785,7 @@ Advanced search of processes, check documentation, to verify all params, pass to
|
|
|
941
785
|
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
942
786
|
**Example**
|
|
943
787
|
```js
|
|
944
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
945
|
-
const api = new API();
|
|
946
|
-
const params = {
|
|
947
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
948
|
-
...
|
|
949
|
-
...
|
|
950
|
-
...
|
|
951
|
-
};
|
|
952
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
953
|
-
await api.admin.processes.search(params, session);
|
|
788
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
954
789
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
955
790
|
...
|
|
956
791
|
...
|
|
957
792
|
...
|
|
958
793
|
```
|
|
959
794
|
<a name="AdminProcesses+advancedSearch"></a>
|
|
960
795
|
|
|
@@ -970,23 +805,7 @@ Advanced search of process in elastic search ussing system manager
|
|
|
970
805
|
|
|
971
806
|
**Example**
|
|
972
807
|
```js
|
|
973
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
974
|
-
const api = new API();
|
|
975
|
-
const params = {
|
|
976
|
-
orgProcessId: '5edd11c46b6ce9729c2c297c',
|
|
977
|
-
query: {
|
|
978
|
-
"_source": "processData.properties.processProperties",
|
|
979
|
-
"query": {
|
|
980
|
-
"term": {
|
|
981
|
-
"initParams.email.keyword": {
|
|
982
|
-
"value": "clintes001@gmail.com"
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
989
|
-
await api.admin.processes.advancedSearch(params, session);
|
|
808
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
990
809
|
orgProcessId: '5edd11c46b6ce9729c2c297c',
|
|
991
810
|
query: {
|
|
992
811
|
"_source": "processData.properties.processProperties",
|
|
993
812
|
"query": {
|
|
994
813
|
"term": {
|
|
995
814
|
"initParams.email.keyword": {
|
|
996
815
|
"value": "clintes001@gmail.com"
|
|
997
816
|
}
|
|
998
817
|
}
|
|
999
818
|
}
|
|
1000
819
|
}
|
|
1001
820
|
```
|
|
1002
821
|
<a name="AdminTask"></a>
|
|
1003
822
|
|
|
@@ -1017,13 +836,7 @@ Get task by user Id
|
|
|
1017
836
|
|
|
1018
837
|
**Example**
|
|
1019
838
|
```js
|
|
1020
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1021
|
-
const api = new API();
|
|
1022
|
-
const params = {
|
|
1023
|
-
userId: '55e4a3bd6be6b45210833fae',
|
|
1024
|
-
};
|
|
1025
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1026
|
-
await api.admin.task.find(params, session);
|
|
839
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1027
840
|
userId: '55e4a3bd6be6b45210833fae',
|
|
1028
841
|
```
|
|
1029
842
|
<a name="AdminUser"></a>
|
|
1030
843
|
|
|
@@ -1054,11 +867,7 @@ Request profile by userId
|
|
|
1054
867
|
|
|
1055
868
|
**Example**
|
|
1056
869
|
```js
|
|
1057
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1058
|
-
const api = new API();
|
|
1059
|
-
const userId = '55e4a3bd6be6b45210833fae';
|
|
1060
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1061
|
-
await api.admin.user.findById(userId, session);
|
|
870
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1062
871
|
```
|
|
1063
872
|
<a name="AdminUser+findByIdAndUpdatePassword"></a>
|
|
1064
873
|
|
|
@@ -1079,15 +888,7 @@ Update password by userId
|
|
|
1079
888
|
|
|
1080
889
|
**Example**
|
|
1081
890
|
```js
|
|
1082
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1083
|
-
const api = new API();
|
|
1084
|
-
const params = {
|
|
1085
|
-
userId: '55e4a3bd6be6b45210833fae',
|
|
1086
|
-
oldPassword: '123456',
|
|
1087
|
-
newPassword: '123456789'
|
|
1088
|
-
};
|
|
1089
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1090
|
-
await api.admin.user.findByIdAndUpdatePassword(params, session);
|
|
891
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1091
892
|
userId: '55e4a3bd6be6b45210833fae',
|
|
1092
893
|
oldPassword: '123456',
|
|
1093
894
|
newPassword: '123456789'
|
|
1094
895
|
```
|
|
1095
896
|
<a name="AdminUser+emailExist"></a>
|
|
1096
897
|
|
|
@@ -1105,11 +906,7 @@ Check if email is unique
|
|
|
1105
906
|
|
|
1106
907
|
**Example**
|
|
1107
908
|
```js
|
|
1108
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1109
|
-
const api = new API();
|
|
1110
|
-
const email = 'ana.silva@gmail.com';
|
|
1111
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1112
|
-
await api.admin.user.emailExist(email, session);
|
|
909
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1113
910
|
```
|
|
1114
911
|
<a name="AdminUser+findByIdAndUpdate"></a>
|
|
1115
912
|
|
|
@@ -1127,12 +924,49 @@ update userData by userSMId
|
|
|
1127
924
|
|
|
1128
925
|
**Example**
|
|
1129
926
|
```js
|
|
1130
|
-
const userId = '55e4a3bd6be6b45210833fae';
|
|
1131
|
-
const payload = {
|
|
1132
|
-
name: 'Maria joaquina',
|
|
1133
|
-
email: 'maria@gmail.com'
|
|
1134
|
-
};
|
|
1135
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
927
|
+
const userId = '55e4a3bd6be6b45210833fae';
|
|
1136
928
|
name: 'Maria joaquina',
|
|
1137
929
|
email: 'maria@gmail.com'
|
|
930
|
+
```
|
|
931
|
+
<a name="Dispatch"></a>
|
|
932
|
+
|
|
933
|
+
## Dispatch
|
|
934
|
+
Api dispatch manager
|
|
935
|
+
|
|
936
|
+
**Kind**: global class
|
|
937
|
+
|
|
938
|
+
* [Dispatch](#Dispatch)
|
|
939
|
+
* [.getContext(url, session)](#Dispatch+getContext) ⇒ <code>Promise.<object></code>
|
|
940
|
+
* [.getClient()](#Dispatch+getClient) ⇒ <code>promise</code>
|
|
941
|
+
|
|
942
|
+
<a name="Dispatch+getContext"></a>
|
|
943
|
+
|
|
944
|
+
### dispatch.getContext(url, session) ⇒ <code>Promise.<object></code>
|
|
945
|
+
Get the URL context
|
|
946
|
+
|
|
947
|
+
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
948
|
+
**Returns**: <code>Promise.<object></code> - The full data context of the URL
|
|
949
|
+
**Access**: public
|
|
950
|
+
|
|
951
|
+
| Param | Type | Default | Description |
|
|
952
|
+
| --- | --- | --- | --- |
|
|
953
|
+
| url | <code>string</code> | | Full url |
|
|
954
|
+
| session | <code>session</code> | <code></code> | Session, token JWT |
|
|
955
|
+
|
|
956
|
+
**Example**
|
|
957
|
+
```js
|
|
958
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
959
|
+
```
|
|
960
|
+
<a name="Dispatch+getClient"></a>
|
|
961
|
+
|
|
962
|
+
### dispatch.getClient() ⇒ <code>promise</code>
|
|
963
|
+
Get client Axios
|
|
964
|
+
|
|
965
|
+
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
966
|
+
**Returns**: <code>promise</code> - return client axios
|
|
967
|
+
**Access**: public
|
|
968
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
969
|
+
**Example**
|
|
970
|
+
```js
|
|
971
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1138
972
|
```
|
|
1139
973
|
<a name="GeoLocation"></a>
|
|
1140
974
|
|
|
@@ -1157,13 +991,7 @@ Get geo location of the address
|
|
|
1157
991
|
|
|
1158
992
|
**Example**
|
|
1159
993
|
```js
|
|
1160
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1161
|
-
const api = new API();
|
|
1162
|
-
const params = {
|
|
1163
|
-
address: 'Rua Sud Menucci, 615 - Vila Camilopolis, Santo André - SP',
|
|
1164
|
-
apiKey: 'AIzaSyC7gJFOkuT-Mel3WZbX5uKuJ1USqLVkGnY',
|
|
1165
|
-
};
|
|
1166
|
-
await api.general.geo.location(params);
|
|
994
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1167
995
|
address: 'Rua Sud Menucci, 615 - Vila Camilopolis, Santo André - SP',
|
|
1168
996
|
apiKey: 'AIzaSyC7gJFOkuT-Mel3WZbX5uKuJ1USqLVkGnY',
|
|
1169
997
|
```
|
|
1170
998
|
<a name="Users"></a>
|
|
1171
999
|
|
|
@@ -1195,6 +1023,161 @@ API request, user permission level
|
|
|
1195
1023
|
| options | <code>object</code> | Params of the constructor |
|
|
1196
1024
|
| options.parent | <code>object</code> | This of the pararent |
|
|
1197
1025
|
|
|
1026
|
+
<a name="Login"></a>
|
|
1027
|
+
|
|
1028
|
+
## Login
|
|
1029
|
+
Login manager
|
|
1030
|
+
|
|
1031
|
+
**Kind**: global class
|
|
1032
|
+
|
|
1033
|
+
* [Login](#Login)
|
|
1034
|
+
* [.facebook(params)](#Login+facebook) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1035
|
+
* [.google(params)](#Login+google) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1036
|
+
* [.apiKey(apikey)](#Login+apiKey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1037
|
+
* [.userPass(params)](#Login+userPass) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1038
|
+
* [.logout(session)](#Login+logout) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1039
|
+
* [.recover(username)](#Login+recover) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1040
|
+
|
|
1041
|
+
<a name="Login+facebook"></a>
|
|
1042
|
+
|
|
1043
|
+
### login.facebook(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1044
|
+
Login with social login Facebook
|
|
1045
|
+
|
|
1046
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1047
|
+
**Returns**: <code>promise.<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
|
|
1048
|
+
**Access**: public
|
|
1049
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1050
|
+
|
|
1051
|
+
| Param | Type | Description |
|
|
1052
|
+
| --- | --- | --- |
|
|
1053
|
+
| params | <code>object</code> | Params to login Facebook |
|
|
1054
|
+
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
1055
|
+
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
1056
|
+
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
1057
|
+
|
|
1058
|
+
**Example**
|
|
1059
|
+
```js
|
|
1060
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1061
|
+
```
|
|
1062
|
+
<a name="Login+google"></a>
|
|
1063
|
+
|
|
1064
|
+
### login.google(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1065
|
+
Login with social login Google
|
|
1066
|
+
|
|
1067
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1068
|
+
**Returns**: <code>promise.<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
|
|
1069
|
+
**Access**: public
|
|
1070
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1071
|
+
|
|
1072
|
+
| Param | Type | Description |
|
|
1073
|
+
| --- | --- | --- |
|
|
1074
|
+
| params | <code>object</code> | Params to login Google |
|
|
1075
|
+
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
1076
|
+
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
1077
|
+
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
1078
|
+
|
|
1079
|
+
**Example**
|
|
1080
|
+
```js
|
|
1081
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1082
|
+
```
|
|
1083
|
+
<a name="Login+apiKey"></a>
|
|
1084
|
+
|
|
1085
|
+
### login.apiKey(apikey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1086
|
+
Login with apikey
|
|
1087
|
+
|
|
1088
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1089
|
+
**Returns**: <code>promise.<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
|
|
1090
|
+
**Access**: public
|
|
1091
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1092
|
+
|
|
1093
|
+
| Param | Type | Description |
|
|
1094
|
+
| --- | --- | --- |
|
|
1095
|
+
| apikey | <code>string</code> | Access key |
|
|
1096
|
+
|
|
1097
|
+
**Example**
|
|
1098
|
+
```js
|
|
1099
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1100
|
+
```
|
|
1101
|
+
<a name="Login+userPass"></a>
|
|
1102
|
+
|
|
1103
|
+
### login.userPass(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1104
|
+
Login with user and password
|
|
1105
|
+
|
|
1106
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1107
|
+
**Returns**: <code>promise.<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
|
|
1108
|
+
**Access**: public
|
|
1109
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1110
|
+
|
|
1111
|
+
| Param | Type | Description |
|
|
1112
|
+
| --- | --- | --- |
|
|
1113
|
+
| params | <code>object</code> | Object with user and password |
|
|
1114
|
+
| params.username | <code>string</code> | Username or email of the user |
|
|
1115
|
+
| params.password | <code>string</code> | Password of the user |
|
|
1116
|
+
| params.orgname | <code>string</code> | The organame of the user |
|
|
1117
|
+
|
|
1118
|
+
**Example**
|
|
1119
|
+
```js
|
|
1120
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1198
1121
|
username: 'ana.silva@gmail.com',
|
|
1199
1122
|
password: '123456'
|
|
1123
|
+
```
|
|
1124
|
+
<a name="Login+logout"></a>
|
|
1125
|
+
|
|
1126
|
+
### login.logout(session) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1127
|
+
Logout user system manager
|
|
1128
|
+
|
|
1129
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1130
|
+
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
1131
|
+
**Access**: public
|
|
1132
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1133
|
+
|
|
1134
|
+
| Param | Type | Description |
|
|
1135
|
+
| --- | --- | --- |
|
|
1136
|
+
| session | <code>string</code> | Session, token JWT |
|
|
1137
|
+
|
|
1138
|
+
**Example**
|
|
1139
|
+
```js
|
|
1140
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1141
|
+
```
|
|
1142
|
+
<a name="Login+recover"></a>
|
|
1143
|
+
|
|
1144
|
+
### login.recover(username) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1145
|
+
Recover the password
|
|
1146
|
+
|
|
1147
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1148
|
+
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
1149
|
+
**Access**: public
|
|
1150
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1151
|
+
|
|
1152
|
+
| Param | Type | Description |
|
|
1153
|
+
| --- | --- | --- |
|
|
1154
|
+
| username | <code>string</code> | The username or email |
|
|
1155
|
+
|
|
1156
|
+
**Example**
|
|
1157
|
+
```js
|
|
1158
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1159
|
+
```
|
|
1160
|
+
<a name="Session"></a>
|
|
1161
|
+
|
|
1162
|
+
## Session
|
|
1163
|
+
Session manager of the API
|
|
1164
|
+
|
|
1165
|
+
**Kind**: global class
|
|
1166
|
+
<a name="Session+information"></a>
|
|
1167
|
+
|
|
1168
|
+
### session.information(sessionId, suSessionId) ⇒ <code>Promise</code>
|
|
1169
|
+
Show information for session, thus validating the session (Valid token JWT)
|
|
1170
|
+
|
|
1171
|
+
**Kind**: instance method of [<code>Session</code>](#Session)
|
|
1172
|
+
**Access**: public
|
|
1173
|
+
|
|
1174
|
+
| Param | Type | Default | Description |
|
|
1175
|
+
| --- | --- | --- | --- |
|
|
1176
|
+
| sessionId | <code>string</code> | | The user session (JWT Token) |
|
|
1177
|
+
| suSessionId | <code>string</code> | <code>"sessionId"</code> | Given a JWT Token of a SU (SuperAdmin), allow to check session for another user. |
|
|
1178
|
+
|
|
1179
|
+
**Example**
|
|
1180
|
+
```js
|
|
1181
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1182
|
+
```
|
|
1200
1183
|
<a name="Datasource"></a>
|
|
1201
1184
|
|
|
1202
1185
|
## Datasource
|
|
@@ -1224,15 +1207,7 @@ Method to get autocomplete data from a datasource
|
|
|
1224
1207
|
|
|
1225
1208
|
**Example**
|
|
1226
1209
|
```js
|
|
1227
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1228
|
-
const api = new API();
|
|
1229
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1230
|
-
const params = {
|
|
1231
|
-
orgId: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
|
|
1232
|
-
dataSources: [{}],
|
|
1233
|
-
documents: [{}]
|
|
1234
|
-
};
|
|
1235
|
-
const retData = await api.user.datasource.autocomplete(params, session);
|
|
1210
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1236
1211
|
orgId: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
|
|
1237
1212
|
dataSources: [{}],
|
|
1238
1213
|
documents: [{}]
|
|
1239
1214
|
```
|
|
1240
1215
|
<a name="Documents"></a>
|
|
1241
1216
|
|
|
@@ -1250,6 +1225,7 @@ Class for documents, permission user
|
|
|
1250
1225
|
* [.signedUrls(params, session)](#Documents+signedUrls) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1251
1226
|
* [.uploadSignedDocument(params)](#Documents+uploadSignedDocument) ⇒ <code>Promise.<boolean></code>
|
|
1252
1227
|
* [.checkPrimaryKeys(params, session)](#Documents+checkPrimaryKeys) ⇒ <code>Promise.<array></code> \| <code>array.<string></code>
|
|
1228
|
+
* [.searchDocuments(params, session)](#Documents+searchDocuments) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
1253
1229
|
|
|
1254
1230
|
<a name="Documents+add"></a>
|
|
1255
1231
|
|
|
@@ -1291,23 +1267,7 @@ Create new document
|
|
|
1291
1267
|
|
|
1292
1268
|
**Example**
|
|
1293
1269
|
```js
|
|
1294
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1295
|
-
const api = new API();
|
|
1296
|
-
const params = {
|
|
1297
|
-
orgname: 'cloundbrasil',
|
|
1298
|
-
areaId: '5edf9f8ee896b817e45b8dac',
|
|
1299
|
-
docId: '5edf86fbe896b817e45b8da6',
|
|
1300
|
-
fileName: 'foto',
|
|
1301
|
-
type: 'image/png',
|
|
1302
|
-
name: 'Fotografia',
|
|
1303
|
-
docTypeId = '5edf9f8ee896b817e45b8dac',
|
|
1304
|
-
bytes: 12345,
|
|
1305
|
-
signedUrl: 'https://s3.amazonaws.com...'
|
|
1306
|
-
docTypeFieldsData: {extraUser: '12349f8ee896b817e45b8dac'},
|
|
1307
|
-
orgId: '5df7f19618430c89a41a19d2',
|
|
1308
|
-
};
|
|
1309
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1310
|
-
await api.user.document.add(params, session);
|
|
1270
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1311
1271
|
orgname: 'cloundbrasil',
|
|
1312
1272
|
areaId: '5edf9f8ee896b817e45b8dac',
|
|
1313
1273
|
docId: '5edf86fbe896b817e45b8da6',
|
|
1314
1274
|
fileName: 'foto',
|
|
1315
1275
|
type: 'image/png',
|
|
1316
1276
|
name: 'Fotografia',
|
|
1317
1277
|
docTypeId = '5edf9f8ee896b817e45b8dac',
|
|
1318
1278
|
bytes: 12345,
|
|
1319
1279
|
signedUrl: 'https://s3.amazonaws.com...'
|
|
1320
1280
|
docTypeFieldsData: {extraUser: '12349f8ee896b817e45b8dac'},
|
|
1321
1281
|
orgId: '5df7f19618430c89a41a19d2',
|
|
1322
1282
|
```
|
|
1323
1283
|
<a name="Documents+find"></a>
|
|
1324
1284
|
|
|
@@ -1335,18 +1295,7 @@ await api.user.document.add(params, session);
|
|
|
1335
1295
|
|
|
1336
1296
|
**Example**
|
|
1337
1297
|
```js
|
|
1338
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1339
|
-
const api = new API();
|
|
1340
|
-
const params - {
|
|
1341
|
-
index: 'extraCity',
|
|
1342
|
-
txtToSearch: 'São',
|
|
1343
|
-
docId: '5df7f19618430c89a41a19d2',
|
|
1344
|
-
docAreaId: '5edd11c46b6ce9729c2c297c',
|
|
1345
|
-
tag: 'Nome da cidade',
|
|
1346
|
-
orgId: '1234d01dc4af3941d42f8c5c'
|
|
1347
|
-
};
|
|
1348
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1349
|
-
await api.user.document.findByIdAndRemove(params, session);
|
|
1298
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1350
1299
|
index: 'extraCity',
|
|
1351
1300
|
txtToSearch: 'São',
|
|
1352
1301
|
docId: '5df7f19618430c89a41a19d2',
|
|
1353
1302
|
docAreaId: '5edd11c46b6ce9729c2c297c',
|
|
1354
1303
|
tag: 'Nome da cidade',
|
|
1355
1304
|
orgId: '1234d01dc4af3941d42f8c5c'
|
|
1356
1305
|
```
|
|
1357
1306
|
<a name="Documents+findByIdAndRemove"></a>
|
|
1358
1307
|
|
|
@@ -1367,14 +1316,7 @@ Remove document by id
|
|
|
1367
1316
|
|
|
1368
1317
|
**Example**
|
|
1369
1318
|
```js
|
|
1370
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1371
|
-
const api = new API();
|
|
1372
|
-
const params - {
|
|
1373
|
-
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1374
|
-
orgIdId: '5df7f19618430c89a41a19d2',
|
|
1375
|
-
};
|
|
1376
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1377
|
-
await api.user.document.findByIdAndRemove(params, session);
|
|
1319
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1378
1320
|
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1379
1321
|
orgIdId: '5df7f19618430c89a41a19d2',
|
|
1380
1322
|
```
|
|
1381
1323
|
<a name="Documents+findByIdsAndRemove"></a>
|
|
1382
1324
|
|
|
@@ -1396,14 +1338,7 @@ Remove documents
|
|
|
1396
1338
|
|
|
1397
1339
|
**Example**
|
|
1398
1340
|
```js
|
|
1399
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1400
|
-
const api = new API();
|
|
1401
|
-
const params - {
|
|
1402
|
-
documents: [{ _id: '5dadd01dc4af3941d42f8c5c' }],
|
|
1403
|
-
orgId: '5df7f19618430c89a41a19d2',
|
|
1404
|
-
};
|
|
1405
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1406
|
-
await api.user.document.findByIdsAndRemove(params, session);
|
|
1341
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1407
1342
|
documents: [{ _id: '5dadd01dc4af3941d42f8c5c' }],
|
|
1408
1343
|
orgId: '5df7f19618430c89a41a19d2',
|
|
1409
1344
|
```
|
|
1410
1345
|
<a name="Documents+signedUrl"></a>
|
|
1411
1346
|
|
|
@@ -1429,30 +1364,11 @@ Request signed url url to put or get
|
|
|
1429
1364
|
|
|
1430
1365
|
**Example**
|
|
1431
1366
|
```js
|
|
1432
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1433
|
-
const api = new API();
|
|
1434
|
-
const params - {
|
|
1435
|
-
methodType: 'put',
|
|
1436
|
-
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1437
|
-
docAreaId: '5df7f19618430c89a41a19d2',
|
|
1438
|
-
fileName: 'Foto',
|
|
1439
|
-
type: 'image/png'
|
|
1440
|
-
orgId: '5df7f19618430c89a41a19f8'
|
|
1441
|
-
};
|
|
1442
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1443
|
-
// each doc: { docId, name, areaId, type, signedUrl }
|
|
1444
|
-
const { docs } = await api.user.document.signedUrl(params, session);
|
|
1367
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1445
1368
|
methodType: 'put',
|
|
1446
1369
|
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1447
1370
|
docAreaId: '5df7f19618430c89a41a19d2',
|
|
1448
1371
|
fileName: 'Foto',
|
|
1449
1372
|
type: 'image/png'
|
|
1450
1373
|
orgId: '5df7f19618430c89a41a19f8'
|
|
1451
1374
|
```
|
|
1452
1375
|
**Example**
|
|
1453
1376
|
```js
|
|
1454
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1455
|
-
const api = new API();
|
|
1456
|
-
const params - {
|
|
1457
|
-
methodType: 'get',
|
|
1458
|
-
document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf',
|
|
1459
|
-
};
|
|
1460
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1461
|
-
const base64Data = await api.user.document.signedUrl(params, session);
|
|
1377
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1462
1378
|
methodType: 'get',
|
|
1463
1379
|
document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf',
|
|
1464
1380
|
```
|
|
1465
1381
|
<a name="Documents+signedUrls"></a>
|
|
1466
1382
|
|
|
@@ -1479,36 +1395,11 @@ Request signed url url to put or get
|
|
|
1479
1395
|
|
|
1480
1396
|
**Example**
|
|
1481
1397
|
```js
|
|
1482
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1483
|
-
const api = new API();
|
|
1484
|
-
const params - {
|
|
1485
|
-
methodType: 'put',
|
|
1486
|
-
orgId: '5df7f19618430c89a41a19f8'
|
|
1487
|
-
docs: [
|
|
1488
|
-
{
|
|
1489
|
-
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1490
|
-
areaId: '5df7f19618430c89a41a19d2',
|
|
1491
|
-
name: 'Foto.png',
|
|
1492
|
-
type: 'image/png'
|
|
1493
|
-
}
|
|
1494
|
-
]
|
|
1495
|
-
};
|
|
1496
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1497
|
-
// each doc: { docId, name, areaId, type, signedUrl }
|
|
1498
|
-
const { docs } = await api.user.document.signedUrls(params, session);
|
|
1499
|
-
```
|
|
1500
|
-
**Example**
|
|
1501
|
-
```js
|
|
1502
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1503
|
-
const api = new API();
|
|
1504
|
-
const params - {
|
|
1505
|
-
methodType: 'get',
|
|
1506
|
-
docs: [
|
|
1507
|
-
{ document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf' }
|
|
1508
|
-
],
|
|
1509
|
-
};
|
|
1510
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1511
|
-
const base64Data = await api.user.document.signedUrls(params, session);
|
|
1398
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1512
1399
|
methodType: 'put',
|
|
1513
1400
|
orgId: '5df7f19618430c89a41a19f8'
|
|
1514
1401
|
docs: [
|
|
1515
1402
|
{
|
|
1516
1403
|
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1517
1404
|
areaId: '5df7f19618430c89a41a19d2',
|
|
1518
1405
|
name: 'Foto.png',
|
|
1519
1406
|
type: 'image/png'
|
|
1520
1407
|
}
|
|
1521
1408
|
]
|
|
1409
|
+
```
|
|
1410
|
+
**Example**
|
|
1411
|
+
```js
|
|
1412
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1522
1413
|
methodType: 'get',
|
|
1523
1414
|
docs: [
|
|
1524
1415
|
{ document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf' }
|
|
1525
1416
|
],
|
|
1526
1417
|
```
|
|
1527
1418
|
<a name="Documents+uploadSignedDocument"></a>
|
|
1528
1419
|
|
|
@@ -1529,21 +1420,7 @@ Uploads the file
|
|
|
1529
1420
|
|
|
1530
1421
|
**Example**
|
|
1531
1422
|
```js
|
|
1532
|
-
const FS = require('fs');
|
|
1533
|
-
const Path = require('path');
|
|
1534
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1535
|
-
const api = new API();
|
|
1536
|
-
const params - {
|
|
1537
|
-
content: FS.readFileSync(Path.join(__dirname, '.mypdf.pdf')),
|
|
1538
|
-
signedUrl: 'https://signedurl.com/token...',
|
|
1539
|
-
type: 'application/pdf'
|
|
1540
|
-
};
|
|
1541
|
-
const retData = await api.user.document.uploadSignedDocument(params);
|
|
1542
|
-
|
|
1543
|
-
onUploadProgress return the progressEvent
|
|
1544
|
-
- lengthComputable: A Boolean that indicates whether or not the total number of bytes is known.
|
|
1545
|
-
- loaded: The number of bytes of the file that have been uploaded.
|
|
1546
|
-
- total: The total number of bytes in the file.
|
|
1423
|
+
const FS = require('fs');
|
|
1547
1424
|
content: FS.readFileSync(Path.join(__dirname, '.mypdf.pdf')),
|
|
1548
1425
|
signedUrl: 'https://signedurl.com/token...',
|
|
1549
1426
|
type: 'application/pdf'
|
|
1550
1427
|
- lengthComputable: A Boolean that indicates whether or not the total number of bytes is known.
|
|
1551
1428
|
- loaded: The number of bytes of the file that have been uploaded.
|
|
1552
1429
|
- total: The total number of bytes in the file.
|
|
1553
1430
|
```
|
|
1554
1431
|
<a name="Documents+checkPrimaryKeys"></a>
|
|
1555
1432
|
|
|
@@ -1551,8 +1428,7 @@ onUploadProgress return the progressEvent
|
|
|
1551
1428
|
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1552
1429
|
**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
|
|
1553
1430
|
**Access**: public
|
|
1554
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1555
|
-
Checks if a document can be added and it does not repeat its primary key
|
|
1431
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1556
1432
|
|
|
1557
1433
|
| Param | Type | Description |
|
|
1558
1434
|
| --- | --- | --- |
|
|
@@ -1567,17 +1443,28 @@ Checks if a document can be added and it does not repeat its primary key
|
|
|
1567
1443
|
|
|
1568
1444
|
**Example**
|
|
1569
1445
|
```js
|
|
1570
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1571
|
-
const api = new API();
|
|
1572
|
-
const docTypeFields = [...]; // the doc type fields array
|
|
1573
|
-
const docTypeFieldsData = {...}; // the data of this fields
|
|
1574
|
-
const params - {
|
|
1575
|
-
docs: [{ id: '5dadd01dc4af3941d42f8c5c', docTypeFields, docTypeFieldsData }],
|
|
1576
|
-
orgId: '5df7f19618430c89a41a19d2',
|
|
1577
|
-
docTypeId: '5df7f19618430c89a41a19d5',
|
|
1578
|
-
};
|
|
1579
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1580
|
-
const retDocs = await api.user.document.checkPrimaryKeys(params, session);
|
|
1446
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1581
1447
|
docs: [{ id: '5dadd01dc4af3941d42f8c5c', docTypeFields, docTypeFieldsData }],
|
|
1582
1448
|
orgId: '5df7f19618430c89a41a19d2',
|
|
1583
1449
|
docTypeId: '5df7f19618430c89a41a19d5',
|
|
1450
|
+
```
|
|
1451
|
+
<a name="Documents+searchDocuments"></a>
|
|
1452
|
+
|
|
1453
|
+
### documents.searchDocuments(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
1454
|
+
Method to search documents for
|
|
1455
|
+
|
|
1456
|
+
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1457
|
+
**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> - took the number of documents taken<code>number</code> - totalCount the total count of all documents
|
|
1458
|
+
**Access**: public
|
|
1459
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1460
|
+
|
|
1461
|
+
| Param | Type | Description |
|
|
1462
|
+
| --- | --- | --- |
|
|
1463
|
+
| params | <code>object</code> | Params to search the documents |
|
|
1464
|
+
| params.query | <code>object</code> | Search documents query |
|
|
1465
|
+
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
1466
|
+
| session | <code>string</code> | Session, token JWT |
|
|
1467
|
+
|
|
1468
|
+
**Example**
|
|
1469
|
+
```js
|
|
1470
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1584
1471
|
query: {p: 20, i: 1, s: 'Mais recentes', as: '', m: 'w', ai: '57e6a3bd6be6b45210833fae'},
|
|
1585
1472
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
1586
1473
|
```
|
|
1587
1474
|
<a name="Users"></a>
|
|
1588
1475
|
|
|
@@ -1645,14 +1532,7 @@ Method to add a notification token
|
|
|
1645
1532
|
|
|
1646
1533
|
**Example**
|
|
1647
1534
|
```js
|
|
1648
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1649
|
-
const api = new API();
|
|
1650
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1651
|
-
const params = {
|
|
1652
|
-
token: 'V6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz2',
|
|
1653
|
-
type: 'FCM_WEB'
|
|
1654
|
-
};
|
|
1655
|
-
const retData = await api.user.notification.addToken(params, session);
|
|
1535
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1656
1536
|
token: 'V6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz2',
|
|
1657
1537
|
type: 'FCM_WEB'
|
|
1658
1538
|
```
|
|
1659
1539
|
<a name="Organization"></a>
|
|
1660
1540
|
|
|
@@ -1689,15 +1569,7 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
1689
1569
|
|
|
1690
1570
|
**Example**
|
|
1691
1571
|
```js
|
|
1692
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1693
|
-
const api = new API();
|
|
1694
|
-
const params = {
|
|
1695
|
-
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
1696
|
-
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
1697
|
-
type: 'image/png',
|
|
1698
|
-
};
|
|
1699
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1700
|
-
await api.admin.organizations.upsertAvatar(params, session);
|
|
1572
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1701
1573
|
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
1702
1574
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
1703
1575
|
type: 'image/png',
|
|
1704
1576
|
```
|
|
1705
1577
|
<a name="Organization+removeAvatar"></a>
|
|
1706
1578
|
|
|
@@ -1715,11 +1587,7 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
1715
1587
|
|
|
1716
1588
|
**Example**
|
|
1717
1589
|
```js
|
|
1718
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1719
|
-
const api = new API();
|
|
1720
|
-
const orgId = '5dadd01dc4af3941d42f8c5c';
|
|
1721
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1722
|
-
await api.admin.organizations.removeAvatar(orgId, session);
|
|
1590
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1723
1591
|
```
|
|
1724
1592
|
<a name="Organization+findById"></a>
|
|
1725
1593
|
|
|
@@ -1737,11 +1605,7 @@ Find organization by id
|
|
|
1737
1605
|
|
|
1738
1606
|
**Example**
|
|
1739
1607
|
```js
|
|
1740
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1741
|
-
const api = new API();
|
|
1742
|
-
const orgId = '80443245000122';
|
|
1743
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1744
|
-
await api.user.organization.findById(idCard, session);
|
|
1608
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1745
1609
|
```
|
|
1746
1610
|
<a name="Organization+idCardExist"></a>
|
|
1747
1611
|
|
|
@@ -1759,11 +1623,7 @@ Check if id card exist
|
|
|
1759
1623
|
|
|
1760
1624
|
**Example**
|
|
1761
1625
|
```js
|
|
1762
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1763
|
-
const api = new API();
|
|
1764
|
-
const idCard = '80443245000122';
|
|
1765
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1766
|
-
await api.user.organization.idCardExist(idCard, session);
|
|
1626
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1767
1627
|
```
|
|
1768
1628
|
<a name="Organization+upsertAvatar"></a>
|
|
1769
1629
|
|
|
@@ -1783,14 +1643,7 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
1783
1643
|
|
|
1784
1644
|
**Example**
|
|
1785
1645
|
```js
|
|
1786
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1787
|
-
const api = new API();
|
|
1788
|
-
const params = {
|
|
1789
|
-
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
1790
|
-
type: 'image/png',
|
|
1791
|
-
};
|
|
1792
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1793
|
-
await api.user.profile.updateAvatar(params, session);
|
|
1646
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1794
1647
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
1795
1648
|
type: 'image/png',
|
|
1796
1649
|
```
|
|
1797
1650
|
<a name="Organization+removeAvatar"></a>
|
|
1798
1651
|
|
|
@@ -1807,10 +1660,7 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
1807
1660
|
|
|
1808
1661
|
**Example**
|
|
1809
1662
|
```js
|
|
1810
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1811
|
-
const api = new API();
|
|
1812
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1813
|
-
await api.user.profile.removeAvatar(session);
|
|
1663
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1814
1664
|
```
|
|
1815
1665
|
<a name="Organization+callFetch"></a>
|
|
1816
1666
|
|
|
@@ -1830,14 +1680,7 @@ Call URL internal, need auth JWT (session)
|
|
|
1830
1680
|
|
|
1831
1681
|
**Example**
|
|
1832
1682
|
```js
|
|
1833
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1834
|
-
const api = new API();
|
|
1835
|
-
|
|
1836
|
-
const params = {
|
|
1837
|
-
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
1838
|
-
method: 'POST'
|
|
1839
|
-
}
|
|
1840
|
-
await api.user.organization.callFetchs(params, session);
|
|
1683
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1841
1684
|
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
1842
1685
|
method: 'POST'
|
|
1843
1686
|
```
|
|
1844
1687
|
<a name="Process"></a>
|
|
1845
1688
|
|
|
@@ -1870,15 +1713,7 @@ Start process
|
|
|
1870
1713
|
|
|
1871
1714
|
**Example**
|
|
1872
1715
|
```js
|
|
1873
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1874
|
-
const api = new API();
|
|
1875
|
-
const params = {
|
|
1876
|
-
processId: '5dadd01dc4af3941d42f8c5c',
|
|
1877
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
1878
|
-
payload: {}
|
|
1879
|
-
}
|
|
1880
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1881
|
-
await api.user.process.start(params, session);
|
|
1716
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1882
1717
|
processId: '5dadd01dc4af3941d42f8c5c',
|
|
1883
1718
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
1884
1719
|
payload: {}
|
|
1885
1720
|
```
|
|
1886
1721
|
<a name="Process+getProcessProperties"></a>
|
|
1887
1722
|
|
|
@@ -1898,14 +1733,7 @@ Get process properties of process
|
|
|
1898
1733
|
|
|
1899
1734
|
**Example**
|
|
1900
1735
|
```js
|
|
1901
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1902
|
-
const api = new API();
|
|
1903
|
-
const params = {
|
|
1904
|
-
processId: '5dadd01dc4af3941d42f8c5c',
|
|
1905
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
1906
|
-
}
|
|
1907
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1908
|
-
await api.user.process.getProcessProperties(params, session);
|
|
1736
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1909
1737
|
processId: '5dadd01dc4af3941d42f8c5c',
|
|
1910
1738
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
1911
1739
|
```
|
|
1912
1740
|
<a name="Process+getOrgProcessSearchInfo"></a>
|
|
1913
1741
|
|
|
@@ -1913,8 +1741,7 @@ await api.user.process.getProcessProperties(params, session);
|
|
|
1913
1741
|
Get the search info of a organization process
|
|
1914
1742
|
|
|
1915
1743
|
**Kind**: instance method of [<code>Process</code>](#Process)
|
|
1916
|
-
**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
|
|
1917
|
-
@
|
|
1744
|
+
**Returns**: <code>Promise</code> - the search info result<code>string</code> - name the name of the organization process<code>object</code> - processIndexFields the list of fields to index<code>object</code> - processParticipantsGroup the permissions in this organization process<code>object</code> - stepsProperties the organization process steps properties<code>string</code> - _id the same organization id
|
|
1918
1745
|
**Access**: public
|
|
1919
1746
|
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1920
1747
|
|
|
@@ -1927,14 +1754,7 @@ Get the search info of a organization process
|
|
|
1927
1754
|
|
|
1928
1755
|
**Example**
|
|
1929
1756
|
```js
|
|
1930
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1931
|
-
const api = new API();
|
|
1932
|
-
const params = {
|
|
1933
|
-
orgProcessId: '5dadd01dc4af3941d42f8c67',
|
|
1934
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
1935
|
-
}
|
|
1936
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1937
|
-
const retSearchInfo = await api.user.process.getOrgProcessSearchInfo(params, session);
|
|
1757
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1938
1758
|
orgProcessId: '5dadd01dc4af3941d42f8c67',
|
|
1939
1759
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
1940
1760
|
```
|
|
1941
1761
|
<a name="Register"></a>
|
|
1942
1762
|
|
|
@@ -1962,12 +1782,7 @@ Class for user registration in a user
|
|
|
1962
1782
|
|
|
1963
1783
|
**Example**
|
|
1964
1784
|
```js
|
|
1965
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1966
|
-
const api = new API();
|
|
1967
|
-
const params = {
|
|
1968
|
-
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...'
|
|
1969
|
-
};
|
|
1970
|
-
const orgname = await api.user.register.getOrgname(params);
|
|
1785
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1971
1786
|
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...'
|
|
1972
1787
|
```
|
|
1973
1788
|
<a name="Register+validateEmail"></a>
|
|
1974
1789
|
|
|
@@ -1987,13 +1802,7 @@ Method to find task by id
|
|
|
1987
1802
|
|
|
1988
1803
|
**Example**
|
|
1989
1804
|
```js
|
|
1990
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1991
|
-
const api = new API();
|
|
1992
|
-
const params = {
|
|
1993
|
-
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
1994
|
-
email: 'myemail@company.com'
|
|
1995
|
-
};
|
|
1996
|
-
const retData = await api.user.register.validateEmail(params);
|
|
1805
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1997
1806
|
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
1998
1807
|
email: 'myemail@company.com'
|
|
1999
1808
|
```
|
|
2000
1809
|
<a name="Register+execute"></a>
|
|
2001
1810
|
|
|
@@ -2027,30 +1836,60 @@ Method to register a user
|
|
|
2027
1836
|
|
|
2028
1837
|
**Example**
|
|
2029
1838
|
```js
|
|
2030
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2031
|
-
const api = new API();
|
|
2032
|
-
const params ={
|
|
2033
|
-
"registerId": 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2034
|
-
"type": 'sign',
|
|
2035
|
-
"login": false,
|
|
2036
|
-
"emailInfo": {
|
|
2037
|
-
"code": "5974",
|
|
2038
|
-
"email": "cbtoto_1@mailinator.com"
|
|
2039
|
-
},
|
|
2040
|
-
"registerData": {
|
|
2041
|
-
"name": "Augusto Totlo",
|
|
2042
|
-
"registerEmail": "cbtoto_1@mailinator.com",
|
|
2043
|
-
"phone": "",
|
|
2044
|
-
"idcard": "",
|
|
2045
|
-
"dob": "1978-01-12T03:00:00.000Z",
|
|
2046
|
-
"registerPassword": "123456",
|
|
2047
|
-
"emailValidationCode": "5974",
|
|
2048
|
-
"phoneValidationCode": "",
|
|
2049
|
-
"language": "en-US",
|
|
2050
|
-
"timezone": "Europe/Dublin"
|
|
2051
|
-
}
|
|
2052
|
-
};
|
|
2053
|
-
const retData = await api.user.register.execute(params);
|
|
1839
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2054
1840
|
"registerId": 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2055
1841
|
"type": 'sign',
|
|
2056
1842
|
"login": false,
|
|
2057
1843
|
"emailInfo": {
|
|
2058
1844
|
"code": "5974",
|
|
2059
1845
|
"email": "cbtoto_1@mailinator.com"
|
|
2060
1846
|
},
|
|
2061
1847
|
"registerData": {
|
|
2062
1848
|
"name": "Augusto Totlo",
|
|
2063
1849
|
"registerEmail": "cbtoto_1@mailinator.com",
|
|
2064
1850
|
"phone": "",
|
|
2065
1851
|
"idcard": "",
|
|
2066
1852
|
"dob": "1978-01-12T03:00:00.000Z",
|
|
2067
1853
|
"registerPassword": "123456",
|
|
2068
1854
|
"emailValidationCode": "5974",
|
|
2069
1855
|
"phoneValidationCode": "",
|
|
2070
1856
|
"language": "en-US",
|
|
2071
1857
|
"timezone": "Europe/Dublin"
|
|
2072
1858
|
}
|
|
2073
1859
|
};
|
|
1860
|
+
```
|
|
1861
|
+
<a name="TaskAvailable"></a>
|
|
1862
|
+
|
|
1863
|
+
## TaskAvailable
|
|
1864
|
+
Class for available tasks, permission user
|
|
1865
|
+
|
|
1866
|
+
**Kind**: global class
|
|
1867
|
+
|
|
1868
|
+
* [TaskAvailable](#TaskAvailable)
|
|
1869
|
+
* [.find(params, session)](#TaskAvailable+find) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
1870
|
+
* [.claim(params, session)](#TaskAvailable+claim) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
1871
|
+
|
|
1872
|
+
<a name="TaskAvailable+find"></a>
|
|
1873
|
+
|
|
1874
|
+
### taskAvailable.find(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
1875
|
+
Method to find available tasks for a user
|
|
1876
|
+
|
|
1877
|
+
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
1878
|
+
**Returns**: <code>promise</code> - returned data from the search<code>number</code> - count the count of items searched<code>array.<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
|
|
1879
|
+
**Access**: public
|
|
1880
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1881
|
+
|
|
1882
|
+
| Param | Type | Description |
|
|
1883
|
+
| --- | --- | --- |
|
|
1884
|
+
| params | <code>object</code> | Params to get task |
|
|
1885
|
+
| params.query | <code>object</code> | Search process query |
|
|
1886
|
+
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
1887
|
+
| session | <code>string</code> | Session, token JWT |
|
|
1888
|
+
|
|
1889
|
+
**Example**
|
|
1890
|
+
```js
|
|
1891
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2074
1892
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2075
1893
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
1894
|
+
```
|
|
1895
|
+
<a name="TaskAvailable+claim"></a>
|
|
1896
|
+
|
|
1897
|
+
### taskAvailable.claim(params, session) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
1898
|
+
Method for a user to claim an available task
|
|
1899
|
+
|
|
1900
|
+
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
1901
|
+
**Returns**: <code>promise</code> - returned data from the method call<code>boolean</code> - success true|false if the method was successful
|
|
1902
|
+
**Access**: public
|
|
1903
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1904
|
+
|
|
1905
|
+
| Param | Type | Description |
|
|
1906
|
+
| --- | --- | --- |
|
|
1907
|
+
| params | <code>object</code> | Params to get task |
|
|
1908
|
+
| params.taskId | <code>object</code> | the task id to claim |
|
|
1909
|
+
| params.orgname | <code>object</code> | Organization slug (short name of the orgnization) |
|
|
1910
|
+
| session | <code>string</code> | Session, token JWT |
|
|
1911
|
+
|
|
1912
|
+
**Example**
|
|
1913
|
+
```js
|
|
1914
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2076
1915
|
taskId: '55e4a3bd6be6b45210833f67',
|
|
2077
1916
|
orgname: 'acme',
|
|
2078
1917
|
```
|
|
2079
1918
|
<a name="Task"></a>
|
|
2080
1919
|
|
|
@@ -2083,15 +1922,7 @@ Method to find task by id
|
|
|
2083
1922
|
|
|
2084
1923
|
**Example**
|
|
2085
1924
|
```js
|
|
2086
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2087
|
-
const api = new API();
|
|
2088
|
-
const params = {
|
|
2089
|
-
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2090
|
-
taskId: '5df7f19618430c89a41a19d2',
|
|
2091
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2092
|
-
};
|
|
2093
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2094
|
-
await api.user.task.findById(params, session);
|
|
1925
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2095
1926
|
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2096
1927
|
taskId: '5df7f19618430c89a41a19d2',
|
|
2097
1928
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2098
1929
|
```
|
|
2099
1930
|
<a name="Task+findByIdAndUpdate"></a>
|
|
2100
1931
|
|
|
@@ -2117,17 +1948,7 @@ Find task by id and update
|
|
|
2117
1948
|
|
|
2118
1949
|
**Example**
|
|
2119
1950
|
```js
|
|
2120
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2121
|
-
const api = new API();
|
|
2122
|
-
const params = {
|
|
2123
|
-
userId: '5739d4c6ccb0ebc61f2a9557',
|
|
2124
|
-
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2125
|
-
taskId: '5df7f19618430c89a41a19d2',
|
|
2126
|
-
action: 1,
|
|
2127
|
-
formData: {name: 'CloudBrasil'},
|
|
2128
|
-
};
|
|
2129
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2130
|
-
await api.user.task.findByIdAndUpdate(params, session);
|
|
1951
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2131
1952
|
userId: '5739d4c6ccb0ebc61f2a9557',
|
|
2132
1953
|
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2133
1954
|
taskId: '5df7f19618430c89a41a19d2',
|
|
2134
1955
|
action: 1,
|
|
2135
1956
|
formData: {name: 'CloudBrasil'},
|
|
2136
1957
|
```
|
|
2137
1958
|
<a name="Task+executeActionFinalize"></a>
|
|
2138
1959
|
|
|
@@ -2149,83 +1970,7 @@ Find task by id and update
|
|
|
2149
1970
|
|
|
2150
1971
|
**Example**
|
|
2151
1972
|
```js
|
|
2152
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2153
|
-
const api = new API();
|
|
2154
|
-
const params = {
|
|
2155
|
-
taskId: '5df7f19618430c89a41a19d2',
|
|
2156
|
-
actionGuid: 'b3823a2ae52c7a05bfb9590fe427038d'
|
|
2157
|
-
orgId: '5df7f19618430c89a41a1bc3',
|
|
2158
|
-
body: {}',
|
|
2159
|
-
};
|
|
2160
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2161
|
-
await api.user.task.executeActionFinalize(params, session);
|
|
2162
|
-
```
|
|
2163
|
-
<a name="TaskAvailable"></a>
|
|
2164
|
-
|
|
2165
|
-
## TaskAvailable
|
|
2166
|
-
Class for available tasks, permission user
|
|
2167
|
-
|
|
2168
|
-
**Kind**: global class
|
|
2169
|
-
|
|
2170
|
-
* [TaskAvailable](#TaskAvailable)
|
|
2171
|
-
* [.find(params, session)](#TaskAvailable+find) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
2172
|
-
* [.claim(params, session)](#TaskAvailable+claim) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2173
|
-
|
|
2174
|
-
<a name="TaskAvailable+find"></a>
|
|
2175
|
-
|
|
2176
|
-
### taskAvailable.find(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
2177
|
-
Method to find available tasks for a user
|
|
2178
|
-
|
|
2179
|
-
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
2180
|
-
**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
|
|
2181
|
-
**Access**: public
|
|
2182
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2183
|
-
|
|
2184
|
-
| Param | Type | Description |
|
|
2185
|
-
| --- | --- | --- |
|
|
2186
|
-
| params | <code>object</code> | Params to get task |
|
|
2187
|
-
| params.query | <code>object</code> | Search process query |
|
|
2188
|
-
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
2189
|
-
| session | <code>string</code> | Session, token JWT |
|
|
2190
|
-
|
|
2191
|
-
**Example**
|
|
2192
|
-
```js
|
|
2193
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2194
|
-
const api = new API();
|
|
2195
|
-
const params = {
|
|
2196
|
-
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2197
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2198
|
-
};
|
|
2199
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2200
|
-
const retSearch = await api.user.task.available.find(params, session);
|
|
2201
|
-
```
|
|
2202
|
-
<a name="TaskAvailable+claim"></a>
|
|
2203
|
-
|
|
2204
|
-
### taskAvailable.claim(params, session) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2205
|
-
Method for a user to claim an available task
|
|
2206
|
-
|
|
2207
|
-
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
2208
|
-
**Returns**: <code>promise</code> - returned data from the method call<code>boolean</code> - success true|false if the method was successful
|
|
2209
|
-
**Access**: public
|
|
2210
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2211
|
-
|
|
2212
|
-
| Param | Type | Description |
|
|
2213
|
-
| --- | --- | --- |
|
|
2214
|
-
| params | <code>object</code> | Params to get task |
|
|
2215
|
-
| params.taskId | <code>object</code> | the task id to claim |
|
|
2216
|
-
| params.orgname | <code>object</code> | Organization slug (short name of the orgnization) |
|
|
2217
|
-
| session | <code>string</code> | Session, token JWT |
|
|
2218
|
-
|
|
2219
|
-
**Example**
|
|
2220
|
-
```js
|
|
2221
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2222
|
-
const api = new API();
|
|
2223
|
-
const params = {
|
|
2224
|
-
taskId: '55e4a3bd6be6b45210833f67',
|
|
2225
|
-
orgname: 'acme',
|
|
2226
|
-
};
|
|
2227
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2228
|
-
const success = await api.user.task.available.claim(params, session);
|
|
1973
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2229
1974
|
taskId: '5df7f19618430c89a41a19d2',
|
|
2230
1975
|
actionGuid: 'b3823a2ae52c7a05bfb9590fe427038d'
|
|
2231
1976
|
orgId: '5df7f19618430c89a41a1bc3',
|
|
2232
1977
|
body: {}',
|
|
2233
1978
|
```
|
|
2234
1979
|
<a name="User"></a>
|
|
2235
1980
|
|
|
@@ -2260,14 +2005,7 @@ Update avatar of user by session of user not allow session user SU
|
|
|
2260
2005
|
|
|
2261
2006
|
**Example**
|
|
2262
2007
|
```js
|
|
2263
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2264
|
-
const api = new API();
|
|
2265
|
-
const params = {
|
|
2266
|
-
avatar: '55e4a3bd6be6b45210833fae',
|
|
2267
|
-
type: '123456',
|
|
2268
|
-
};
|
|
2269
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2270
|
-
await api.user.profile.updateAvatar(params, session);
|
|
2008
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2271
2009
|
avatar: '55e4a3bd6be6b45210833fae',
|
|
2272
2010
|
type: '123456',
|
|
2273
2011
|
```
|
|
2274
2012
|
<a name="User+removeAvatar"></a>
|
|
2275
2013
|
|
|
@@ -2284,10 +2022,7 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
2284
2022
|
|
|
2285
2023
|
**Example**
|
|
2286
2024
|
```js
|
|
2287
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2288
|
-
const api = new API();
|
|
2289
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2290
|
-
await api.user.profile.removeAvatar(session);
|
|
2025
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2291
2026
|
```
|
|
2292
2027
|
<a name="User+removeSignature"></a>
|
|
2293
2028
|
|
|
@@ -2304,10 +2039,7 @@ Remove the signature of user by session
|
|
|
2304
2039
|
|
|
2305
2040
|
**Example**
|
|
2306
2041
|
```js
|
|
2307
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2308
|
-
const api = new API();
|
|
2309
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2310
|
-
await api.user.profile.removeSignature(session);
|
|
2042
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2311
2043
|
```
|
|
2312
2044
|
<a name="User+saveSignature"></a>
|
|
2313
2045
|
|
|
@@ -2327,23 +2059,7 @@ Sava a new signature of user by session
|
|
|
2327
2059
|
|
|
2328
2060
|
**Example**
|
|
2329
2061
|
```js
|
|
2330
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2331
|
-
const api = new API();
|
|
2332
|
-
const data = {
|
|
2333
|
-
type: 'CURSIVE',
|
|
2334
|
-
file: 'allura:Mary John Heart'
|
|
2335
|
-
};
|
|
2336
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2337
|
-
await api.user.profile.saveSignature(data, session);
|
|
2338
|
-
|
|
2339
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2340
|
-
const api = new API();
|
|
2341
|
-
const data = {
|
|
2342
|
-
type: 'HANDWRITE',
|
|
2343
|
-
file: 'iVBORw0KGgoAAAANSUhEUgAAAj...'
|
|
2344
|
-
};
|
|
2345
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2346
|
-
await api.user.profile.saveSignature(session);
|
|
2062
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2347
2063
|
type: 'CURSIVE',
|
|
2348
2064
|
file: 'allura:Mary John Heart'
|
|
2349
2065
|
type: 'HANDWRITE',
|
|
2350
2066
|
file: 'iVBORw0KGgoAAAANSUhEUgAAAj...'
|
|
2351
2067
|
```
|
|
2352
2068
|
<a name="User+findByIdAndUpdate"></a>
|
|
2353
2069
|
|
|
@@ -2377,13 +2093,7 @@ Update a user profile by id
|
|
|
2377
2093
|
|
|
2378
2094
|
**Example**
|
|
2379
2095
|
```js
|
|
2380
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2381
|
-
const api = new API();
|
|
2382
|
-
const params = {
|
|
2383
|
-
name: 'New Name'
|
|
2384
|
-
};
|
|
2385
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2386
|
-
await api.user.profile.findByIdAndUpdate(params, session);
|
|
2096
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2387
2097
|
name: 'New Name'
|
|
2388
2098
|
```
|
|
2389
2099
|
<a name="User+changeOrganization"></a>
|
|
2390
2100
|
|
|
@@ -2401,9 +2111,5 @@ Change a user's organization
|
|
|
2401
2111
|
|
|
2402
2112
|
**Example**
|
|
2403
2113
|
```js
|
|
2404
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2405
|
-
const api = new API();
|
|
2406
|
-
const id = '616eccaaa9360a05293b10fe';
|
|
2407
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2408
|
-
await api.user.changeOrganization.updateAvatar(id, session);
|
|
2114
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2409
2115
|
```
|