@docbrasil/api-systemmanager 1.0.95 → 1.0.97
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 +23 -23
- package/api/login.js +267 -267
- package/api/session.js +85 -85
- package/api/user/datasource.js +144 -144
- package/api/user/document.js +730 -730
- 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 +202 -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 -4875
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +2453 -2453
- 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 -68
- 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/task_available.js +75 -75
- package/tests/user/user.js +88 -88
package/doc/api.md
CHANGED
|
@@ -1,2453 +1,2453 @@
|
|
|
1
|
-
## Classes
|
|
2
|
-
|
|
3
|
-
<dl>
|
|
4
|
-
<dt><a href="#AdminDocuments">AdminDocuments</a></dt>
|
|
5
|
-
<dd><p>Admin Class for documents, permission admin</p>
|
|
6
|
-
</dd>
|
|
7
|
-
<dt><a href="#AdminForm">AdminForm</a></dt>
|
|
8
|
-
<dd><p>Admin Class for forms, permission admin</p>
|
|
9
|
-
</dd>
|
|
10
|
-
<dt><a href="#Admin">Admin</a></dt>
|
|
11
|
-
<dd><p>API request, admin permission level</p>
|
|
12
|
-
</dd>
|
|
13
|
-
<dt><a href="#AdminLists">AdminLists</a></dt>
|
|
14
|
-
<dd><p>Admin Class for lists, permission admin</p>
|
|
15
|
-
</dd>
|
|
16
|
-
<dt><a href="#AdminMessage">AdminMessage</a></dt>
|
|
17
|
-
<dd><p>Admin Class for user, permission admin</p>
|
|
18
|
-
</dd>
|
|
19
|
-
<dt><a href="#AdminNotification">AdminNotification</a></dt>
|
|
20
|
-
<dd><p>Admin Class for notification, permission admin</p>
|
|
21
|
-
</dd>
|
|
22
|
-
<dt><a href="#Organization">Organization</a></dt>
|
|
23
|
-
<dd><p>Class for organizations, permission user</p>
|
|
24
|
-
</dd>
|
|
25
|
-
<dt><a href="#AdminPlugin">AdminPlugin</a></dt>
|
|
26
|
-
<dd><p>Admin Class for plugin, permission admin</p>
|
|
27
|
-
</dd>
|
|
28
|
-
<dt><a href="#AdminPolicy">AdminPolicy</a></dt>
|
|
29
|
-
<dd><p>Admin Class for policy, permission admin</p>
|
|
30
|
-
</dd>
|
|
31
|
-
<dt><a href="#AdminProcesses">AdminProcesses</a></dt>
|
|
32
|
-
<dd><p>Admin Class for processes, permission admin</p>
|
|
33
|
-
</dd>
|
|
34
|
-
<dt><a href="#AdminTask">AdminTask</a></dt>
|
|
35
|
-
<dd><p>Admin Class for task, permission admin</p>
|
|
36
|
-
</dd>
|
|
37
|
-
<dt><a href="#AdminUser">AdminUser</a></dt>
|
|
38
|
-
<dd><p>Admin Class for user, permission admin</p>
|
|
39
|
-
</dd>
|
|
40
|
-
<dt><a href="#GeoLocation">GeoLocation</a></dt>
|
|
41
|
-
<dd><p>General Class for user, permission organization</p>
|
|
42
|
-
</dd>
|
|
43
|
-
<dt><a href="#Users">Users</a></dt>
|
|
44
|
-
<dd><p>API request, user permission level</p>
|
|
45
|
-
</dd>
|
|
46
|
-
<dt><a href="#Datasource">Datasource</a></dt>
|
|
47
|
-
<dd><p>Class for user datasource access, to be used with when creating new documents</p>
|
|
48
|
-
</dd>
|
|
49
|
-
<dt><a href="#Documents">Documents</a></dt>
|
|
50
|
-
<dd><p>Class for documents, permission user</p>
|
|
51
|
-
</dd>
|
|
52
|
-
<dt><a href="#Users">Users</a></dt>
|
|
53
|
-
<dd><p>API request, user permission level</p>
|
|
54
|
-
</dd>
|
|
55
|
-
<dt><a href="#Notification">Notification</a></dt>
|
|
56
|
-
<dd><p>Class for user registration in a user</p>
|
|
57
|
-
</dd>
|
|
58
|
-
<dt><a href="#Organization">Organization</a></dt>
|
|
59
|
-
<dd><p>Class for organizations, permission user</p>
|
|
60
|
-
</dd>
|
|
61
|
-
<dt><a href="#Process">Process</a></dt>
|
|
62
|
-
<dd><p>Class for process, permission user</p>
|
|
63
|
-
</dd>
|
|
64
|
-
<dt><a href="#Register">Register</a></dt>
|
|
65
|
-
<dd><p>Class for user registration in a user</p>
|
|
66
|
-
</dd>
|
|
67
|
-
<dt><a href="#Task">Task</a></dt>
|
|
68
|
-
<dd><p>Class for task, permission user</p>
|
|
69
|
-
</dd>
|
|
70
|
-
<dt><a href="#TaskAvailable">TaskAvailable</a></dt>
|
|
71
|
-
<dd><p>Class for available tasks, permission user</p>
|
|
72
|
-
</dd>
|
|
73
|
-
<dt><a href="#User">User</a></dt>
|
|
74
|
-
<dd><p>Class for user, permission user</p>
|
|
75
|
-
</dd>
|
|
76
|
-
</dl>
|
|
77
|
-
|
|
78
|
-
<a name="AdminDocuments"></a>
|
|
79
|
-
|
|
80
|
-
## AdminDocuments
|
|
81
|
-
Admin Class for documents, permission admin
|
|
82
|
-
|
|
83
|
-
**Kind**: global class
|
|
84
|
-
|
|
85
|
-
* [AdminDocuments](#AdminDocuments)
|
|
86
|
-
* [.advancedSearch(params, session)](#AdminDocuments+advancedSearch) ⇒ <code>Promise</code>
|
|
87
|
-
* [.findById(params, session)](#AdminDocuments+findById) ⇒ <code>Promise</code>
|
|
88
|
-
* [.signedUrl(params, apiKey)](#AdminDocuments+signedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
89
|
-
* [.updateContent(params, apiKey)](#AdminDocuments+updateContent) ⇒ <code>Promise.<object></code>
|
|
90
|
-
* [.updateAI(params, apiKey)](#AdminDocuments+updateAI) ⇒ <code>Promise.<object></code>
|
|
91
|
-
* [.getContent(params, apiKey)](#AdminDocuments+getContent) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>number</code>
|
|
92
|
-
|
|
93
|
-
<a name="AdminDocuments+advancedSearch"></a>
|
|
94
|
-
|
|
95
|
-
### adminDocuments.advancedSearch(params, session) ⇒ <code>Promise</code>
|
|
96
|
-
Advanced search of document in elastic search ussing system manager
|
|
97
|
-
|
|
98
|
-
**Kind**: instance method of [<code>AdminDocuments</code>](#AdminDocuments)
|
|
99
|
-
**Access**: public
|
|
100
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
101
|
-
|
|
102
|
-
| Param | Type | Description |
|
|
103
|
-
| --- | --- | --- |
|
|
104
|
-
| params | <code>object</code> | Params to search document |
|
|
105
|
-
| params.docId | <code>string</code> | Document id (_id database) |
|
|
106
|
-
| params.query | <code>object</code> | Query to search in elastic search |
|
|
107
|
-
| session | <code>string</code> | Session, token JWT |
|
|
108
|
-
|
|
109
|
-
**Example**
|
|
110
|
-
```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);
|
|
138
|
-
```
|
|
139
|
-
<a name="AdminDocuments+findById"></a>
|
|
140
|
-
|
|
141
|
-
### adminDocuments.findById(params, session) ⇒ <code>Promise</code>
|
|
142
|
-
Get document by id
|
|
143
|
-
|
|
144
|
-
**Kind**: instance method of [<code>AdminDocuments</code>](#AdminDocuments)
|
|
145
|
-
**Access**: public
|
|
146
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
147
|
-
|
|
148
|
-
| Param | Type | Description |
|
|
149
|
-
| --- | --- | --- |
|
|
150
|
-
| params | <code>object</code> | Params to get document by id |
|
|
151
|
-
| params.docId | <code>string</code> | Document id (_id database) |
|
|
152
|
-
| params.orgId | <code>string</code> | Organization id (_id database) |
|
|
153
|
-
| session | <code>string</code> | Session, token JWT |
|
|
154
|
-
|
|
155
|
-
**Example**
|
|
156
|
-
```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);
|
|
165
|
-
```
|
|
166
|
-
<a name="AdminDocuments+signedUrl"></a>
|
|
167
|
-
|
|
168
|
-
### adminDocuments.signedUrl(params, apiKey) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
169
|
-
Request signed url url to put or get
|
|
170
|
-
|
|
171
|
-
**Kind**: instance method of [<code>AdminDocuments</code>](#AdminDocuments)
|
|
172
|
-
**Returns**: <code>Promise.<object></code> - doc Returned document data with the signed url<code>string</code> - doc.docId Document id<code>string</code> - doc.name The name of the document, which is the fileName<code>string</code> - doc.areaId docAreaId of the document<code>string</code> - doc.type the document mimi type<code>string</code> - doc.signedUrl the signed URL to upload
|
|
173
|
-
**Access**: public
|
|
174
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
175
|
-
|
|
176
|
-
| Param | Type | Description |
|
|
177
|
-
| --- | --- | --- |
|
|
178
|
-
| params | <code>object</code> | Params to request signed url |
|
|
179
|
-
| params.methodType | <code>string</code> | Method type HTTP get or put |
|
|
180
|
-
| params.docId | <code>string</code> | The unique id of the document |
|
|
181
|
-
| apiKey | <code>string</code> | Api Key as permission to use this functionality |
|
|
182
|
-
|
|
183
|
-
**Example**
|
|
184
|
-
```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);
|
|
193
|
-
```
|
|
194
|
-
**Example**
|
|
195
|
-
```js
|
|
196
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
197
|
-
const api = new API();
|
|
198
|
-
const params - {
|
|
199
|
-
methodType: 'get',
|
|
200
|
-
docId: '5dadd01dc4af3941d42f8c5c'
|
|
201
|
-
};
|
|
202
|
-
const apiKey: '...';
|
|
203
|
-
const { signedUrl, imageType } = await api.admin.document.signedUrl(params, apiKey);
|
|
204
|
-
```
|
|
205
|
-
<a name="AdminDocuments+updateContent"></a>
|
|
206
|
-
|
|
207
|
-
### adminDocuments.updateContent(params, apiKey) ⇒ <code>Promise.<object></code>
|
|
208
|
-
Update a document content
|
|
209
|
-
|
|
210
|
-
**Kind**: instance method of [<code>AdminDocuments</code>](#AdminDocuments)
|
|
211
|
-
**Returns**: <code>Promise.<object></code> - doc Returned document data with the signed url
|
|
212
|
-
**Access**: public
|
|
213
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
214
|
-
|
|
215
|
-
| Param | Type | Description |
|
|
216
|
-
| --- | --- | --- |
|
|
217
|
-
| params | <code>object</code> | Params to request signed url |
|
|
218
|
-
| params.content | <code>string</code> | The content text |
|
|
219
|
-
| params.docId | <code>string</code> | The unique id of the document |
|
|
220
|
-
| apiKey | <code>string</code> | Api Key as permission to use this functionality |
|
|
221
|
-
|
|
222
|
-
**Example**
|
|
223
|
-
```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);
|
|
232
|
-
```
|
|
233
|
-
<a name="AdminDocuments+updateAI"></a>
|
|
234
|
-
|
|
235
|
-
### adminDocuments.updateAI(params, apiKey) ⇒ <code>Promise.<object></code>
|
|
236
|
-
Update a document content
|
|
237
|
-
|
|
238
|
-
**Kind**: instance method of [<code>AdminDocuments</code>](#AdminDocuments)
|
|
239
|
-
**Returns**: <code>Promise.<object></code> - doc Returned document data with the signed url
|
|
240
|
-
**Access**: public
|
|
241
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
242
|
-
|
|
243
|
-
| Param | Type | Description |
|
|
244
|
-
| --- | --- | --- |
|
|
245
|
-
| params | <code>object</code> | Params to request signed url |
|
|
246
|
-
| params.content | <code>string</code> | The content text |
|
|
247
|
-
| params.docId | <code>string</code> | The unique id of the document |
|
|
248
|
-
| params.searchablePDFURL | <code>string</code> | The searchable PDF Url |
|
|
249
|
-
| params.overlay | <code>object</code> | The overlay information |
|
|
250
|
-
| params.entities | <code>array</code> | The list of entities extracted from the text |
|
|
251
|
-
| params.language | <code>object</code> | The language detected |
|
|
252
|
-
| params.language.name | <code>string</code> | The language name detected |
|
|
253
|
-
| params.language.confidence | <code>string</code> | The confidence that it is the language |
|
|
254
|
-
| apiKey | <code>string</code> | Api Key as permission to use this functionality |
|
|
255
|
-
|
|
256
|
-
**Example**
|
|
257
|
-
```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);
|
|
266
|
-
```
|
|
267
|
-
<a name="AdminDocuments+getContent"></a>
|
|
268
|
-
|
|
269
|
-
### adminDocuments.getContent(params, apiKey) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>number</code>
|
|
270
|
-
Get the content of a document
|
|
271
|
-
|
|
272
|
-
**Kind**: instance method of [<code>AdminDocuments</code>](#AdminDocuments)
|
|
273
|
-
**Returns**: <code>Promise.<object></code> - data the document content<code>string</code> - data._id the _id of the document<code>string</code> - data.content all the pages or if asked by page, just one page, the one requested<code>string</code> - data.content.TextOverlay the overlay text if requested<code>string</code> - data.content.ParsedText the page text content<code>number</code> - data.total the total number of pages
|
|
274
|
-
**Access**: public
|
|
275
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
276
|
-
|
|
277
|
-
| Param | Type | Description |
|
|
278
|
-
| --- | --- | --- |
|
|
279
|
-
| params | <code>object</code> | Params to request signed url |
|
|
280
|
-
| params.docId | <code>string</code> | The unique id of the document |
|
|
281
|
-
| params.page | <code>string</code> | The page, from 0, or 'all' if all pages (the full content) |
|
|
282
|
-
| apiKey | <code>string</code> | Api Key as permission to use this functionality |
|
|
283
|
-
|
|
284
|
-
**Example**
|
|
285
|
-
```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);
|
|
294
|
-
```
|
|
295
|
-
<a name="AdminForm"></a>
|
|
296
|
-
|
|
297
|
-
## AdminForm
|
|
298
|
-
Admin Class for forms, permission admin
|
|
299
|
-
|
|
300
|
-
**Kind**: global class
|
|
301
|
-
|
|
302
|
-
* [AdminForm](#AdminForm)
|
|
303
|
-
* [.findById(params, session)](#AdminForm+findById) ⇒ <code>Promise</code>
|
|
304
|
-
* [.getFormList(params, session)](#AdminForm+getFormList) ⇒ <code>Promise</code>
|
|
305
|
-
|
|
306
|
-
<a name="AdminForm+findById"></a>
|
|
307
|
-
|
|
308
|
-
### adminForm.findById(params, session) ⇒ <code>Promise</code>
|
|
309
|
-
Get advance form by ID
|
|
310
|
-
|
|
311
|
-
**Kind**: instance method of [<code>AdminForm</code>](#AdminForm)
|
|
312
|
-
**Access**: public
|
|
313
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
314
|
-
|
|
315
|
-
| Param | Type | Description |
|
|
316
|
-
| --- | --- | --- |
|
|
317
|
-
| params | <code>object</code> | Params to find form by id |
|
|
318
|
-
| params.id | <code>string</code> | Formulary Id (_id database) |
|
|
319
|
-
| params.orgId | <code>string</code> | Organization Id (_id database) |
|
|
320
|
-
| session | <code>string</code> | Session, token JWT |
|
|
321
|
-
|
|
322
|
-
**Example**
|
|
323
|
-
```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);
|
|
332
|
-
```
|
|
333
|
-
<a name="AdminForm+getFormList"></a>
|
|
334
|
-
|
|
335
|
-
### adminForm.getFormList(params, session) ⇒ <code>Promise</code>
|
|
336
|
-
Request signed url url to put or get
|
|
337
|
-
|
|
338
|
-
**Kind**: instance method of [<code>AdminForm</code>](#AdminForm)
|
|
339
|
-
**Access**: public
|
|
340
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
341
|
-
|
|
342
|
-
| Param | Type | Default | Description |
|
|
343
|
-
| --- | --- | --- | --- |
|
|
344
|
-
| params | <code>object</code> | | Params to get form list |
|
|
345
|
-
| params.orgId | <code>string</code> | | Organization id (_id database) |
|
|
346
|
-
| params.page | <code>number</code> | <code>1</code> | Page of pagination |
|
|
347
|
-
| params.perPage | <code>number</code> | <code>200</code> | Items per page |
|
|
348
|
-
| params.type | <code>object</code> | <code>2</code> | Form type (1 to Business or 2 to Advanced) |
|
|
349
|
-
| params.project | <code>object</code> | <code>{_id:</code> | 1, name: 1} - Fields to project |
|
|
350
|
-
| params.sort | <code>object</code> | <code>{name:</code> | 1} - Sort fields |
|
|
351
|
-
| session | <code>string</code> | | Session, token JWT |
|
|
352
|
-
|
|
353
|
-
**Example**
|
|
354
|
-
```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);
|
|
362
|
-
```
|
|
363
|
-
<a name="Admin"></a>
|
|
364
|
-
|
|
365
|
-
## Admin
|
|
366
|
-
API request, admin permission level
|
|
367
|
-
|
|
368
|
-
**Kind**: global class
|
|
369
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
370
|
-
<a name="new_Admin_new"></a>
|
|
371
|
-
|
|
372
|
-
### new Admin(options)
|
|
373
|
-
|
|
374
|
-
| Param | Type | Description |
|
|
375
|
-
| --- | --- | --- |
|
|
376
|
-
| options | <code>object</code> | Params of the constructor |
|
|
377
|
-
| options.parent | <code>object</code> | This of the pararent |
|
|
378
|
-
|
|
379
|
-
<a name="AdminLists"></a>
|
|
380
|
-
|
|
381
|
-
## AdminLists
|
|
382
|
-
Admin Class for lists, permission admin
|
|
383
|
-
|
|
384
|
-
**Kind**: global class
|
|
385
|
-
|
|
386
|
-
* [AdminLists](#AdminLists)
|
|
387
|
-
* [.findById(params, session)](#AdminLists+findById) ⇒ <code>Promise</code>
|
|
388
|
-
* [.find(params, session)](#AdminLists+find) ⇒ <code>Promise</code>
|
|
389
|
-
|
|
390
|
-
<a name="AdminLists+findById"></a>
|
|
391
|
-
|
|
392
|
-
### adminLists.findById(params, session) ⇒ <code>Promise</code>
|
|
393
|
-
Get list by ID
|
|
394
|
-
|
|
395
|
-
**Kind**: instance method of [<code>AdminLists</code>](#AdminLists)
|
|
396
|
-
**Access**: public
|
|
397
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
398
|
-
|
|
399
|
-
| Param | Type | Description |
|
|
400
|
-
| --- | --- | --- |
|
|
401
|
-
| params | <code>object</code> | Params to find list by id |
|
|
402
|
-
| params.id | <code>string</code> | List Id (_id database) |
|
|
403
|
-
| params.orgId | <code>string</code> | Organization Id (_id database) |
|
|
404
|
-
| session | <code>string</code> | Session, token JWT |
|
|
405
|
-
|
|
406
|
-
**Example**
|
|
407
|
-
```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);
|
|
416
|
-
```
|
|
417
|
-
<a name="AdminLists+find"></a>
|
|
418
|
-
|
|
419
|
-
### adminLists.find(params, session) ⇒ <code>Promise</code>
|
|
420
|
-
Get all lists
|
|
421
|
-
|
|
422
|
-
**Kind**: instance method of [<code>AdminLists</code>](#AdminLists)
|
|
423
|
-
**Access**: public
|
|
424
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
425
|
-
|
|
426
|
-
| Param | Type | Default | Description |
|
|
427
|
-
| --- | --- | --- | --- |
|
|
428
|
-
| params | <code>object</code> | <code>{}</code> | Params to pagination and orgId |
|
|
429
|
-
| [params.page] | <code>number</code> | <code>0</code> | Current page to pagination |
|
|
430
|
-
| [params.perPage] | <code>number</code> | <code>200</code> | Qnt itens per page |
|
|
431
|
-
| params.orgId | <code>string</code> | | Organization Id (_id database) |
|
|
432
|
-
| session | <code>string</code> | | Session, token JWT |
|
|
433
|
-
|
|
434
|
-
**Example**
|
|
435
|
-
```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);
|
|
443
|
-
```
|
|
444
|
-
<a name="AdminMessage"></a>
|
|
445
|
-
|
|
446
|
-
## AdminMessage
|
|
447
|
-
Admin Class for user, permission admin
|
|
448
|
-
|
|
449
|
-
**Kind**: global class
|
|
450
|
-
|
|
451
|
-
* [AdminMessage](#AdminMessage)
|
|
452
|
-
* [._paginationOfTheSMS(params)](#AdminMessage+_paginationOfTheSMS)
|
|
453
|
-
* [._validItemToSendEmail(params)](#AdminMessage+_validItemToSendEmail)
|
|
454
|
-
* [.sendSMS(params)](#AdminMessage+sendSMS) ⇒ <code>Promise.<{}></code>
|
|
455
|
-
* [.sendEmail(params, session)](#AdminMessage+sendEmail) ⇒ <code>Promise.<{success: boolean, sent: Array.<object>}></code>
|
|
456
|
-
|
|
457
|
-
<a name="AdminMessage+_paginationOfTheSMS"></a>
|
|
458
|
-
|
|
459
|
-
### adminMessage.\_paginationOfTheSMS(params)
|
|
460
|
-
Pagination SMS texts
|
|
461
|
-
|
|
462
|
-
**Kind**: instance method of [<code>AdminMessage</code>](#AdminMessage)
|
|
463
|
-
|
|
464
|
-
| Param | Type | Default | Description |
|
|
465
|
-
| --- | --- | --- | --- |
|
|
466
|
-
| params | <code>object</code> | | Params to pagintion SMS |
|
|
467
|
-
| params.message | <code>string</code> | | Message to pagination |
|
|
468
|
-
| params.limitSize | <code>number</code> | <code>130</code> | Limit of the start pagination |
|
|
469
|
-
| params.continueText | <code>number</code> | <code>continua...</code> | Text to continue other SMS |
|
|
470
|
-
|
|
471
|
-
<a name="AdminMessage+_validItemToSendEmail"></a>
|
|
472
|
-
|
|
473
|
-
### adminMessage.\_validItemToSendEmail(params)
|
|
474
|
-
Validation struct to send email
|
|
475
|
-
|
|
476
|
-
**Kind**: instance method of [<code>AdminMessage</code>](#AdminMessage)
|
|
477
|
-
|
|
478
|
-
| Param | Type | Description |
|
|
479
|
-
| --- | --- | --- |
|
|
480
|
-
| params | <code>object</code> | Params to send email |
|
|
481
|
-
| params.subject | <code>string</code> | Subject of the email |
|
|
482
|
-
| params.message | <code>string</code> | Body of the email |
|
|
483
|
-
| params.to | <code>string</code> | Destination email |
|
|
484
|
-
| params.from | <code>string</code> | Source email |
|
|
485
|
-
|
|
486
|
-
<a name="AdminMessage+sendSMS"></a>
|
|
487
|
-
|
|
488
|
-
### adminMessage.sendSMS(params) ⇒ <code>Promise.<{}></code>
|
|
489
|
-
Send an SMS message
|
|
490
|
-
|
|
491
|
-
**Kind**: instance method of [<code>AdminMessage</code>](#AdminMessage)
|
|
492
|
-
|
|
493
|
-
| Param | Type | Default | Description |
|
|
494
|
-
| --- | --- | --- | --- |
|
|
495
|
-
| params | <code>object</code> | | Params to send SMS |
|
|
496
|
-
| params.apiKey | <code>string</code> | | Organization API key |
|
|
497
|
-
| params.message | <code>string</code> | | The text message to send |
|
|
498
|
-
| params.recipient | <code>string</code> | | The telephone number without with only numbers |
|
|
499
|
-
| params.limitSize | <code>number</code> | <code>130</code> | Size limit to send SMS |
|
|
500
|
-
|
|
501
|
-
<a name="AdminMessage+sendEmail"></a>
|
|
502
|
-
|
|
503
|
-
### adminMessage.sendEmail(params, session) ⇒ <code>Promise.<{success: boolean, sent: Array.<object>}></code>
|
|
504
|
-
Send email, array with email list or send one email
|
|
505
|
-
|
|
506
|
-
**Kind**: instance method of [<code>AdminMessage</code>](#AdminMessage)
|
|
507
|
-
**Returns**: <code>Promise.<{success: boolean, sent: Array.<object>}></code> - - Success and email sent
|
|
508
|
-
|
|
509
|
-
| Param | Type | Description |
|
|
510
|
-
| --- | --- | --- |
|
|
511
|
-
| params | <code>object</code> | Params to send email |
|
|
512
|
-
| params.subject | <code>string</code> | Subject of the email |
|
|
513
|
-
| params.message | <code>string</code> | Body of the email |
|
|
514
|
-
| params.to | <code>string</code> | Destination email |
|
|
515
|
-
| params.from | <code>string</code> | Source email |
|
|
516
|
-
| session | <code>string</code> | Session, token JWT |
|
|
517
|
-
|
|
518
|
-
**Example**
|
|
519
|
-
```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);
|
|
529
|
-
```
|
|
530
|
-
<a name="AdminNotification"></a>
|
|
531
|
-
|
|
532
|
-
## AdminNotification
|
|
533
|
-
Admin Class for notification, permission admin
|
|
534
|
-
|
|
535
|
-
**Kind**: global class
|
|
536
|
-
|
|
537
|
-
* [AdminNotification](#AdminNotification)
|
|
538
|
-
* [.realTime(params, session)](#AdminNotification+realTime) ⇒ <code>Promise.<\*></code>
|
|
539
|
-
* [.add(params, session)](#AdminNotification+add) ⇒ <code>Promise</code>
|
|
540
|
-
* [.findById(params, session)](#AdminNotification+findById) ⇒ <code>Promise</code>
|
|
541
|
-
* [.findByIdAndUpdate(params, session)](#AdminNotification+findByIdAndUpdate) ⇒ <code>Promise</code>
|
|
542
|
-
* [.findByIdAndRemove(params, session)](#AdminNotification+findByIdAndRemove) ⇒ <code>Promise</code>
|
|
543
|
-
|
|
544
|
-
<a name="AdminNotification+realTime"></a>
|
|
545
|
-
|
|
546
|
-
### adminNotification.realTime(params, session) ⇒ <code>Promise.<\*></code>
|
|
547
|
-
Send real time notification
|
|
548
|
-
|
|
549
|
-
**Kind**: instance method of [<code>AdminNotification</code>](#AdminNotification)
|
|
550
|
-
|
|
551
|
-
| Param | Type | Description |
|
|
552
|
-
| --- | --- | --- |
|
|
553
|
-
| params | <code>object</code> | Params to send notification |
|
|
554
|
-
| params.userIds | <code>string</code> | Users to send notification |
|
|
555
|
-
| params.message | <code>object</code> | Object with data to send user |
|
|
556
|
-
| session | <code>object</code> | Session, token JWT |
|
|
557
|
-
|
|
558
|
-
<a name="AdminNotification+add"></a>
|
|
559
|
-
|
|
560
|
-
### adminNotification.add(params, session) ⇒ <code>Promise</code>
|
|
561
|
-
Create notification
|
|
562
|
-
|
|
563
|
-
**Kind**: instance method of [<code>AdminNotification</code>](#AdminNotification)
|
|
564
|
-
**Access**: public
|
|
565
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
566
|
-
|
|
567
|
-
| Param | Type | Description |
|
|
568
|
-
| --- | --- | --- |
|
|
569
|
-
| params | <code>object</code> | Params to create notification |
|
|
570
|
-
| params.orgId | <code>string</code> | OrgId of the user SU |
|
|
571
|
-
| params.userId | <code>string</code> | User to create notification |
|
|
572
|
-
| params.message | <code>object</code> | Object with data to send user |
|
|
573
|
-
| session | <code>string</code> | Session, token JWT |
|
|
574
|
-
|
|
575
|
-
**Example**
|
|
576
|
-
```js
|
|
577
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
578
|
-
const api = new API();
|
|
579
|
-
const params = {
|
|
580
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
581
|
-
userId: '55e4a3bd6be6b45210833fae',
|
|
582
|
-
message: 'Olá como vai tudo bem?'
|
|
583
|
-
};
|
|
584
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
585
|
-
await api.admin.notifications.add(params, session);
|
|
586
|
-
```
|
|
587
|
-
<a name="AdminNotification+findById"></a>
|
|
588
|
-
|
|
589
|
-
### adminNotification.findById(params, session) ⇒ <code>Promise</code>
|
|
590
|
-
Search notification using (notificationId or userId)
|
|
591
|
-
|
|
592
|
-
**Kind**: instance method of [<code>AdminNotification</code>](#AdminNotification)
|
|
593
|
-
**Access**: public
|
|
594
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
595
|
-
|
|
596
|
-
| Param | Type | Description |
|
|
597
|
-
| --- | --- | --- |
|
|
598
|
-
| params | <code>object</code> | Params to create notification |
|
|
599
|
-
| params.orgId | <code>string</code> | OrgId of the user SU |
|
|
600
|
-
| params.id | <code>string</code> | ALERT! Id is userId or id is notificationId |
|
|
601
|
-
| session | <code>string</code> | Session, token JWT |
|
|
602
|
-
|
|
603
|
-
**Example**
|
|
604
|
-
```js
|
|
605
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
606
|
-
const api = new API();
|
|
607
|
-
const params = {
|
|
608
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
609
|
-
id: '55e4a3bd6be6b45210833fae',
|
|
610
|
-
};
|
|
611
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
612
|
-
await api.admin.notifications.findById(params, session);
|
|
613
|
-
```
|
|
614
|
-
<a name="AdminNotification+findByIdAndUpdate"></a>
|
|
615
|
-
|
|
616
|
-
### adminNotification.findByIdAndUpdate(params, session) ⇒ <code>Promise</code>
|
|
617
|
-
Update notification using (notificationId or userId)
|
|
618
|
-
|
|
619
|
-
**Kind**: instance method of [<code>AdminNotification</code>](#AdminNotification)
|
|
620
|
-
**Access**: public
|
|
621
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
622
|
-
|
|
623
|
-
| Param | Type | Description |
|
|
624
|
-
| --- | --- | --- |
|
|
625
|
-
| params | <code>object</code> | Params to create notification |
|
|
626
|
-
| params.orgId | <code>string</code> | OrgId of the user SU |
|
|
627
|
-
| params.id | <code>string</code> | ALERT! Id is userId or id is notificationId |
|
|
628
|
-
| params.read | <code>boolean</code> | If message is read true or false |
|
|
629
|
-
| session | <code>string</code> | Session, token JWT |
|
|
630
|
-
|
|
631
|
-
**Example**
|
|
632
|
-
```js
|
|
633
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
634
|
-
const api = new API();
|
|
635
|
-
const params = {
|
|
636
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
637
|
-
id: '55e4a3bd6be6b45210833fae',
|
|
638
|
-
read: true
|
|
639
|
-
};
|
|
640
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
641
|
-
await api.admin.notifications.findByIdAndUpdate(params, session);
|
|
642
|
-
```
|
|
643
|
-
<a name="AdminNotification+findByIdAndRemove"></a>
|
|
644
|
-
|
|
645
|
-
### adminNotification.findByIdAndRemove(params, session) ⇒ <code>Promise</code>
|
|
646
|
-
Delete notification using (notificationId or userId)
|
|
647
|
-
|
|
648
|
-
**Kind**: instance method of [<code>AdminNotification</code>](#AdminNotification)
|
|
649
|
-
**Access**: public
|
|
650
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
651
|
-
|
|
652
|
-
| Param | Type | Description |
|
|
653
|
-
| --- | --- | --- |
|
|
654
|
-
| params | <code>object</code> | Params to create notification |
|
|
655
|
-
| params.orgId | <code>string</code> | OrgId of the user SU |
|
|
656
|
-
| params.id | <code>string</code> | ALERT! Id is userId or id is notificationId |
|
|
657
|
-
| session | <code>string</code> | Session, token JWT |
|
|
658
|
-
|
|
659
|
-
**Example**
|
|
660
|
-
```js
|
|
661
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
662
|
-
const api = new API();
|
|
663
|
-
const params = {
|
|
664
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
665
|
-
id: '55e4a3bd6be6b45210833fae',
|
|
666
|
-
};
|
|
667
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
668
|
-
await api.admin.notifications.findByIdAndDelete(params, session);
|
|
669
|
-
```
|
|
670
|
-
<a name="Organization"></a>
|
|
671
|
-
|
|
672
|
-
## Organization
|
|
673
|
-
Class for organizations, permission user
|
|
674
|
-
|
|
675
|
-
**Kind**: global class
|
|
676
|
-
|
|
677
|
-
* [Organization](#Organization)
|
|
678
|
-
* [.upsertAvatar(params, session)](#Organization+upsertAvatar) ⇒ <code>Promise</code>
|
|
679
|
-
* [.removeAvatar(session)](#Organization+removeAvatar) ⇒ <code>Promise</code>
|
|
680
|
-
* [.findById(orgId, session)](#Organization+findById)
|
|
681
|
-
* [.idCardExist(idcard, session)](#Organization+idCardExist)
|
|
682
|
-
* [.upsertAvatar(params, session)](#Organization+upsertAvatar) ⇒ <code>Promise</code>
|
|
683
|
-
* [.removeAvatar(session)](#Organization+removeAvatar) ⇒ <code>Promise</code>
|
|
684
|
-
* [.callFetch(params)](#Organization+callFetch) ⇒ <code>promise</code>
|
|
685
|
-
|
|
686
|
-
<a name="Organization+upsertAvatar"></a>
|
|
687
|
-
|
|
688
|
-
### organization.upsertAvatar(params, session) ⇒ <code>Promise</code>
|
|
689
|
-
Update avatar of organization by session of user not allow session user SU
|
|
690
|
-
|
|
691
|
-
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
692
|
-
**Access**: public
|
|
693
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
694
|
-
|
|
695
|
-
| Param | Type | Description |
|
|
696
|
-
| --- | --- | --- |
|
|
697
|
-
| params | <code>object</code> | Params to update avatar |
|
|
698
|
-
| params.orgId | <code>string</code> | Organization id |
|
|
699
|
-
| params.avatar | <code>string</code> | Image in base64 to update |
|
|
700
|
-
| params.type | <code>string</code> | MimeType (image/png) |
|
|
701
|
-
| session | <code>string</code> | Is token JWT of user SU |
|
|
702
|
-
|
|
703
|
-
**Example**
|
|
704
|
-
```js
|
|
705
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
706
|
-
const api = new API();
|
|
707
|
-
const params = {
|
|
708
|
-
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
709
|
-
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
710
|
-
type: 'image/png',
|
|
711
|
-
};
|
|
712
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
713
|
-
await api.admin.organizations.upsertAvatar(params, session);
|
|
714
|
-
```
|
|
715
|
-
<a name="Organization+removeAvatar"></a>
|
|
716
|
-
|
|
717
|
-
### organization.removeAvatar(session) ⇒ <code>Promise</code>
|
|
718
|
-
Remove avatar of user by session of user not allow session user SU
|
|
719
|
-
|
|
720
|
-
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
721
|
-
**Access**: public
|
|
722
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
723
|
-
|
|
724
|
-
| Param | Type | Description |
|
|
725
|
-
| --- | --- | --- |
|
|
726
|
-
| params.orgId | <code>string</code> | Organization id |
|
|
727
|
-
| session | <code>string</code> | Is token JWT of user SU |
|
|
728
|
-
|
|
729
|
-
**Example**
|
|
730
|
-
```js
|
|
731
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
732
|
-
const api = new API();
|
|
733
|
-
const orgId = '5dadd01dc4af3941d42f8c5c';
|
|
734
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
735
|
-
await api.admin.organizations.removeAvatar(orgId, session);
|
|
736
|
-
```
|
|
737
|
-
<a name="Organization+findById"></a>
|
|
738
|
-
|
|
739
|
-
### organization.findById(orgId, session)
|
|
740
|
-
Find organization by id
|
|
741
|
-
|
|
742
|
-
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
743
|
-
**Access**: public
|
|
744
|
-
**Author**: Augusto Pissarra <abernardo.br@gmail.com>
|
|
745
|
-
|
|
746
|
-
| Param | Type | Description |
|
|
747
|
-
| --- | --- | --- |
|
|
748
|
-
| orgId | <code>string</code> | ID of the organization to find (_id database) |
|
|
749
|
-
| session | <code>string</code> | Is token JWT |
|
|
750
|
-
|
|
751
|
-
**Example**
|
|
752
|
-
```js
|
|
753
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
754
|
-
const api = new API();
|
|
755
|
-
const orgId = '80443245000122';
|
|
756
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
757
|
-
await api.user.organization.findById(idCard, session);
|
|
758
|
-
```
|
|
759
|
-
<a name="Organization+idCardExist"></a>
|
|
760
|
-
|
|
761
|
-
### organization.idCardExist(idcard, session)
|
|
762
|
-
Check if id card exist
|
|
763
|
-
|
|
764
|
-
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
765
|
-
**Access**: public
|
|
766
|
-
**Author**: Augusto Pissarra <abernardo.br@gmail.com>
|
|
767
|
-
|
|
768
|
-
| Param | Type | Description |
|
|
769
|
-
| --- | --- | --- |
|
|
770
|
-
| idcard | <code>string</code> | Check if id card exist |
|
|
771
|
-
| session | <code>string</code> | Is token JWT |
|
|
772
|
-
|
|
773
|
-
**Example**
|
|
774
|
-
```js
|
|
775
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
776
|
-
const api = new API();
|
|
777
|
-
const idCard = '80443245000122';
|
|
778
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
779
|
-
await api.user.organization.idCardExist(idCard, session);
|
|
780
|
-
```
|
|
781
|
-
<a name="Organization+upsertAvatar"></a>
|
|
782
|
-
|
|
783
|
-
### organization.upsertAvatar(params, session) ⇒ <code>Promise</code>
|
|
784
|
-
Update avatar of organization by session of user not allow session user SU
|
|
785
|
-
|
|
786
|
-
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
787
|
-
**Access**: public
|
|
788
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
789
|
-
|
|
790
|
-
| Param | Type | Description |
|
|
791
|
-
| --- | --- | --- |
|
|
792
|
-
| params | <code>object</code> | Params to update avatar |
|
|
793
|
-
| params.avatar | <code>string</code> | Image in base64 to update |
|
|
794
|
-
| params.type | <code>string</code> | mimeType (image/png) |
|
|
795
|
-
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
796
|
-
|
|
797
|
-
**Example**
|
|
798
|
-
```js
|
|
799
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
800
|
-
const api = new API();
|
|
801
|
-
const params = {
|
|
802
|
-
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
803
|
-
type: 'image/png',
|
|
804
|
-
};
|
|
805
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
806
|
-
await api.user.profile.updateAvatar(params, session);
|
|
807
|
-
```
|
|
808
|
-
<a name="Organization+removeAvatar"></a>
|
|
809
|
-
|
|
810
|
-
### organization.removeAvatar(session) ⇒ <code>Promise</code>
|
|
811
|
-
Remove avatar of user by session of user not allow session user SU
|
|
812
|
-
|
|
813
|
-
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
814
|
-
**Access**: public
|
|
815
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
816
|
-
|
|
817
|
-
| Param | Type | Description |
|
|
818
|
-
| --- | --- | --- |
|
|
819
|
-
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
820
|
-
|
|
821
|
-
**Example**
|
|
822
|
-
```js
|
|
823
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
824
|
-
const api = new API();
|
|
825
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
826
|
-
await api.user.profile.removeAvatar(session);
|
|
827
|
-
```
|
|
828
|
-
<a name="Organization+callFetch"></a>
|
|
829
|
-
|
|
830
|
-
### organization.callFetch(params) ⇒ <code>promise</code>
|
|
831
|
-
Call URL internal, need auth JWT (session)
|
|
832
|
-
|
|
833
|
-
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
834
|
-
**Access**: public
|
|
835
|
-
**Author**: Thiago Anselmo <thiagoo.anselmoo@gmail.com>
|
|
836
|
-
|
|
837
|
-
| Param | Type | Default | Description |
|
|
838
|
-
| --- | --- | --- | --- |
|
|
839
|
-
| params | <code>object</code> | | Params to call fectch (URL internal) |
|
|
840
|
-
| params.url | <code>string</code> | | URL to call |
|
|
841
|
-
| [params.method] | <code>string</code> | <code>"POST"</code> | Fetch Method |
|
|
842
|
-
| params.payload | <code>string</code> | | Payload to send system manager |
|
|
843
|
-
|
|
844
|
-
**Example**
|
|
845
|
-
```js
|
|
846
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
847
|
-
const api = new API();
|
|
848
|
-
|
|
849
|
-
const params = {
|
|
850
|
-
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
851
|
-
method: 'POST'
|
|
852
|
-
}
|
|
853
|
-
await api.user.organization.callFetchs(params, session);
|
|
854
|
-
```
|
|
855
|
-
<a name="AdminPlugin"></a>
|
|
856
|
-
|
|
857
|
-
## AdminPlugin
|
|
858
|
-
Admin Class for plugin, permission admin
|
|
859
|
-
|
|
860
|
-
**Kind**: global class
|
|
861
|
-
|
|
862
|
-
* [AdminPlugin](#AdminPlugin)
|
|
863
|
-
* [.find(params)](#AdminPlugin+find)
|
|
864
|
-
* [.findById(id, session)](#AdminPlugin+findById) ⇒ <code>Promise</code>
|
|
865
|
-
|
|
866
|
-
<a name="AdminPlugin+find"></a>
|
|
867
|
-
|
|
868
|
-
### adminPlugin.find(params)
|
|
869
|
-
Find plugins
|
|
870
|
-
|
|
871
|
-
**Kind**: instance method of [<code>AdminPlugin</code>](#AdminPlugin)
|
|
872
|
-
**Access**: public
|
|
873
|
-
**Author**: Augusto Pissarra <abernardo.br@gmail.com>
|
|
874
|
-
|
|
875
|
-
| Param | Type | Description |
|
|
876
|
-
| --- | --- | --- |
|
|
877
|
-
| params | <code>object</code> | Params to search plugins |
|
|
878
|
-
| params.page | <code>number</code> | Start page to pagination |
|
|
879
|
-
| params.perPage | <code>number</code> | Items per page |
|
|
880
|
-
|
|
881
|
-
**Example**
|
|
882
|
-
```js
|
|
883
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
884
|
-
const api = new API();
|
|
885
|
-
const params = {page: 1, perPage: 200};
|
|
886
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
887
|
-
await api.user.organization.findById(params, session);
|
|
888
|
-
```
|
|
889
|
-
<a name="AdminPlugin+findById"></a>
|
|
890
|
-
|
|
891
|
-
### adminPlugin.findById(id, session) ⇒ <code>Promise</code>
|
|
892
|
-
Get plugin by ID
|
|
893
|
-
|
|
894
|
-
**Kind**: instance method of [<code>AdminPlugin</code>](#AdminPlugin)
|
|
895
|
-
**Access**: public
|
|
896
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
897
|
-
|
|
898
|
-
| Param | Type | Description |
|
|
899
|
-
| --- | --- | --- |
|
|
900
|
-
| id | <code>string</code> | Plugin Id (_id database) |
|
|
901
|
-
| session | <code>string</code> | Session, token JWT |
|
|
902
|
-
|
|
903
|
-
**Example**
|
|
904
|
-
```js
|
|
905
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
906
|
-
const api = new API();
|
|
907
|
-
const id ='55e4a3bd6be6b45210833fae',
|
|
908
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
909
|
-
await api.admin.plugin.findById(id, session);
|
|
910
|
-
```
|
|
911
|
-
<a name="AdminPolicy"></a>
|
|
912
|
-
|
|
913
|
-
## AdminPolicy
|
|
914
|
-
Admin Class for policy, permission admin
|
|
915
|
-
|
|
916
|
-
**Kind**: global class
|
|
917
|
-
<a name="AdminPolicy+find"></a>
|
|
918
|
-
|
|
919
|
-
### adminPolicy.find(session) ⇒ <code>Promise</code>
|
|
920
|
-
Find all policies
|
|
921
|
-
|
|
922
|
-
**Kind**: instance method of [<code>AdminPolicy</code>](#AdminPolicy)
|
|
923
|
-
**Access**: public
|
|
924
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
925
|
-
|
|
926
|
-
| Param | Type | Description |
|
|
927
|
-
| --- | --- | --- |
|
|
928
|
-
| session | <code>string</code> | Session, token JWT |
|
|
929
|
-
|
|
930
|
-
**Example**
|
|
931
|
-
```js
|
|
932
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
933
|
-
const api = new API();
|
|
934
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
935
|
-
await api.admin.policy.find(session);
|
|
936
|
-
```
|
|
937
|
-
<a name="AdminProcesses"></a>
|
|
938
|
-
|
|
939
|
-
## AdminProcesses
|
|
940
|
-
Admin Class for processes, permission admin
|
|
941
|
-
|
|
942
|
-
**Kind**: global class
|
|
943
|
-
|
|
944
|
-
* [AdminProcesses](#AdminProcesses)
|
|
945
|
-
* [.search()](#AdminProcesses+search) ⇒ <code>Promise</code>
|
|
946
|
-
* [.advancedSearch(params, session)](#AdminProcesses+advancedSearch) ⇒ <code>Promise</code>
|
|
947
|
-
|
|
948
|
-
<a name="AdminProcesses+search"></a>
|
|
949
|
-
|
|
950
|
-
### adminProcesses.search() ⇒ <code>Promise</code>
|
|
951
|
-
Advanced search of processes, check documentation, to verify all params, pass to method search
|
|
952
|
-
|
|
953
|
-
**Kind**: instance method of [<code>AdminProcesses</code>](#AdminProcesses)
|
|
954
|
-
**Access**: public
|
|
955
|
-
**See**: https://confluence.external-share.com/content/7450b014-52c6-4d9e-b30e-a062b57453b5/17104899/17694721/532545537
|
|
956
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
957
|
-
**Example**
|
|
958
|
-
```js
|
|
959
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
960
|
-
const api = new API();
|
|
961
|
-
const params = {
|
|
962
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
963
|
-
...
|
|
964
|
-
...
|
|
965
|
-
...
|
|
966
|
-
};
|
|
967
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
968
|
-
await api.admin.processes.search(params, session);
|
|
969
|
-
```
|
|
970
|
-
<a name="AdminProcesses+advancedSearch"></a>
|
|
971
|
-
|
|
972
|
-
### adminProcesses.advancedSearch(params, session) ⇒ <code>Promise</code>
|
|
973
|
-
Advanced search of process in elastic search ussing system manager
|
|
974
|
-
|
|
975
|
-
**Kind**: instance method of [<code>AdminProcesses</code>](#AdminProcesses)
|
|
976
|
-
**Access**: public
|
|
977
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
978
|
-
|
|
979
|
-
| Param | Type | Description |
|
|
980
|
-
| --- | --- | --- |
|
|
981
|
-
| params | <code>object</code> | Params to search document |
|
|
982
|
-
| params.orgProcessId | <code>string</code> | Document id (_id database) of the process |
|
|
983
|
-
| params.query | <code>object</code> | Query to search in elastic search |
|
|
984
|
-
| session | <code>string</code> | Session, token JWT |
|
|
985
|
-
|
|
986
|
-
**Example**
|
|
987
|
-
```js
|
|
988
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
989
|
-
const api = new API();
|
|
990
|
-
const params = {
|
|
991
|
-
orgProcessId: '5edd11c46b6ce9729c2c297c',
|
|
992
|
-
query: {
|
|
993
|
-
"_source": "processData.properties.processProperties",
|
|
994
|
-
"query": {
|
|
995
|
-
"term": {
|
|
996
|
-
"initParams.email.keyword": {
|
|
997
|
-
"value": "clintes001@gmail.com"
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1004
|
-
await api.admin.processes.advancedSearch(params, session);
|
|
1005
|
-
```
|
|
1006
|
-
<a name="AdminTask"></a>
|
|
1007
|
-
|
|
1008
|
-
## AdminTask
|
|
1009
|
-
Admin Class for task, permission admin
|
|
1010
|
-
|
|
1011
|
-
**Kind**: global class
|
|
1012
|
-
<a name="AdminTask+find"></a>
|
|
1013
|
-
|
|
1014
|
-
### adminTask.find(params, session)
|
|
1015
|
-
Get task by user Id
|
|
1016
|
-
|
|
1017
|
-
**Kind**: instance method of [<code>AdminTask</code>](#AdminTask)
|
|
1018
|
-
**Access**: public
|
|
1019
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1020
|
-
|
|
1021
|
-
| Param | Type | Default | Description |
|
|
1022
|
-
| --- | --- | --- | --- |
|
|
1023
|
-
| params | <code>object</code> | | Params to get task |
|
|
1024
|
-
| params.userId | <code>string</code> | | User id (_id database) |
|
|
1025
|
-
| [params.filter] | <code>string</code> | <code>"NOT_DONE"</code> | Filter type CLEAN | EXECUTED | PENDING | LATE | NOT_DONE | DONE |
|
|
1026
|
-
| params.project | <code>object</code> | | Project to return |
|
|
1027
|
-
| params.project.returnProcessProperties | <code>boolean</code> | | Return process properties |
|
|
1028
|
-
| params.project.returnInitParams | <code>boolean</code> | | Return init params |
|
|
1029
|
-
| params.userId | <code>string</code> | | User id (_id database) |
|
|
1030
|
-
| [params.includeOwner] | <code>boolean</code> | <code>false</code> | Include owner true | false |
|
|
1031
|
-
| session | <code>string</code> | | Session, token JWT |
|
|
1032
|
-
|
|
1033
|
-
**Example**
|
|
1034
|
-
```js
|
|
1035
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1036
|
-
const api = new API();
|
|
1037
|
-
const params = {
|
|
1038
|
-
userId: '55e4a3bd6be6b45210833fae',
|
|
1039
|
-
};
|
|
1040
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1041
|
-
await api.admin.task.find(params, session);
|
|
1042
|
-
```
|
|
1043
|
-
<a name="AdminUser"></a>
|
|
1044
|
-
|
|
1045
|
-
## AdminUser
|
|
1046
|
-
Admin Class for user, permission admin
|
|
1047
|
-
|
|
1048
|
-
**Kind**: global class
|
|
1049
|
-
|
|
1050
|
-
* [AdminUser](#AdminUser)
|
|
1051
|
-
* [.findById(userId, session)](#AdminUser+findById) ⇒ <code>Promise</code>
|
|
1052
|
-
* [.findByIdAndUpdatePassword(params, session)](#AdminUser+findByIdAndUpdatePassword) ⇒ <code>Promise.<unknown></code>
|
|
1053
|
-
* [.emailExist(email, session)](#AdminUser+emailExist)
|
|
1054
|
-
* [.findByIdAndUpdate(userId, payload, session)](#AdminUser+findByIdAndUpdate) ⇒ <code>Promise.<\*></code>
|
|
1055
|
-
|
|
1056
|
-
<a name="AdminUser+findById"></a>
|
|
1057
|
-
|
|
1058
|
-
### adminUser.findById(userId, session) ⇒ <code>Promise</code>
|
|
1059
|
-
Request profile by userId
|
|
1060
|
-
|
|
1061
|
-
**Kind**: instance method of [<code>AdminUser</code>](#AdminUser)
|
|
1062
|
-
**Access**: public
|
|
1063
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1064
|
-
|
|
1065
|
-
| Param | Type | Description |
|
|
1066
|
-
| --- | --- | --- |
|
|
1067
|
-
| userId | <code>string</code> | User identifier (_id database) |
|
|
1068
|
-
| session | <code>string</code> | Is token JWT |
|
|
1069
|
-
|
|
1070
|
-
**Example**
|
|
1071
|
-
```js
|
|
1072
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1073
|
-
const api = new API();
|
|
1074
|
-
const userId = '55e4a3bd6be6b45210833fae';
|
|
1075
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1076
|
-
await api.admin.user.findById(userId, session);
|
|
1077
|
-
```
|
|
1078
|
-
<a name="AdminUser+findByIdAndUpdatePassword"></a>
|
|
1079
|
-
|
|
1080
|
-
### adminUser.findByIdAndUpdatePassword(params, session) ⇒ <code>Promise.<unknown></code>
|
|
1081
|
-
Update password by userId
|
|
1082
|
-
|
|
1083
|
-
**Kind**: instance method of [<code>AdminUser</code>](#AdminUser)
|
|
1084
|
-
**Access**: public
|
|
1085
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1086
|
-
|
|
1087
|
-
| Param | Type | Description |
|
|
1088
|
-
| --- | --- | --- |
|
|
1089
|
-
| params | <code>object</code> | Params to update password |
|
|
1090
|
-
| params.userId | <code>string</code> | Id of the user |
|
|
1091
|
-
| params.oldPassword | <code>string</code> | Old password |
|
|
1092
|
-
| params.newPassword | <code>string</code> | New password |
|
|
1093
|
-
| session | <code>string</code> | Is token JWT |
|
|
1094
|
-
|
|
1095
|
-
**Example**
|
|
1096
|
-
```js
|
|
1097
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1098
|
-
const api = new API();
|
|
1099
|
-
const params = {
|
|
1100
|
-
userId: '55e4a3bd6be6b45210833fae',
|
|
1101
|
-
oldPassword: '123456',
|
|
1102
|
-
newPassword: '123456789'
|
|
1103
|
-
};
|
|
1104
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1105
|
-
await api.admin.user.findByIdAndUpdatePassword(params, session);
|
|
1106
|
-
```
|
|
1107
|
-
<a name="AdminUser+emailExist"></a>
|
|
1108
|
-
|
|
1109
|
-
### adminUser.emailExist(email, session)
|
|
1110
|
-
Check if email is unique
|
|
1111
|
-
|
|
1112
|
-
**Kind**: instance method of [<code>AdminUser</code>](#AdminUser)
|
|
1113
|
-
**Access**: public
|
|
1114
|
-
**Author**: Thiago Anselmo <thiagoo.anselmoo@gmail.com>
|
|
1115
|
-
|
|
1116
|
-
| Param | Type | Description |
|
|
1117
|
-
| --- | --- | --- |
|
|
1118
|
-
| email | <code>string</code> | Check if email is unique |
|
|
1119
|
-
| session | <code>string</code> | Is token JWT |
|
|
1120
|
-
|
|
1121
|
-
**Example**
|
|
1122
|
-
```js
|
|
1123
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1124
|
-
const api = new API();
|
|
1125
|
-
const email = 'ana.silva@gmail.com';
|
|
1126
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1127
|
-
await api.admin.user.emailExist(email, session);
|
|
1128
|
-
```
|
|
1129
|
-
<a name="AdminUser+findByIdAndUpdate"></a>
|
|
1130
|
-
|
|
1131
|
-
### adminUser.findByIdAndUpdate(userId, payload, session) ⇒ <code>Promise.<\*></code>
|
|
1132
|
-
update userData by userSMId
|
|
1133
|
-
|
|
1134
|
-
**Kind**: instance method of [<code>AdminUser</code>](#AdminUser)
|
|
1135
|
-
**Access**: public
|
|
1136
|
-
|
|
1137
|
-
| Param | Type | Description |
|
|
1138
|
-
| --- | --- | --- |
|
|
1139
|
-
| userId | <code>string</code> | User SM Id |
|
|
1140
|
-
| payload | <code>object</code> | Payload to update |
|
|
1141
|
-
| session | <code>string</code> | Is token JWT |
|
|
1142
|
-
|
|
1143
|
-
**Example**
|
|
1144
|
-
```js
|
|
1145
|
-
const userId = '55e4a3bd6be6b45210833fae';
|
|
1146
|
-
const payload = {
|
|
1147
|
-
name: 'Maria joaquina',
|
|
1148
|
-
email: 'maria@gmail.com'
|
|
1149
|
-
};
|
|
1150
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1151
|
-
```
|
|
1152
|
-
<a name="GeoLocation"></a>
|
|
1153
|
-
|
|
1154
|
-
## GeoLocation
|
|
1155
|
-
General Class for user, permission organization
|
|
1156
|
-
|
|
1157
|
-
**Kind**: global class
|
|
1158
|
-
<a name="GeoLocation+location"></a>
|
|
1159
|
-
|
|
1160
|
-
### geoLocation.location(params) ⇒ <code>Promise</code>
|
|
1161
|
-
Get geo location of the address
|
|
1162
|
-
|
|
1163
|
-
**Kind**: instance method of [<code>GeoLocation</code>](#GeoLocation)
|
|
1164
|
-
**Access**: public
|
|
1165
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1166
|
-
|
|
1167
|
-
| Param | Type | Description |
|
|
1168
|
-
| --- | --- | --- |
|
|
1169
|
-
| params | <code>object</code> | Params to get geo location |
|
|
1170
|
-
| params.address | <code>string</code> | The address to get the location for |
|
|
1171
|
-
| params.apiKey | <code>string</code> | The Organization API Key |
|
|
1172
|
-
|
|
1173
|
-
**Example**
|
|
1174
|
-
```js
|
|
1175
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1176
|
-
const api = new API();
|
|
1177
|
-
const params = {
|
|
1178
|
-
address: 'Rua Sud Menucci, 615 - Vila Camilopolis, Santo André - SP',
|
|
1179
|
-
apiKey: 'AIzaSyC7gJFOkuT-Mel3WZbX5uKuJ1USqLVkGnY',
|
|
1180
|
-
};
|
|
1181
|
-
await api.general.geo.location(params);
|
|
1182
|
-
```
|
|
1183
|
-
<a name="Users"></a>
|
|
1184
|
-
|
|
1185
|
-
## Users
|
|
1186
|
-
API request, user permission level
|
|
1187
|
-
|
|
1188
|
-
**Kind**: global class
|
|
1189
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1190
|
-
|
|
1191
|
-
* [Users](#Users)
|
|
1192
|
-
* [new Users(options)](#new_Users_new)
|
|
1193
|
-
* [new Users(options)](#new_Users_new)
|
|
1194
|
-
|
|
1195
|
-
<a name="new_Users_new"></a>
|
|
1196
|
-
|
|
1197
|
-
### new Users(options)
|
|
1198
|
-
|
|
1199
|
-
| Param | Type | Description |
|
|
1200
|
-
| --- | --- | --- |
|
|
1201
|
-
| options | <code>object</code> | Params of the constructor |
|
|
1202
|
-
| options.parent | <code>object</code> | This of the pararent |
|
|
1203
|
-
|
|
1204
|
-
<a name="new_Users_new"></a>
|
|
1205
|
-
|
|
1206
|
-
### new Users(options)
|
|
1207
|
-
|
|
1208
|
-
| Param | Type | Description |
|
|
1209
|
-
| --- | --- | --- |
|
|
1210
|
-
| options | <code>object</code> | Params of the constructor |
|
|
1211
|
-
| options.parent | <code>object</code> | This of the pararent |
|
|
1212
|
-
|
|
1213
|
-
<a name="Datasource"></a>
|
|
1214
|
-
|
|
1215
|
-
## Datasource
|
|
1216
|
-
Class for user datasource access, to be used with when creating new documents
|
|
1217
|
-
|
|
1218
|
-
**Kind**: global class
|
|
1219
|
-
<a name="Datasource+autocomplete"></a>
|
|
1220
|
-
|
|
1221
|
-
### datasource.autocomplete(params, session) ⇒ <code>promise.<array></code> \| <code>string</code> \| <code>object</code>
|
|
1222
|
-
Method to get autocomplete data from a datasource
|
|
1223
|
-
|
|
1224
|
-
**Kind**: instance method of [<code>Datasource</code>](#Datasource)
|
|
1225
|
-
**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
|
|
1226
|
-
**Access**: public
|
|
1227
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1228
|
-
|
|
1229
|
-
| Param | Type | Description |
|
|
1230
|
-
| --- | --- | --- |
|
|
1231
|
-
| params | <code>object</code> | Params to add notification token |
|
|
1232
|
-
| params.orgId | <code>string</code> | The user organization _id |
|
|
1233
|
-
| params.dataSources | <code>array.<object></code> | The document type data sources information |
|
|
1234
|
-
| params.dataSources._id | <code>string</code> | The document type data sources _id |
|
|
1235
|
-
| params.dataSources.fields | <code>array.<object></code> | The document type data sources list of fields |
|
|
1236
|
-
| params.documents | <code>array.<object></code> | The document list |
|
|
1237
|
-
| params.documents._id | <code>string</code> | The document _id |
|
|
1238
|
-
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
1239
|
-
|
|
1240
|
-
**Example**
|
|
1241
|
-
```js
|
|
1242
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1243
|
-
const api = new API();
|
|
1244
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1245
|
-
const params = {
|
|
1246
|
-
orgId: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
|
|
1247
|
-
dataSources: [{}],
|
|
1248
|
-
documents: [{}]
|
|
1249
|
-
};
|
|
1250
|
-
const retData = await api.user.datasource.autocomplete(params, session);
|
|
1251
|
-
```
|
|
1252
|
-
<a name="Documents"></a>
|
|
1253
|
-
|
|
1254
|
-
## Documents
|
|
1255
|
-
Class for documents, permission user
|
|
1256
|
-
|
|
1257
|
-
**Kind**: global class
|
|
1258
|
-
|
|
1259
|
-
* [Documents](#Documents)
|
|
1260
|
-
* [.add(params, session)](#Documents+add) ⇒ <code>Promise</code>
|
|
1261
|
-
* [.find(params, session)](#Documents+find) ⇒ <code>Promise</code>
|
|
1262
|
-
* [.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>
|
|
1263
|
-
* [.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>
|
|
1264
|
-
* [.signedUrl(params, session)](#Documents+signedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1265
|
-
* [.signedUrls(params, session)](#Documents+signedUrls) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1266
|
-
* [.uploadSignedDocument(params)](#Documents+uploadSignedDocument) ⇒ <code>Promise.<boolean></code>
|
|
1267
|
-
* [.checkPrimaryKeys(params, session)](#Documents+checkPrimaryKeys) ⇒ <code>Promise.<array></code> \| <code>array.<string></code>
|
|
1268
|
-
* [.searchDocuments(params, session)](#Documents+searchDocuments) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
1269
|
-
|
|
1270
|
-
<a name="Documents+add"></a>
|
|
1271
|
-
|
|
1272
|
-
### documents.add(params, session) ⇒ <code>Promise</code>
|
|
1273
|
-
Create new document
|
|
1274
|
-
|
|
1275
|
-
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1276
|
-
**Access**: public
|
|
1277
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1278
|
-
|
|
1279
|
-
| Param | Type | Default | Description |
|
|
1280
|
-
| --- | --- | --- | --- |
|
|
1281
|
-
| params | <code>object</code> | | Object for add new document |
|
|
1282
|
-
| params.orgname | <code>string</code> | | Organization name |
|
|
1283
|
-
| params.areaId | <code>string</code> | | Doc area id (_id database) |
|
|
1284
|
-
| params.docId | <code>string</code> | | Document id (_id database) |
|
|
1285
|
-
| [params.documentDate] | <code>string</code> | <code>"new Date()"</code> | Date of document |
|
|
1286
|
-
| params.document | <code>string</code> | | The path to the file. If S3, the key to S3, gotten after getting a signed URL |
|
|
1287
|
-
| params.filename | <code>string</code> | | File name |
|
|
1288
|
-
| params.type | <code>string</code> | | Mimetype of the document (image/png) |
|
|
1289
|
-
| params.name | <code>string</code> | | Document name |
|
|
1290
|
-
| [params.content] | <code>string</code> | <code>"''"</code> | Content of document |
|
|
1291
|
-
| [params.description] | <code>string</code> | <code>"''"</code> | Description of document |
|
|
1292
|
-
| [params.category] | <code>string</code> | <code>"''"</code> | Category of document |
|
|
1293
|
-
| [params.tags] | <code>array</code> | <code>[]</code> | Tags of document |
|
|
1294
|
-
| params.docTypeId | <code>string</code> | | Document type id (_id database) |
|
|
1295
|
-
| [params.hasPhisicalStorage] | <code>boolean</code> | <code>false</code> | Has Phisical Storage |
|
|
1296
|
-
| [params.boxId] | <code>string</code> | <code>"''"</code> | Box ID |
|
|
1297
|
-
| [params.storageStatus] | <code>string</code> | <code>"''"</code> | Storage status |
|
|
1298
|
-
| [params.ocrDocumentBackend] | <code>boolean</code> | <code>false</code> | Ocr document backend |
|
|
1299
|
-
| params.bytes | <code>number</code> | | Size document in bytes |
|
|
1300
|
-
| [params.docAreaPermission] | <code>object</code> | <code>{}</code> | Permission to doc area |
|
|
1301
|
-
| [params.docTypeFieldsData] | <code>object</code> | <code>{}</code> | Fields data "extraField' |
|
|
1302
|
-
| params.signedUrl | <code>string</code> | | SIgned URL |
|
|
1303
|
-
| [params.urlType] | <code>string</code> | <code>"'S3'"</code> | URL type |
|
|
1304
|
-
| [params.addType] | <code>string</code> | <code>"'S3_SIGNED'"</code> | Add type |
|
|
1305
|
-
| params.orgId | <code>string</code> | | Organization id (_id database) |
|
|
1306
|
-
| session | <code>string</code> | | Session, token JWT |
|
|
1307
|
-
|
|
1308
|
-
**Example**
|
|
1309
|
-
```js
|
|
1310
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1311
|
-
const api = new API();
|
|
1312
|
-
const params = {
|
|
1313
|
-
orgname: 'cloundbrasil',
|
|
1314
|
-
areaId: '5edf9f8ee896b817e45b8dac',
|
|
1315
|
-
docId: '5edf86fbe896b817e45b8da6',
|
|
1316
|
-
fileName: 'foto',
|
|
1317
|
-
type: 'image/png',
|
|
1318
|
-
name: 'Fotografia',
|
|
1319
|
-
docTypeId = '5edf9f8ee896b817e45b8dac',
|
|
1320
|
-
bytes: 12345,
|
|
1321
|
-
signedUrl: 'https://s3.amazonaws.com...'
|
|
1322
|
-
docTypeFieldsData: {extraUser: '12349f8ee896b817e45b8dac'},
|
|
1323
|
-
orgId: '5df7f19618430c89a41a19d2',
|
|
1324
|
-
};
|
|
1325
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1326
|
-
await api.user.document.add(params, session);
|
|
1327
|
-
```
|
|
1328
|
-
<a name="Documents+find"></a>
|
|
1329
|
-
|
|
1330
|
-
### documents.find(params, session) ⇒ <code>Promise</code>
|
|
1331
|
-
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1332
|
-
**Access**: public
|
|
1333
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1334
|
-
|
|
1335
|
-
| Param | Type | Default | Description |
|
|
1336
|
-
| --- | --- | --- | --- |
|
|
1337
|
-
| params | <code>object</code> | | Object with params |
|
|
1338
|
-
| params.index | <code>string</code> | | Field to search |
|
|
1339
|
-
| params.txtToSearch | <code>string</code> | | Text to search |
|
|
1340
|
-
| [params.compare] | <code>string</code> | <code>"*"</code> | Filter to search (=, ~, *, =*, *=, *?) |
|
|
1341
|
-
| params.docId | <code>string</code> | | Document id for serach |
|
|
1342
|
-
| params.docAreaId | <code>string</code> | | Doc area id |
|
|
1343
|
-
| params.tag | <code>string</code> | | Tag of the document |
|
|
1344
|
-
| [params.projection] | <code>string</code> | <code>"\"\""</code> | Projection to return fields |
|
|
1345
|
-
| [params.sort] | <code>string</code> | <code>"\"Mais+recentes\""</code> | Sort data |
|
|
1346
|
-
| params.orgId | <code>string</code> | | Organization id (_id database) |
|
|
1347
|
-
| params.pagination | <code>string</code> | | Set pagination |
|
|
1348
|
-
| [params.pagination.page] | <code>number</code> | <code>1</code> | Page |
|
|
1349
|
-
| [params.pagination.perPage] | <code>number</code> | <code>100</code> | perPage Itens per page |
|
|
1350
|
-
| session | <code>string</code> | | Session, token JWT |
|
|
1351
|
-
|
|
1352
|
-
**Example**
|
|
1353
|
-
```js
|
|
1354
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1355
|
-
const api = new API();
|
|
1356
|
-
const params - {
|
|
1357
|
-
index: 'extraCity',
|
|
1358
|
-
txtToSearch: 'São',
|
|
1359
|
-
docId: '5df7f19618430c89a41a19d2',
|
|
1360
|
-
docAreaId: '5edd11c46b6ce9729c2c297c',
|
|
1361
|
-
tag: 'Nome da cidade',
|
|
1362
|
-
orgId: '1234d01dc4af3941d42f8c5c'
|
|
1363
|
-
};
|
|
1364
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1365
|
-
await api.user.document.findByIdAndRemove(params, session);
|
|
1366
|
-
```
|
|
1367
|
-
<a name="Documents+findByIdAndRemove"></a>
|
|
1368
|
-
|
|
1369
|
-
### documents.findByIdAndRemove(params, session) ⇒ <code>Promise.<object></code> \| <code>number</code> \| <code>array.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1370
|
-
Remove document by id
|
|
1371
|
-
|
|
1372
|
-
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1373
|
-
**Returns**: <code>Promise.<object></code> - data The returned data<code>number</code> - data.removed The quantity of removed documents<code>array.<object></code> - data.errors Array of errors<code>string</code> - data.errors.id Id of the document that had an error<code>string</code> - data.errors.code Error code<code>string</code> - data.errors.message Error message
|
|
1374
|
-
**Access**: public
|
|
1375
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1376
|
-
|
|
1377
|
-
| Param | Type | Description |
|
|
1378
|
-
| --- | --- | --- |
|
|
1379
|
-
| params | <code>object</code> | Params to remove document |
|
|
1380
|
-
| params.docId | <code>string</code> | Document Id (_id database) |
|
|
1381
|
-
| params.orgId | <code>string</code> | Organizarion id (_id database) |
|
|
1382
|
-
| session | <code>string</code> | Session, token JWT |
|
|
1383
|
-
|
|
1384
|
-
**Example**
|
|
1385
|
-
```js
|
|
1386
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1387
|
-
const api = new API();
|
|
1388
|
-
const params - {
|
|
1389
|
-
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1390
|
-
orgIdId: '5df7f19618430c89a41a19d2',
|
|
1391
|
-
};
|
|
1392
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1393
|
-
await api.user.document.findByIdAndRemove(params, session);
|
|
1394
|
-
```
|
|
1395
|
-
<a name="Documents+findByIdsAndRemove"></a>
|
|
1396
|
-
|
|
1397
|
-
### documents.findByIdsAndRemove(params, session) ⇒ <code>Promise.<object></code> \| <code>number</code> \| <code>array.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1398
|
-
Remove documents
|
|
1399
|
-
|
|
1400
|
-
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1401
|
-
**Returns**: <code>Promise.<object></code> - data The returned data<code>number</code> - data.removed The quantity of removed documents<code>array.<object></code> - data.errors Array of errors<code>string</code> - data.errors.id Id of the document that had an error<code>string</code> - data.errors.code Error code<code>string</code> - data.errors.message Error message
|
|
1402
|
-
**Access**: public
|
|
1403
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1404
|
-
|
|
1405
|
-
| Param | Type | Description |
|
|
1406
|
-
| --- | --- | --- |
|
|
1407
|
-
| params | <code>object</code> | Params to remove document |
|
|
1408
|
-
| params.documents | <code>array.<string></code> | An array ids of documents (_id database) |
|
|
1409
|
-
| params.documents._id | <code>array.<string></code> | The document id (_id database) |
|
|
1410
|
-
| params.orgId | <code>string</code> | Organizarion id (_id database) |
|
|
1411
|
-
| session | <code>string</code> | Session, token JWT |
|
|
1412
|
-
|
|
1413
|
-
**Example**
|
|
1414
|
-
```js
|
|
1415
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1416
|
-
const api = new API();
|
|
1417
|
-
const params - {
|
|
1418
|
-
documents: [{ _id: '5dadd01dc4af3941d42f8c5c' }],
|
|
1419
|
-
orgId: '5df7f19618430c89a41a19d2',
|
|
1420
|
-
};
|
|
1421
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1422
|
-
await api.user.document.findByIdsAndRemove(params, session);
|
|
1423
|
-
```
|
|
1424
|
-
<a name="Documents+signedUrl"></a>
|
|
1425
|
-
|
|
1426
|
-
### documents.signedUrl(params, session) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1427
|
-
Request signed url url to put or get
|
|
1428
|
-
|
|
1429
|
-
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1430
|
-
**Returns**: <code>Promise.<object></code> - doc Returned document data with the signed url<code>string</code> - doc.docId Document id<code>string</code> - doc.name The name of the document, which is the fileName<code>string</code> - doc.areaId docAreaId of the document<code>string</code> - doc.type the document mimi type<code>string</code> - doc.signedUrl the signed URL to upload
|
|
1431
|
-
**Access**: public
|
|
1432
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1433
|
-
|
|
1434
|
-
| Param | Type | Description |
|
|
1435
|
-
| --- | --- | --- |
|
|
1436
|
-
| params | <code>object</code> | Params to request signed url |
|
|
1437
|
-
| params.methodType | <code>string</code> | Method type HTTP get or put |
|
|
1438
|
-
| params.docId | <code>string</code> | Document id |
|
|
1439
|
-
| params.fileName | <code>string</code> | File name |
|
|
1440
|
-
| params.docAreaId | <code>string</code> | docAreaId of the document |
|
|
1441
|
-
| params.type | <code>string</code> | mimeType image/png image/jpg others |
|
|
1442
|
-
| params.document | <code>string</code> | Name document to request if method type is get |
|
|
1443
|
-
| params.orgId | <code>string</code> | Organization id (_id database) |
|
|
1444
|
-
| session | <code>string</code> | Session, token JWT |
|
|
1445
|
-
|
|
1446
|
-
**Example**
|
|
1447
|
-
```js
|
|
1448
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1449
|
-
const api = new API();
|
|
1450
|
-
const params - {
|
|
1451
|
-
methodType: 'put',
|
|
1452
|
-
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1453
|
-
docAreaId: '5df7f19618430c89a41a19d2',
|
|
1454
|
-
fileName: 'Foto',
|
|
1455
|
-
type: 'image/png'
|
|
1456
|
-
orgId: '5df7f19618430c89a41a19f8'
|
|
1457
|
-
};
|
|
1458
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1459
|
-
// each doc: { docId, name, areaId, type, signedUrl }
|
|
1460
|
-
const { docs } = await api.user.document.signedUrl(params, session);
|
|
1461
|
-
```
|
|
1462
|
-
**Example**
|
|
1463
|
-
```js
|
|
1464
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1465
|
-
const api = new API();
|
|
1466
|
-
const params - {
|
|
1467
|
-
methodType: 'get',
|
|
1468
|
-
document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf',
|
|
1469
|
-
};
|
|
1470
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1471
|
-
const base64Data = await api.user.document.signedUrl(params, session);
|
|
1472
|
-
```
|
|
1473
|
-
<a name="Documents+signedUrls"></a>
|
|
1474
|
-
|
|
1475
|
-
### documents.signedUrls(params, session) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1476
|
-
Request signed url url to put or get
|
|
1477
|
-
|
|
1478
|
-
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1479
|
-
**Returns**: <code>Promise.<object></code> - doc Returned document data with the signed url<code>string</code> - doc.docId Document id<code>string</code> - doc.name The name of the document, which is the fileName<code>string</code> - doc.areaId docAreaId of the document<code>string</code> - doc.type the document mimi type<code>string</code> - doc.signedUrl the signed URL to upload
|
|
1480
|
-
**Access**: public
|
|
1481
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1482
|
-
|
|
1483
|
-
| Param | Type | Description |
|
|
1484
|
-
| --- | --- | --- |
|
|
1485
|
-
| params | <code>object</code> | Params to request signed url |
|
|
1486
|
-
| params.docs | <code>array</code> | the list of documents to get the signed urls |
|
|
1487
|
-
| params.docs.docId | <code>string</code> | Document id |
|
|
1488
|
-
| params.docs.name | <code>string</code> | File name |
|
|
1489
|
-
| params.docs.areaId | <code>string</code> | docAreaId of the document |
|
|
1490
|
-
| params.docs.type | <code>string</code> | mimeType image/png image/jpg others |
|
|
1491
|
-
| params.docs.document | <code>string</code> | Name document to request if method type is get |
|
|
1492
|
-
| params.methodType | <code>string</code> | Method type HTTP get or put |
|
|
1493
|
-
| params.orgId | <code>string</code> | Organization id (_id database) |
|
|
1494
|
-
| session | <code>string</code> | Session, token JWT |
|
|
1495
|
-
|
|
1496
|
-
**Example**
|
|
1497
|
-
```js
|
|
1498
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1499
|
-
const api = new API();
|
|
1500
|
-
const params - {
|
|
1501
|
-
methodType: 'put',
|
|
1502
|
-
orgId: '5df7f19618430c89a41a19f8'
|
|
1503
|
-
docs: [
|
|
1504
|
-
{
|
|
1505
|
-
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1506
|
-
areaId: '5df7f19618430c89a41a19d2',
|
|
1507
|
-
name: 'Foto.png',
|
|
1508
|
-
type: 'image/png'
|
|
1509
|
-
}
|
|
1510
|
-
]
|
|
1511
|
-
};
|
|
1512
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1513
|
-
// each doc: { docId, name, areaId, type, signedUrl }
|
|
1514
|
-
const { docs } = await api.user.document.signedUrls(params, session);
|
|
1515
|
-
```
|
|
1516
|
-
**Example**
|
|
1517
|
-
```js
|
|
1518
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1519
|
-
const api = new API();
|
|
1520
|
-
const params - {
|
|
1521
|
-
methodType: 'get',
|
|
1522
|
-
docs: [
|
|
1523
|
-
{ document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf' }
|
|
1524
|
-
],
|
|
1525
|
-
};
|
|
1526
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1527
|
-
const base64Data = await api.user.document.signedUrls(params, session);
|
|
1528
|
-
```
|
|
1529
|
-
<a name="Documents+uploadSignedDocument"></a>
|
|
1530
|
-
|
|
1531
|
-
### documents.uploadSignedDocument(params) ⇒ <code>Promise.<boolean></code>
|
|
1532
|
-
Uploads the file
|
|
1533
|
-
|
|
1534
|
-
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1535
|
-
**Returns**: <code>Promise.<boolean></code> - True if success
|
|
1536
|
-
**Access**: public
|
|
1537
|
-
|
|
1538
|
-
| Param | Type | Description |
|
|
1539
|
-
| --- | --- | --- |
|
|
1540
|
-
| params | <code>object</code> | Params to upload document |
|
|
1541
|
-
| params.content | <code>buffer</code> | The content of the file (Buffer) |
|
|
1542
|
-
| params.signedUrl | <code>string</code> | The signed URL |
|
|
1543
|
-
| params.type | <code>string</code> | The file mime type |
|
|
1544
|
-
| params.onUploadProgress | <code>string</code> | A callback for the upload progress. It will return a progressEvent. |
|
|
1545
|
-
|
|
1546
|
-
**Example**
|
|
1547
|
-
```js
|
|
1548
|
-
const FS = require('fs');
|
|
1549
|
-
const Path = require('path');
|
|
1550
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1551
|
-
const api = new API();
|
|
1552
|
-
const params - {
|
|
1553
|
-
content: FS.readFileSync(Path.join(__dirname, '.mypdf.pdf')),
|
|
1554
|
-
signedUrl: 'https://signedurl.com/token...',
|
|
1555
|
-
type: 'application/pdf'
|
|
1556
|
-
};
|
|
1557
|
-
const retData = await api.user.document.uploadSignedDocument(params);
|
|
1558
|
-
|
|
1559
|
-
onUploadProgress return the progressEvent
|
|
1560
|
-
- lengthComputable: A Boolean that indicates whether or not the total number of bytes is known.
|
|
1561
|
-
- loaded: The number of bytes of the file that have been uploaded.
|
|
1562
|
-
- total: The total number of bytes in the file.
|
|
1563
|
-
```
|
|
1564
|
-
<a name="Documents+checkPrimaryKeys"></a>
|
|
1565
|
-
|
|
1566
|
-
### documents.checkPrimaryKeys(params, session) ⇒ <code>Promise.<array></code> \| <code>array.<string></code>
|
|
1567
|
-
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1568
|
-
**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
|
|
1569
|
-
**Access**: public
|
|
1570
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1571
|
-
Checks if a document can be added and it does not repeat its primary key
|
|
1572
|
-
|
|
1573
|
-
| Param | Type | Description |
|
|
1574
|
-
| --- | --- | --- |
|
|
1575
|
-
| params | | |
|
|
1576
|
-
| params.orgId | <code>string</code> | the organization id |
|
|
1577
|
-
| params.docTypeId | <code>string</code> | the id of the doc type |
|
|
1578
|
-
| params.docs | <code>array.<object></code> | an array of documents |
|
|
1579
|
-
| params.docs.id | <code>string</code> | an unique id representing the document |
|
|
1580
|
-
| params.docs.docTypeFields | <code>object</code> | thje docTypeFields of the document |
|
|
1581
|
-
| params.docs.docTypeFieldsData | <code>object</code> | thje docTypeFieldsData of the document |
|
|
1582
|
-
| session | | |
|
|
1583
|
-
|
|
1584
|
-
**Example**
|
|
1585
|
-
```js
|
|
1586
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1587
|
-
const api = new API();
|
|
1588
|
-
const docTypeFields = [...]; // the doc type fields array
|
|
1589
|
-
const docTypeFieldsData = {...}; // the data of this fields
|
|
1590
|
-
const params - {
|
|
1591
|
-
docs: [{ id: '5dadd01dc4af3941d42f8c5c', docTypeFields, docTypeFieldsData }],
|
|
1592
|
-
orgId: '5df7f19618430c89a41a19d2',
|
|
1593
|
-
docTypeId: '5df7f19618430c89a41a19d5',
|
|
1594
|
-
};
|
|
1595
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1596
|
-
const retDocs = await api.user.document.checkPrimaryKeys(params, session);
|
|
1597
|
-
```
|
|
1598
|
-
<a name="Documents+searchDocuments"></a>
|
|
1599
|
-
|
|
1600
|
-
### documents.searchDocuments(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
1601
|
-
Method to search documents for
|
|
1602
|
-
|
|
1603
|
-
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1604
|
-
**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
|
|
1605
|
-
**Access**: public
|
|
1606
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1607
|
-
|
|
1608
|
-
| Param | Type | Description |
|
|
1609
|
-
| --- | --- | --- |
|
|
1610
|
-
| params | <code>object</code> | Params to search the documents |
|
|
1611
|
-
| params.query | <code>object</code> | Search documents query |
|
|
1612
|
-
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
1613
|
-
| session | <code>string</code> | Session, token JWT |
|
|
1614
|
-
|
|
1615
|
-
**Example**
|
|
1616
|
-
```js
|
|
1617
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1618
|
-
const api = new API();
|
|
1619
|
-
const params = {
|
|
1620
|
-
query: {p: 20, i: 1, s: 'Mais recentes', as: '', m: 'w', ai: '57e6a3bd6be6b45210833fae'},
|
|
1621
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
1622
|
-
};
|
|
1623
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1624
|
-
const retSearch = await api.user.document.searchDocuments(params, session);
|
|
1625
|
-
```
|
|
1626
|
-
<a name="Users"></a>
|
|
1627
|
-
|
|
1628
|
-
## Users
|
|
1629
|
-
API request, user permission level
|
|
1630
|
-
|
|
1631
|
-
**Kind**: global class
|
|
1632
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1633
|
-
|
|
1634
|
-
* [Users](#Users)
|
|
1635
|
-
* [new Users(options)](#new_Users_new)
|
|
1636
|
-
* [new Users(options)](#new_Users_new)
|
|
1637
|
-
|
|
1638
|
-
<a name="new_Users_new"></a>
|
|
1639
|
-
|
|
1640
|
-
### new Users(options)
|
|
1641
|
-
|
|
1642
|
-
| Param | Type | Description |
|
|
1643
|
-
| --- | --- | --- |
|
|
1644
|
-
| options | <code>object</code> | Params of the constructor |
|
|
1645
|
-
| options.parent | <code>object</code> | This of the pararent |
|
|
1646
|
-
|
|
1647
|
-
<a name="new_Users_new"></a>
|
|
1648
|
-
|
|
1649
|
-
### new Users(options)
|
|
1650
|
-
|
|
1651
|
-
| Param | Type | Description |
|
|
1652
|
-
| --- | --- | --- |
|
|
1653
|
-
| options | <code>object</code> | Params of the constructor |
|
|
1654
|
-
| options.parent | <code>object</code> | This of the pararent |
|
|
1655
|
-
|
|
1656
|
-
<a name="Notification"></a>
|
|
1657
|
-
|
|
1658
|
-
## Notification
|
|
1659
|
-
Class for user registration in a user
|
|
1660
|
-
|
|
1661
|
-
**Kind**: global class
|
|
1662
|
-
|
|
1663
|
-
* [Notification](#Notification)
|
|
1664
|
-
* [.tokenTypes](#Notification+tokenTypes) ⇒ <code>Object</code>
|
|
1665
|
-
* [.addToken(params, session)](#Notification+addToken) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1666
|
-
|
|
1667
|
-
<a name="Notification+tokenTypes"></a>
|
|
1668
|
-
|
|
1669
|
-
### notification.tokenTypes ⇒ <code>Object</code>
|
|
1670
|
-
Notification token types
|
|
1671
|
-
|
|
1672
|
-
**Kind**: instance property of [<code>Notification</code>](#Notification)
|
|
1673
|
-
<a name="Notification+addToken"></a>
|
|
1674
|
-
|
|
1675
|
-
### notification.addToken(params, session) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1676
|
-
Method to add a notification token
|
|
1677
|
-
|
|
1678
|
-
**Kind**: instance method of [<code>Notification</code>](#Notification)
|
|
1679
|
-
**Returns**: <code>promise.<object></code> - data<code>boolean</code> - data._id the id of the added token
|
|
1680
|
-
**Access**: public
|
|
1681
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1682
|
-
|
|
1683
|
-
| Param | Type | Description |
|
|
1684
|
-
| --- | --- | --- |
|
|
1685
|
-
| params | <code>object</code> | Params to add notification token |
|
|
1686
|
-
| params.token | <code>string</code> | The token |
|
|
1687
|
-
| params.type | <code>object</code> | The token type |
|
|
1688
|
-
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
1689
|
-
|
|
1690
|
-
**Example**
|
|
1691
|
-
```js
|
|
1692
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1693
|
-
const api = new API();
|
|
1694
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1695
|
-
const params = {
|
|
1696
|
-
token: 'V6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz2',
|
|
1697
|
-
type: 'FCM_WEB'
|
|
1698
|
-
};
|
|
1699
|
-
const retData = await api.user.notification.addToken(params, session);
|
|
1700
|
-
```
|
|
1701
|
-
<a name="Organization"></a>
|
|
1702
|
-
|
|
1703
|
-
## Organization
|
|
1704
|
-
Class for organizations, permission user
|
|
1705
|
-
|
|
1706
|
-
**Kind**: global class
|
|
1707
|
-
|
|
1708
|
-
* [Organization](#Organization)
|
|
1709
|
-
* [.upsertAvatar(params, session)](#Organization+upsertAvatar) ⇒ <code>Promise</code>
|
|
1710
|
-
* [.removeAvatar(session)](#Organization+removeAvatar) ⇒ <code>Promise</code>
|
|
1711
|
-
* [.findById(orgId, session)](#Organization+findById)
|
|
1712
|
-
* [.idCardExist(idcard, session)](#Organization+idCardExist)
|
|
1713
|
-
* [.upsertAvatar(params, session)](#Organization+upsertAvatar) ⇒ <code>Promise</code>
|
|
1714
|
-
* [.removeAvatar(session)](#Organization+removeAvatar) ⇒ <code>Promise</code>
|
|
1715
|
-
* [.callFetch(params)](#Organization+callFetch) ⇒ <code>promise</code>
|
|
1716
|
-
|
|
1717
|
-
<a name="Organization+upsertAvatar"></a>
|
|
1718
|
-
|
|
1719
|
-
### organization.upsertAvatar(params, session) ⇒ <code>Promise</code>
|
|
1720
|
-
Update avatar of organization by session of user not allow session user SU
|
|
1721
|
-
|
|
1722
|
-
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
1723
|
-
**Access**: public
|
|
1724
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1725
|
-
|
|
1726
|
-
| Param | Type | Description |
|
|
1727
|
-
| --- | --- | --- |
|
|
1728
|
-
| params | <code>object</code> | Params to update avatar |
|
|
1729
|
-
| params.orgId | <code>string</code> | Organization id |
|
|
1730
|
-
| params.avatar | <code>string</code> | Image in base64 to update |
|
|
1731
|
-
| params.type | <code>string</code> | MimeType (image/png) |
|
|
1732
|
-
| session | <code>string</code> | Is token JWT of user SU |
|
|
1733
|
-
|
|
1734
|
-
**Example**
|
|
1735
|
-
```js
|
|
1736
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1737
|
-
const api = new API();
|
|
1738
|
-
const params = {
|
|
1739
|
-
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
1740
|
-
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
1741
|
-
type: 'image/png',
|
|
1742
|
-
};
|
|
1743
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1744
|
-
await api.admin.organizations.upsertAvatar(params, session);
|
|
1745
|
-
```
|
|
1746
|
-
<a name="Organization+removeAvatar"></a>
|
|
1747
|
-
|
|
1748
|
-
### organization.removeAvatar(session) ⇒ <code>Promise</code>
|
|
1749
|
-
Remove avatar of user by session of user not allow session user SU
|
|
1750
|
-
|
|
1751
|
-
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
1752
|
-
**Access**: public
|
|
1753
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1754
|
-
|
|
1755
|
-
| Param | Type | Description |
|
|
1756
|
-
| --- | --- | --- |
|
|
1757
|
-
| params.orgId | <code>string</code> | Organization id |
|
|
1758
|
-
| session | <code>string</code> | Is token JWT of user SU |
|
|
1759
|
-
|
|
1760
|
-
**Example**
|
|
1761
|
-
```js
|
|
1762
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1763
|
-
const api = new API();
|
|
1764
|
-
const orgId = '5dadd01dc4af3941d42f8c5c';
|
|
1765
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1766
|
-
await api.admin.organizations.removeAvatar(orgId, session);
|
|
1767
|
-
```
|
|
1768
|
-
<a name="Organization+findById"></a>
|
|
1769
|
-
|
|
1770
|
-
### organization.findById(orgId, session)
|
|
1771
|
-
Find organization by id
|
|
1772
|
-
|
|
1773
|
-
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
1774
|
-
**Access**: public
|
|
1775
|
-
**Author**: Augusto Pissarra <abernardo.br@gmail.com>
|
|
1776
|
-
|
|
1777
|
-
| Param | Type | Description |
|
|
1778
|
-
| --- | --- | --- |
|
|
1779
|
-
| orgId | <code>string</code> | ID of the organization to find (_id database) |
|
|
1780
|
-
| session | <code>string</code> | Is token JWT |
|
|
1781
|
-
|
|
1782
|
-
**Example**
|
|
1783
|
-
```js
|
|
1784
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1785
|
-
const api = new API();
|
|
1786
|
-
const orgId = '80443245000122';
|
|
1787
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1788
|
-
await api.user.organization.findById(idCard, session);
|
|
1789
|
-
```
|
|
1790
|
-
<a name="Organization+idCardExist"></a>
|
|
1791
|
-
|
|
1792
|
-
### organization.idCardExist(idcard, session)
|
|
1793
|
-
Check if id card exist
|
|
1794
|
-
|
|
1795
|
-
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
1796
|
-
**Access**: public
|
|
1797
|
-
**Author**: Augusto Pissarra <abernardo.br@gmail.com>
|
|
1798
|
-
|
|
1799
|
-
| Param | Type | Description |
|
|
1800
|
-
| --- | --- | --- |
|
|
1801
|
-
| idcard | <code>string</code> | Check if id card exist |
|
|
1802
|
-
| session | <code>string</code> | Is token JWT |
|
|
1803
|
-
|
|
1804
|
-
**Example**
|
|
1805
|
-
```js
|
|
1806
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1807
|
-
const api = new API();
|
|
1808
|
-
const idCard = '80443245000122';
|
|
1809
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1810
|
-
await api.user.organization.idCardExist(idCard, session);
|
|
1811
|
-
```
|
|
1812
|
-
<a name="Organization+upsertAvatar"></a>
|
|
1813
|
-
|
|
1814
|
-
### organization.upsertAvatar(params, session) ⇒ <code>Promise</code>
|
|
1815
|
-
Update avatar of organization by session of user not allow session user SU
|
|
1816
|
-
|
|
1817
|
-
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
1818
|
-
**Access**: public
|
|
1819
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1820
|
-
|
|
1821
|
-
| Param | Type | Description |
|
|
1822
|
-
| --- | --- | --- |
|
|
1823
|
-
| params | <code>object</code> | Params to update avatar |
|
|
1824
|
-
| params.avatar | <code>string</code> | Image in base64 to update |
|
|
1825
|
-
| params.type | <code>string</code> | mimeType (image/png) |
|
|
1826
|
-
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
1827
|
-
|
|
1828
|
-
**Example**
|
|
1829
|
-
```js
|
|
1830
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1831
|
-
const api = new API();
|
|
1832
|
-
const params = {
|
|
1833
|
-
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
1834
|
-
type: 'image/png',
|
|
1835
|
-
};
|
|
1836
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1837
|
-
await api.user.profile.updateAvatar(params, session);
|
|
1838
|
-
```
|
|
1839
|
-
<a name="Organization+removeAvatar"></a>
|
|
1840
|
-
|
|
1841
|
-
### organization.removeAvatar(session) ⇒ <code>Promise</code>
|
|
1842
|
-
Remove avatar of user by session of user not allow session user SU
|
|
1843
|
-
|
|
1844
|
-
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
1845
|
-
**Access**: public
|
|
1846
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1847
|
-
|
|
1848
|
-
| Param | Type | Description |
|
|
1849
|
-
| --- | --- | --- |
|
|
1850
|
-
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
1851
|
-
|
|
1852
|
-
**Example**
|
|
1853
|
-
```js
|
|
1854
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1855
|
-
const api = new API();
|
|
1856
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1857
|
-
await api.user.profile.removeAvatar(session);
|
|
1858
|
-
```
|
|
1859
|
-
<a name="Organization+callFetch"></a>
|
|
1860
|
-
|
|
1861
|
-
### organization.callFetch(params) ⇒ <code>promise</code>
|
|
1862
|
-
Call URL internal, need auth JWT (session)
|
|
1863
|
-
|
|
1864
|
-
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
1865
|
-
**Access**: public
|
|
1866
|
-
**Author**: Thiago Anselmo <thiagoo.anselmoo@gmail.com>
|
|
1867
|
-
|
|
1868
|
-
| Param | Type | Default | Description |
|
|
1869
|
-
| --- | --- | --- | --- |
|
|
1870
|
-
| params | <code>object</code> | | Params to call fectch (URL internal) |
|
|
1871
|
-
| params.url | <code>string</code> | | URL to call |
|
|
1872
|
-
| [params.method] | <code>string</code> | <code>"POST"</code> | Fetch Method |
|
|
1873
|
-
| params.payload | <code>string</code> | | Payload to send system manager |
|
|
1874
|
-
|
|
1875
|
-
**Example**
|
|
1876
|
-
```js
|
|
1877
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1878
|
-
const api = new API();
|
|
1879
|
-
|
|
1880
|
-
const params = {
|
|
1881
|
-
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
1882
|
-
method: 'POST'
|
|
1883
|
-
}
|
|
1884
|
-
await api.user.organization.callFetchs(params, session);
|
|
1885
|
-
```
|
|
1886
|
-
<a name="Process"></a>
|
|
1887
|
-
|
|
1888
|
-
## Process
|
|
1889
|
-
Class for process, permission user
|
|
1890
|
-
|
|
1891
|
-
**Kind**: global class
|
|
1892
|
-
|
|
1893
|
-
* [Process](#Process)
|
|
1894
|
-
* [.start(params, session)](#Process+start) ⇒ <code>Promise</code>
|
|
1895
|
-
* [.getProcessProperties(params, session)](#Process+getProcessProperties) ⇒ <code>Promise</code>
|
|
1896
|
-
* [.getOrgProcessSearchInfo(params, session)](#Process+getOrgProcessSearchInfo) ⇒ <code>Promise</code> \| <code>string</code> \| <code>object</code> \| <code>object</code> \| <code>object</code> \| <code>string</code>
|
|
1897
|
-
|
|
1898
|
-
<a name="Process+start"></a>
|
|
1899
|
-
|
|
1900
|
-
### process.start(params, session) ⇒ <code>Promise</code>
|
|
1901
|
-
Start process
|
|
1902
|
-
|
|
1903
|
-
**Kind**: instance method of [<code>Process</code>](#Process)
|
|
1904
|
-
**Access**: public
|
|
1905
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1906
|
-
|
|
1907
|
-
| Param | Type | Default | Description |
|
|
1908
|
-
| --- | --- | --- | --- |
|
|
1909
|
-
| params | <code>object</code> | | Params to start process |
|
|
1910
|
-
| params.processId | <code>string</code> | | Process id (_id database); |
|
|
1911
|
-
| params.orgId | <code>string</code> | | Organization id (_id database); |
|
|
1912
|
-
| [params.payload] | <code>object</code> | <code>{}</code> | Start process with data |
|
|
1913
|
-
| session | <code>string</code> | | Session, token JWT |
|
|
1914
|
-
|
|
1915
|
-
**Example**
|
|
1916
|
-
```js
|
|
1917
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1918
|
-
const api = new API();
|
|
1919
|
-
const params = {
|
|
1920
|
-
processId: '5dadd01dc4af3941d42f8c5c',
|
|
1921
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
1922
|
-
payload: {}
|
|
1923
|
-
}
|
|
1924
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1925
|
-
await api.user.process.start(params, session);
|
|
1926
|
-
```
|
|
1927
|
-
<a name="Process+getProcessProperties"></a>
|
|
1928
|
-
|
|
1929
|
-
### process.getProcessProperties(params, session) ⇒ <code>Promise</code>
|
|
1930
|
-
Get process properties of process
|
|
1931
|
-
|
|
1932
|
-
**Kind**: instance method of [<code>Process</code>](#Process)
|
|
1933
|
-
**Access**: public
|
|
1934
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1935
|
-
|
|
1936
|
-
| Param | Type | Description |
|
|
1937
|
-
| --- | --- | --- |
|
|
1938
|
-
| params | <code>object</code> | Params to get process properties |
|
|
1939
|
-
| params.processId | <code>string</code> | Process id (_id database); |
|
|
1940
|
-
| params.orgId | <code>string</code> | Organization id (_id database); |
|
|
1941
|
-
| session | <code>string</code> | Session, token JWT |
|
|
1942
|
-
|
|
1943
|
-
**Example**
|
|
1944
|
-
```js
|
|
1945
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1946
|
-
const api = new API();
|
|
1947
|
-
const params = {
|
|
1948
|
-
processId: '5dadd01dc4af3941d42f8c5c',
|
|
1949
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
1950
|
-
}
|
|
1951
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1952
|
-
await api.user.process.getProcessProperties(params, session);
|
|
1953
|
-
```
|
|
1954
|
-
<a name="Process+getOrgProcessSearchInfo"></a>
|
|
1955
|
-
|
|
1956
|
-
### process.getOrgProcessSearchInfo(params, session) ⇒ <code>Promise</code> \| <code>string</code> \| <code>object</code> \| <code>object</code> \| <code>object</code> \| <code>string</code>
|
|
1957
|
-
Get the search info of a organization process
|
|
1958
|
-
|
|
1959
|
-
**Kind**: instance method of [<code>Process</code>](#Process)
|
|
1960
|
-
**Returns**: <code>Promise</code> - the search info result<code>string</code> - name the name of the organization process<code>object</code> - processIndexFields the list of fields to index<code>object</code> - processParticipantsGroup the permissions in this organization process<code>object</code> - stepsProperties the organization process steps properties<code>string</code> - _id the same organization id
|
|
1961
|
-
@
|
|
1962
|
-
**Access**: public
|
|
1963
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1964
|
-
|
|
1965
|
-
| Param | Type | Description |
|
|
1966
|
-
| --- | --- | --- |
|
|
1967
|
-
| params | <code>object</code> | Params to get search info |
|
|
1968
|
-
| params.orgProcessId | <code>string</code> | The id of an organization process (_id database); |
|
|
1969
|
-
| params.orgId | <code>string</code> | Organization id (_id database); |
|
|
1970
|
-
| session | <code>string</code> | Session, token JWT |
|
|
1971
|
-
|
|
1972
|
-
**Example**
|
|
1973
|
-
```js
|
|
1974
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1975
|
-
const api = new API();
|
|
1976
|
-
const params = {
|
|
1977
|
-
orgProcessId: '5dadd01dc4af3941d42f8c67',
|
|
1978
|
-
orgId: '5edd11c46b6ce9729c2c297c',
|
|
1979
|
-
}
|
|
1980
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1981
|
-
const retSearchInfo = await api.user.process.getOrgProcessSearchInfo(params, session);
|
|
1982
|
-
```
|
|
1983
|
-
<a name="Register"></a>
|
|
1984
|
-
|
|
1985
|
-
## Register
|
|
1986
|
-
Class for user registration in a user
|
|
1987
|
-
|
|
1988
|
-
**Kind**: global class
|
|
1989
|
-
|
|
1990
|
-
* [Register](#Register)
|
|
1991
|
-
* [.getOrgname()](#Register+getOrgname) ⇒ <code>string</code>
|
|
1992
|
-
* [.validateEmail(params)](#Register+validateEmail) ⇒ <code>promise.<object></code> \| <code>boolean</code> \| <code>boolean</code> \| <code>string</code> \| <code>object</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>object</code> \| <code>string</code> \| <code>string</code>
|
|
1993
|
-
* [.execute(params)](#Register+execute) ⇒ <code>promise.<object></code> \| <code>boolean</code> \| <code>boolean</code> \| <code>object</code> \| <code>string</code>
|
|
1994
|
-
|
|
1995
|
-
<a name="Register+getOrgname"></a>
|
|
1996
|
-
|
|
1997
|
-
### register.getOrgname() ⇒ <code>string</code>
|
|
1998
|
-
**Kind**: instance method of [<code>Register</code>](#Register)
|
|
1999
|
-
**Returns**: <code>string</code> - orgname The orgname of the organization in the registerId
|
|
2000
|
-
**Access**: public
|
|
2001
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2002
|
-
|
|
2003
|
-
| Param | Type | Description |
|
|
2004
|
-
| --- | --- | --- |
|
|
2005
|
-
| params.registerId | <code>object</code> | The registerId that comes with the registration page context |
|
|
2006
|
-
|
|
2007
|
-
**Example**
|
|
2008
|
-
```js
|
|
2009
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2010
|
-
const api = new API();
|
|
2011
|
-
const params = {
|
|
2012
|
-
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...'
|
|
2013
|
-
};
|
|
2014
|
-
const orgname = await api.user.register.getOrgname(params);
|
|
2015
|
-
```
|
|
2016
|
-
<a name="Register+validateEmail"></a>
|
|
2017
|
-
|
|
2018
|
-
### register.validateEmail(params) ⇒ <code>promise.<object></code> \| <code>boolean</code> \| <code>boolean</code> \| <code>string</code> \| <code>object</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>object</code> \| <code>string</code> \| <code>string</code>
|
|
2019
|
-
Method to find task by id
|
|
2020
|
-
|
|
2021
|
-
**Kind**: instance method of [<code>Register</code>](#Register)
|
|
2022
|
-
**Returns**: <code>promise.<object></code> - data<code>boolean</code> - data.success If the operation was successfully done (true|false)<code>boolean</code> - data.userAlreadyExists If the user already exists (true|false), if true, then the other information is not returned<code>string</code> - data.registrationEmailInfoRaw The fully cryptographed registration information<code>object</code> - data.registrationEmailInfo The registration information<code>string</code> - data.registrationEmailInfo.orgname The orgname<code>string</code> - data.registrationEmailInfo.orgId The orgId of the organization<code>string</code> - data.registrationEmailInfo.guid The unique id for the registration<code>object</code> - data.registrationEmailInfo.emailValidation The email validation information<code>string</code> - data.registrationEmailInfo.emailValidation.email The email that the code was sent to<code>string</code> - data.registrationEmailInfo.emailValidation.code The 4 digit code to validate the email
|
|
2023
|
-
**Access**: public
|
|
2024
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2025
|
-
|
|
2026
|
-
| Param | Type | Description |
|
|
2027
|
-
| --- | --- | --- |
|
|
2028
|
-
| params | <code>object</code> | Params to get task |
|
|
2029
|
-
| params.registerId | <code>string</code> | The registerId that comes with the registration page context |
|
|
2030
|
-
| params.email | <code>object</code> | The email to validate |
|
|
2031
|
-
|
|
2032
|
-
**Example**
|
|
2033
|
-
```js
|
|
2034
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2035
|
-
const api = new API();
|
|
2036
|
-
const params = {
|
|
2037
|
-
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2038
|
-
email: 'myemail@company.com'
|
|
2039
|
-
};
|
|
2040
|
-
const retData = await api.user.register.validateEmail(params);
|
|
2041
|
-
```
|
|
2042
|
-
<a name="Register+execute"></a>
|
|
2043
|
-
|
|
2044
|
-
### register.execute(params) ⇒ <code>promise.<object></code> \| <code>boolean</code> \| <code>boolean</code> \| <code>object</code> \| <code>string</code>
|
|
2045
|
-
Method to register a user
|
|
2046
|
-
|
|
2047
|
-
**Kind**: instance method of [<code>Register</code>](#Register)
|
|
2048
|
-
**Returns**: <code>promise.<object></code> - data<code>boolean</code> - data.success If the operation was successfully done (true|false)<code>boolean</code> - data.userAlreadyExists If the user already exists (true|false), if true, then the other information is not returned<code>object</code> - auth The full authentication data with session, if login is true.<code>string</code> - auth.redirectUrl The url to redirect.
|
|
2049
|
-
**Access**: public
|
|
2050
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2051
|
-
|
|
2052
|
-
| Param | Type | Default | Description |
|
|
2053
|
-
| --- | --- | --- | --- |
|
|
2054
|
-
| params | <code>object</code> | | Params to get task |
|
|
2055
|
-
| params.registerId | <code>string</code> | | The registerId that comes with the registration page context |
|
|
2056
|
-
| params.type | <code>string</code> | <code>"sign"</code> | The type of the registration. By defailt, |
|
|
2057
|
-
| params.login | <code>boolean</code> | <code>false</code> | If we want to login the user directly after registering the user successfully. If you have a redirect, the best option is to login automatically. |
|
|
2058
|
-
| params.emailInfo | <code>object</code> | | The information for the email validation |
|
|
2059
|
-
| params.emailInfo.email | <code>string</code> | | The email validation information |
|
|
2060
|
-
| params.emailInfo.code | <code>string</code> | | The 4 digit code to validate the email |
|
|
2061
|
-
| params.registerData | <code>object</code> | | The registration data |
|
|
2062
|
-
| params.registerData.name | <code>string</code> | | The name if the user |
|
|
2063
|
-
| params.registerData.registerEmail | <code>string</code> | | The email of the user |
|
|
2064
|
-
| params.registerData.phone | <code>string</code> | | The phone of the user |
|
|
2065
|
-
| params.registerData.idcard | <code>string</code> | | The ID card of the user |
|
|
2066
|
-
| params.registerData.registerPassword | <code>string</code> | | The user password in open text |
|
|
2067
|
-
| params.registerData.emailValidationCode | <code>string</code> | | The code used to validate the email |
|
|
2068
|
-
| params.registerData.phoneValidationCode | <code>string</code> | | The code used to validate the phone |
|
|
2069
|
-
| params.registerData.language | <code>string</code> | | The defaulf navigator language (i.e.: navigator.language) |
|
|
2070
|
-
| params.registerData.timezone | <code>string</code> | | The defaulf navigator timezone (i.e.: Intl.DateTimeFormat().resolvedOptions().timeZone) |
|
|
2071
|
-
|
|
2072
|
-
**Example**
|
|
2073
|
-
```js
|
|
2074
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2075
|
-
const api = new API();
|
|
2076
|
-
const params ={
|
|
2077
|
-
"registerId": 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2078
|
-
"type": 'sign',
|
|
2079
|
-
"login": false,
|
|
2080
|
-
"emailInfo": {
|
|
2081
|
-
"code": "5974",
|
|
2082
|
-
"email": "cbtoto_1@mailinator.com"
|
|
2083
|
-
},
|
|
2084
|
-
"registerData": {
|
|
2085
|
-
"name": "Augusto Totlo",
|
|
2086
|
-
"registerEmail": "cbtoto_1@mailinator.com",
|
|
2087
|
-
"phone": "",
|
|
2088
|
-
"idcard": "",
|
|
2089
|
-
"dob": "1978-01-12T03:00:00.000Z",
|
|
2090
|
-
"registerPassword": "123456",
|
|
2091
|
-
"emailValidationCode": "5974",
|
|
2092
|
-
"phoneValidationCode": "",
|
|
2093
|
-
"language": "en-US",
|
|
2094
|
-
"timezone": "Europe/Dublin"
|
|
2095
|
-
}
|
|
2096
|
-
};
|
|
2097
|
-
const retData = await api.user.register.execute(params);
|
|
2098
|
-
```
|
|
2099
|
-
<a name="Task"></a>
|
|
2100
|
-
|
|
2101
|
-
## Task
|
|
2102
|
-
Class for task, permission user
|
|
2103
|
-
|
|
2104
|
-
**Kind**: global class
|
|
2105
|
-
|
|
2106
|
-
* [Task](#Task)
|
|
2107
|
-
* [.findById(params, session)](#Task+findById) ⇒ <code>promise</code>
|
|
2108
|
-
* [.findByIdAndUpdate(params, session)](#Task+findByIdAndUpdate) ⇒ <code>Promise</code>
|
|
2109
|
-
* [.executeActionFinalize(params, session)](#Task+executeActionFinalize) ⇒ <code>Promise</code>
|
|
2110
|
-
|
|
2111
|
-
<a name="Task+findById"></a>
|
|
2112
|
-
|
|
2113
|
-
### task.findById(params, session) ⇒ <code>promise</code>
|
|
2114
|
-
Method to find task by id
|
|
2115
|
-
|
|
2116
|
-
**Kind**: instance method of [<code>Task</code>](#Task)
|
|
2117
|
-
**Access**: public
|
|
2118
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2119
|
-
|
|
2120
|
-
| Param | Type | Description |
|
|
2121
|
-
| --- | --- | --- |
|
|
2122
|
-
| params | <code>object</code> | Params to get task |
|
|
2123
|
-
| params.processId | <code>object</code> | Proccess id (_id database) |
|
|
2124
|
-
| params.taskId | <code>object</code> | Task id (_id database) |
|
|
2125
|
-
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
2126
|
-
| session | <code>string</code> | Session, token JWT |
|
|
2127
|
-
|
|
2128
|
-
**Example**
|
|
2129
|
-
```js
|
|
2130
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2131
|
-
const api = new API();
|
|
2132
|
-
const params = {
|
|
2133
|
-
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2134
|
-
taskId: '5df7f19618430c89a41a19d2',
|
|
2135
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2136
|
-
};
|
|
2137
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2138
|
-
await api.user.task.findById(params, session);
|
|
2139
|
-
```
|
|
2140
|
-
<a name="Task+findByIdAndUpdate"></a>
|
|
2141
|
-
|
|
2142
|
-
### task.findByIdAndUpdate(params, session) ⇒ <code>Promise</code>
|
|
2143
|
-
Find task by id and update
|
|
2144
|
-
|
|
2145
|
-
**Kind**: instance method of [<code>Task</code>](#Task)
|
|
2146
|
-
**Access**: public
|
|
2147
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2148
|
-
|
|
2149
|
-
| Param | Type | Description |
|
|
2150
|
-
| --- | --- | --- |
|
|
2151
|
-
| params | <code>object</code> | Params to update task |
|
|
2152
|
-
| params.userId | <code>object</code> | User id (_id database) |
|
|
2153
|
-
| params.processId | <code>string</code> | Proccess id (_id database) |
|
|
2154
|
-
| params.taskId | <code>string</code> | Task id (_id database) |
|
|
2155
|
-
| params.flowName | <code>string</code> | Flow name |
|
|
2156
|
-
| params.action | <code>string</code> | Button action |
|
|
2157
|
-
| params.formData | <code>object</code> | Data to update task |
|
|
2158
|
-
| [params.actionGuid] | <code>string</code> | GUID of the action |
|
|
2159
|
-
| params.orgId | <code>string</code> | Organization id (_id database) |
|
|
2160
|
-
| session | <code>string</code> | Session, token JWT |
|
|
2161
|
-
|
|
2162
|
-
**Example**
|
|
2163
|
-
```js
|
|
2164
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2165
|
-
const api = new API();
|
|
2166
|
-
const params = {
|
|
2167
|
-
userId: '5739d4c6ccb0ebc61f2a9557',
|
|
2168
|
-
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2169
|
-
taskId: '5df7f19618430c89a41a19d2',
|
|
2170
|
-
action: 1,
|
|
2171
|
-
formData: {name: 'CloudBrasil'},
|
|
2172
|
-
};
|
|
2173
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2174
|
-
await api.user.task.findByIdAndUpdate(params, session);
|
|
2175
|
-
```
|
|
2176
|
-
<a name="Task+executeActionFinalize"></a>
|
|
2177
|
-
|
|
2178
|
-
### task.executeActionFinalize(params, session) ⇒ <code>Promise</code>
|
|
2179
|
-
Find task by id and update
|
|
2180
|
-
|
|
2181
|
-
**Kind**: instance method of [<code>Task</code>](#Task)
|
|
2182
|
-
**Access**: public
|
|
2183
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2184
|
-
|
|
2185
|
-
| Param | Type | Default | Description |
|
|
2186
|
-
| --- | --- | --- | --- |
|
|
2187
|
-
| params | <code>object</code> | | Params - to update task |
|
|
2188
|
-
| params.taskId | <code>string</code> | | Task id (_id database) |
|
|
2189
|
-
| params.actionGuid | <code>string</code> | | GUID of the action |
|
|
2190
|
-
| params.orgId | <code>string</code> | | Organization id (_id database) |
|
|
2191
|
-
| params.payload | <code>any</code> | <code>{}</code> | Payload to send in action |
|
|
2192
|
-
| session | <code>string</code> | | Session, token JWT |
|
|
2193
|
-
|
|
2194
|
-
**Example**
|
|
2195
|
-
```js
|
|
2196
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2197
|
-
const api = new API();
|
|
2198
|
-
const params = {
|
|
2199
|
-
taskId: '5df7f19618430c89a41a19d2',
|
|
2200
|
-
actionGuid: 'b3823a2ae52c7a05bfb9590fe427038d'
|
|
2201
|
-
orgId: '5df7f19618430c89a41a1bc3',
|
|
2202
|
-
payload: {}',
|
|
2203
|
-
};
|
|
2204
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2205
|
-
await api.user.task.executeActionFinalize(params, session);
|
|
2206
|
-
```
|
|
2207
|
-
<a name="TaskAvailable"></a>
|
|
2208
|
-
|
|
2209
|
-
## TaskAvailable
|
|
2210
|
-
Class for available tasks, permission user
|
|
2211
|
-
|
|
2212
|
-
**Kind**: global class
|
|
2213
|
-
|
|
2214
|
-
* [TaskAvailable](#TaskAvailable)
|
|
2215
|
-
* [.find(params, session)](#TaskAvailable+find) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
2216
|
-
* [.claim(params, session)](#TaskAvailable+claim) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2217
|
-
|
|
2218
|
-
<a name="TaskAvailable+find"></a>
|
|
2219
|
-
|
|
2220
|
-
### taskAvailable.find(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
2221
|
-
Method to find available tasks for a user
|
|
2222
|
-
|
|
2223
|
-
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
2224
|
-
**Returns**: <code>promise</code> - returned data from the search<code>number</code> - count the count of items searched<code>array.<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
|
|
2225
|
-
**Access**: public
|
|
2226
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2227
|
-
|
|
2228
|
-
| Param | Type | Description |
|
|
2229
|
-
| --- | --- | --- |
|
|
2230
|
-
| params | <code>object</code> | Params to get task |
|
|
2231
|
-
| params.query | <code>object</code> | Search process query |
|
|
2232
|
-
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
2233
|
-
| session | <code>string</code> | Session, token JWT |
|
|
2234
|
-
|
|
2235
|
-
**Example**
|
|
2236
|
-
```js
|
|
2237
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2238
|
-
const api = new API();
|
|
2239
|
-
const params = {
|
|
2240
|
-
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2241
|
-
orgId: '55e4a3bd6be6b45210833fae',
|
|
2242
|
-
};
|
|
2243
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2244
|
-
const retSearch = await api.user.task.available.find(params, session);
|
|
2245
|
-
```
|
|
2246
|
-
<a name="TaskAvailable+claim"></a>
|
|
2247
|
-
|
|
2248
|
-
### taskAvailable.claim(params, session) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2249
|
-
Method for a user to claim an available task
|
|
2250
|
-
|
|
2251
|
-
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
2252
|
-
**Returns**: <code>promise</code> - returned data from the method call<code>boolean</code> - success true|false if the method was successful
|
|
2253
|
-
**Access**: public
|
|
2254
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2255
|
-
|
|
2256
|
-
| Param | Type | Description |
|
|
2257
|
-
| --- | --- | --- |
|
|
2258
|
-
| params | <code>object</code> | Params to get task |
|
|
2259
|
-
| params.taskId | <code>object</code> | the task id to claim |
|
|
2260
|
-
| params.orgname | <code>object</code> | Organization slug (short name of the orgnization) |
|
|
2261
|
-
| session | <code>string</code> | Session, token JWT |
|
|
2262
|
-
|
|
2263
|
-
**Example**
|
|
2264
|
-
```js
|
|
2265
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2266
|
-
const api = new API();
|
|
2267
|
-
const params = {
|
|
2268
|
-
taskId: '55e4a3bd6be6b45210833f67',
|
|
2269
|
-
orgname: 'acme',
|
|
2270
|
-
};
|
|
2271
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2272
|
-
const success = await api.user.task.available.claim(params, session);
|
|
2273
|
-
```
|
|
2274
|
-
<a name="User"></a>
|
|
2275
|
-
|
|
2276
|
-
## User
|
|
2277
|
-
Class for user, permission user
|
|
2278
|
-
|
|
2279
|
-
**Kind**: global class
|
|
2280
|
-
|
|
2281
|
-
* [User](#User)
|
|
2282
|
-
* [.updateAvatar(params, session)](#User+updateAvatar) ⇒ <code>Promise</code>
|
|
2283
|
-
* [.removeAvatar(session)](#User+removeAvatar) ⇒ <code>Promise</code>
|
|
2284
|
-
* [.removeSignature(session)](#User+removeSignature) ⇒ <code>Promise</code>
|
|
2285
|
-
* [.saveSignature(data, session)](#User+saveSignature) ⇒ <code>Promise</code>
|
|
2286
|
-
* [.findByIdAndUpdate(params, session)](#User+findByIdAndUpdate) ⇒ <code>Promise.<void></code>
|
|
2287
|
-
* [.changeOrganization(id, session)](#User+changeOrganization) ⇒ <code>Promise</code>
|
|
2288
|
-
|
|
2289
|
-
<a name="User+updateAvatar"></a>
|
|
2290
|
-
|
|
2291
|
-
### user.updateAvatar(params, session) ⇒ <code>Promise</code>
|
|
2292
|
-
Update avatar of user by session of user not allow session user SU
|
|
2293
|
-
|
|
2294
|
-
**Kind**: instance method of [<code>User</code>](#User)
|
|
2295
|
-
**Access**: public
|
|
2296
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2297
|
-
|
|
2298
|
-
| Param | Type | Description |
|
|
2299
|
-
| --- | --- | --- |
|
|
2300
|
-
| params | <code>object</code> | Params to update avatar |
|
|
2301
|
-
| params.avatar | <code>string</code> | Image in base64 to update |
|
|
2302
|
-
| params.type | <code>string</code> | mimeType (image/png) |
|
|
2303
|
-
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
2304
|
-
|
|
2305
|
-
**Example**
|
|
2306
|
-
```js
|
|
2307
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2308
|
-
const api = new API();
|
|
2309
|
-
const params = {
|
|
2310
|
-
avatar: '55e4a3bd6be6b45210833fae',
|
|
2311
|
-
type: '123456',
|
|
2312
|
-
};
|
|
2313
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2314
|
-
await api.user.profile.updateAvatar(params, session);
|
|
2315
|
-
```
|
|
2316
|
-
<a name="User+removeAvatar"></a>
|
|
2317
|
-
|
|
2318
|
-
### user.removeAvatar(session) ⇒ <code>Promise</code>
|
|
2319
|
-
Remove avatar of user by session of user not allow session user SU
|
|
2320
|
-
|
|
2321
|
-
**Kind**: instance method of [<code>User</code>](#User)
|
|
2322
|
-
**Access**: public
|
|
2323
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2324
|
-
|
|
2325
|
-
| Param | Type | Description |
|
|
2326
|
-
| --- | --- | --- |
|
|
2327
|
-
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
2328
|
-
|
|
2329
|
-
**Example**
|
|
2330
|
-
```js
|
|
2331
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2332
|
-
const api = new API();
|
|
2333
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2334
|
-
await api.user.profile.removeAvatar(session);
|
|
2335
|
-
```
|
|
2336
|
-
<a name="User+removeSignature"></a>
|
|
2337
|
-
|
|
2338
|
-
### user.removeSignature(session) ⇒ <code>Promise</code>
|
|
2339
|
-
Remove the signature of user by session
|
|
2340
|
-
|
|
2341
|
-
**Kind**: instance method of [<code>User</code>](#User)
|
|
2342
|
-
**Access**: public
|
|
2343
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2344
|
-
|
|
2345
|
-
| Param | Type | Description |
|
|
2346
|
-
| --- | --- | --- |
|
|
2347
|
-
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
2348
|
-
|
|
2349
|
-
**Example**
|
|
2350
|
-
```js
|
|
2351
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2352
|
-
const api = new API();
|
|
2353
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2354
|
-
await api.user.profile.removeSignature(session);
|
|
2355
|
-
```
|
|
2356
|
-
<a name="User+saveSignature"></a>
|
|
2357
|
-
|
|
2358
|
-
### user.saveSignature(data, session) ⇒ <code>Promise</code>
|
|
2359
|
-
Sava a new signature of user by session
|
|
2360
|
-
|
|
2361
|
-
**Kind**: instance method of [<code>User</code>](#User)
|
|
2362
|
-
**Access**: public
|
|
2363
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2364
|
-
|
|
2365
|
-
| Param | Type | Description |
|
|
2366
|
-
| --- | --- | --- |
|
|
2367
|
-
| data | <code>object</code> | The signature data to save |
|
|
2368
|
-
| data.type | <code>string</code> | CURSIVE or HANDWRITE |
|
|
2369
|
-
| data.file | <code>string</code> | CURSIVE the <fontname>:<name used on the signature> HANDWRITE the base 64 image (w/o the mime a base prefix) |
|
|
2370
|
-
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
2371
|
-
|
|
2372
|
-
**Example**
|
|
2373
|
-
```js
|
|
2374
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2375
|
-
const api = new API();
|
|
2376
|
-
const data = {
|
|
2377
|
-
type: 'CURSIVE',
|
|
2378
|
-
file: 'allura:Mary John Heart'
|
|
2379
|
-
};
|
|
2380
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2381
|
-
await api.user.profile.saveSignature(data, session);
|
|
2382
|
-
|
|
2383
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2384
|
-
const api = new API();
|
|
2385
|
-
const data = {
|
|
2386
|
-
type: 'HANDWRITE',
|
|
2387
|
-
file: 'iVBORw0KGgoAAAANSUhEUgAAAj...'
|
|
2388
|
-
};
|
|
2389
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2390
|
-
await api.user.profile.saveSignature(session);
|
|
2391
|
-
```
|
|
2392
|
-
<a name="User+findByIdAndUpdate"></a>
|
|
2393
|
-
|
|
2394
|
-
### user.findByIdAndUpdate(params, session) ⇒ <code>Promise.<void></code>
|
|
2395
|
-
Update a user profile by id
|
|
2396
|
-
|
|
2397
|
-
**Kind**: instance method of [<code>User</code>](#User)
|
|
2398
|
-
**Access**: public
|
|
2399
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2400
|
-
|
|
2401
|
-
| Param | Type | Description |
|
|
2402
|
-
| --- | --- | --- |
|
|
2403
|
-
| params | <code>object</code> | Params to update task |
|
|
2404
|
-
| params.name | <code>string</code> | The name of the user |
|
|
2405
|
-
| params.site | <code>string</code> | The site of the user |
|
|
2406
|
-
| params.faceboook | <code>string</code> | The faceboook of the user |
|
|
2407
|
-
| params.linkedin | <code>string</code> | The linkedin of the user |
|
|
2408
|
-
| params.dob | <code>date</code> | The date of birth of the user |
|
|
2409
|
-
| params.gender | <code>number.<UserGender></code> | The gender of of the user self.gender |
|
|
2410
|
-
| params.phone | <code>string</code> | The phone |
|
|
2411
|
-
| params.phone2 | <code>string</code> | The phone 2 |
|
|
2412
|
-
| params.phone3 | <code>string</code> | The phone 3 |
|
|
2413
|
-
| params.password | <code>string</code> | The password to change |
|
|
2414
|
-
| params.secQuestion | <code>string</code> | The security question |
|
|
2415
|
-
| params.secAnswer | <code>string</code> | The security answer |
|
|
2416
|
-
| params.timezone | <code>string</code> | The timezone |
|
|
2417
|
-
| params.userLanguage | <code>string</code> | The user language |
|
|
2418
|
-
| params.changePassword | <code>string</code> | (required) If we need to change the status and we changed the password |
|
|
2419
|
-
| params.acceptTermsOfUse | <code>string</code> | If the user has accepted the terms of change |
|
|
2420
|
-
| session | <code>string</code> | Session, token JWT |
|
|
2421
|
-
|
|
2422
|
-
**Example**
|
|
2423
|
-
```js
|
|
2424
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2425
|
-
const api = new API();
|
|
2426
|
-
const params = {
|
|
2427
|
-
name: 'New Name'
|
|
2428
|
-
};
|
|
2429
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2430
|
-
await api.user.profile.findByIdAndUpdate(params, session);
|
|
2431
|
-
```
|
|
2432
|
-
<a name="User+changeOrganization"></a>
|
|
2433
|
-
|
|
2434
|
-
### user.changeOrganization(id, session) ⇒ <code>Promise</code>
|
|
2435
|
-
Change a user's organization
|
|
2436
|
-
|
|
2437
|
-
**Kind**: instance method of [<code>User</code>](#User)
|
|
2438
|
-
**Access**: public
|
|
2439
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2440
|
-
|
|
2441
|
-
| Param | Type | Description |
|
|
2442
|
-
| --- | --- | --- |
|
|
2443
|
-
| id | <code>string</code> | Organization id |
|
|
2444
|
-
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
2445
|
-
|
|
2446
|
-
**Example**
|
|
2447
|
-
```js
|
|
2448
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2449
|
-
const api = new API();
|
|
2450
|
-
const id = '616eccaaa9360a05293b10fe';
|
|
2451
|
-
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2452
|
-
await api.user.changeOrganization.updateAvatar(id, session);
|
|
2453
|
-
```
|
|
1
|
+
## Classes
|
|
2
|
+
|
|
3
|
+
<dl>
|
|
4
|
+
<dt><a href="#AdminDocuments">AdminDocuments</a></dt>
|
|
5
|
+
<dd><p>Admin Class for documents, permission admin</p>
|
|
6
|
+
</dd>
|
|
7
|
+
<dt><a href="#AdminForm">AdminForm</a></dt>
|
|
8
|
+
<dd><p>Admin Class for forms, permission admin</p>
|
|
9
|
+
</dd>
|
|
10
|
+
<dt><a href="#Admin">Admin</a></dt>
|
|
11
|
+
<dd><p>API request, admin permission level</p>
|
|
12
|
+
</dd>
|
|
13
|
+
<dt><a href="#AdminLists">AdminLists</a></dt>
|
|
14
|
+
<dd><p>Admin Class for lists, permission admin</p>
|
|
15
|
+
</dd>
|
|
16
|
+
<dt><a href="#AdminMessage">AdminMessage</a></dt>
|
|
17
|
+
<dd><p>Admin Class for user, permission admin</p>
|
|
18
|
+
</dd>
|
|
19
|
+
<dt><a href="#AdminNotification">AdminNotification</a></dt>
|
|
20
|
+
<dd><p>Admin Class for notification, permission admin</p>
|
|
21
|
+
</dd>
|
|
22
|
+
<dt><a href="#Organization">Organization</a></dt>
|
|
23
|
+
<dd><p>Class for organizations, permission user</p>
|
|
24
|
+
</dd>
|
|
25
|
+
<dt><a href="#AdminPlugin">AdminPlugin</a></dt>
|
|
26
|
+
<dd><p>Admin Class for plugin, permission admin</p>
|
|
27
|
+
</dd>
|
|
28
|
+
<dt><a href="#AdminPolicy">AdminPolicy</a></dt>
|
|
29
|
+
<dd><p>Admin Class for policy, permission admin</p>
|
|
30
|
+
</dd>
|
|
31
|
+
<dt><a href="#AdminProcesses">AdminProcesses</a></dt>
|
|
32
|
+
<dd><p>Admin Class for processes, permission admin</p>
|
|
33
|
+
</dd>
|
|
34
|
+
<dt><a href="#AdminTask">AdminTask</a></dt>
|
|
35
|
+
<dd><p>Admin Class for task, permission admin</p>
|
|
36
|
+
</dd>
|
|
37
|
+
<dt><a href="#AdminUser">AdminUser</a></dt>
|
|
38
|
+
<dd><p>Admin Class for user, permission admin</p>
|
|
39
|
+
</dd>
|
|
40
|
+
<dt><a href="#GeoLocation">GeoLocation</a></dt>
|
|
41
|
+
<dd><p>General Class for user, permission organization</p>
|
|
42
|
+
</dd>
|
|
43
|
+
<dt><a href="#Users">Users</a></dt>
|
|
44
|
+
<dd><p>API request, user permission level</p>
|
|
45
|
+
</dd>
|
|
46
|
+
<dt><a href="#Datasource">Datasource</a></dt>
|
|
47
|
+
<dd><p>Class for user datasource access, to be used with when creating new documents</p>
|
|
48
|
+
</dd>
|
|
49
|
+
<dt><a href="#Documents">Documents</a></dt>
|
|
50
|
+
<dd><p>Class for documents, permission user</p>
|
|
51
|
+
</dd>
|
|
52
|
+
<dt><a href="#Users">Users</a></dt>
|
|
53
|
+
<dd><p>API request, user permission level</p>
|
|
54
|
+
</dd>
|
|
55
|
+
<dt><a href="#Notification">Notification</a></dt>
|
|
56
|
+
<dd><p>Class for user registration in a user</p>
|
|
57
|
+
</dd>
|
|
58
|
+
<dt><a href="#Organization">Organization</a></dt>
|
|
59
|
+
<dd><p>Class for organizations, permission user</p>
|
|
60
|
+
</dd>
|
|
61
|
+
<dt><a href="#Process">Process</a></dt>
|
|
62
|
+
<dd><p>Class for process, permission user</p>
|
|
63
|
+
</dd>
|
|
64
|
+
<dt><a href="#Register">Register</a></dt>
|
|
65
|
+
<dd><p>Class for user registration in a user</p>
|
|
66
|
+
</dd>
|
|
67
|
+
<dt><a href="#Task">Task</a></dt>
|
|
68
|
+
<dd><p>Class for task, permission user</p>
|
|
69
|
+
</dd>
|
|
70
|
+
<dt><a href="#TaskAvailable">TaskAvailable</a></dt>
|
|
71
|
+
<dd><p>Class for available tasks, permission user</p>
|
|
72
|
+
</dd>
|
|
73
|
+
<dt><a href="#User">User</a></dt>
|
|
74
|
+
<dd><p>Class for user, permission user</p>
|
|
75
|
+
</dd>
|
|
76
|
+
</dl>
|
|
77
|
+
|
|
78
|
+
<a name="AdminDocuments"></a>
|
|
79
|
+
|
|
80
|
+
## AdminDocuments
|
|
81
|
+
Admin Class for documents, permission admin
|
|
82
|
+
|
|
83
|
+
**Kind**: global class
|
|
84
|
+
|
|
85
|
+
* [AdminDocuments](#AdminDocuments)
|
|
86
|
+
* [.advancedSearch(params, session)](#AdminDocuments+advancedSearch) ⇒ <code>Promise</code>
|
|
87
|
+
* [.findById(params, session)](#AdminDocuments+findById) ⇒ <code>Promise</code>
|
|
88
|
+
* [.signedUrl(params, apiKey)](#AdminDocuments+signedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
89
|
+
* [.updateContent(params, apiKey)](#AdminDocuments+updateContent) ⇒ <code>Promise.<object></code>
|
|
90
|
+
* [.updateAI(params, apiKey)](#AdminDocuments+updateAI) ⇒ <code>Promise.<object></code>
|
|
91
|
+
* [.getContent(params, apiKey)](#AdminDocuments+getContent) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>number</code>
|
|
92
|
+
|
|
93
|
+
<a name="AdminDocuments+advancedSearch"></a>
|
|
94
|
+
|
|
95
|
+
### adminDocuments.advancedSearch(params, session) ⇒ <code>Promise</code>
|
|
96
|
+
Advanced search of document in elastic search ussing system manager
|
|
97
|
+
|
|
98
|
+
**Kind**: instance method of [<code>AdminDocuments</code>](#AdminDocuments)
|
|
99
|
+
**Access**: public
|
|
100
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
101
|
+
|
|
102
|
+
| Param | Type | Description |
|
|
103
|
+
| --- | --- | --- |
|
|
104
|
+
| params | <code>object</code> | Params to search document |
|
|
105
|
+
| params.docId | <code>string</code> | Document id (_id database) |
|
|
106
|
+
| params.query | <code>object</code> | Query to search in elastic search |
|
|
107
|
+
| session | <code>string</code> | Session, token JWT |
|
|
108
|
+
|
|
109
|
+
**Example**
|
|
110
|
+
```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);
|
|
138
|
+
```
|
|
139
|
+
<a name="AdminDocuments+findById"></a>
|
|
140
|
+
|
|
141
|
+
### adminDocuments.findById(params, session) ⇒ <code>Promise</code>
|
|
142
|
+
Get document by id
|
|
143
|
+
|
|
144
|
+
**Kind**: instance method of [<code>AdminDocuments</code>](#AdminDocuments)
|
|
145
|
+
**Access**: public
|
|
146
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
147
|
+
|
|
148
|
+
| Param | Type | Description |
|
|
149
|
+
| --- | --- | --- |
|
|
150
|
+
| params | <code>object</code> | Params to get document by id |
|
|
151
|
+
| params.docId | <code>string</code> | Document id (_id database) |
|
|
152
|
+
| params.orgId | <code>string</code> | Organization id (_id database) |
|
|
153
|
+
| session | <code>string</code> | Session, token JWT |
|
|
154
|
+
|
|
155
|
+
**Example**
|
|
156
|
+
```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);
|
|
165
|
+
```
|
|
166
|
+
<a name="AdminDocuments+signedUrl"></a>
|
|
167
|
+
|
|
168
|
+
### adminDocuments.signedUrl(params, apiKey) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
169
|
+
Request signed url url to put or get
|
|
170
|
+
|
|
171
|
+
**Kind**: instance method of [<code>AdminDocuments</code>](#AdminDocuments)
|
|
172
|
+
**Returns**: <code>Promise.<object></code> - doc Returned document data with the signed url<code>string</code> - doc.docId Document id<code>string</code> - doc.name The name of the document, which is the fileName<code>string</code> - doc.areaId docAreaId of the document<code>string</code> - doc.type the document mimi type<code>string</code> - doc.signedUrl the signed URL to upload
|
|
173
|
+
**Access**: public
|
|
174
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
175
|
+
|
|
176
|
+
| Param | Type | Description |
|
|
177
|
+
| --- | --- | --- |
|
|
178
|
+
| params | <code>object</code> | Params to request signed url |
|
|
179
|
+
| params.methodType | <code>string</code> | Method type HTTP get or put |
|
|
180
|
+
| params.docId | <code>string</code> | The unique id of the document |
|
|
181
|
+
| apiKey | <code>string</code> | Api Key as permission to use this functionality |
|
|
182
|
+
|
|
183
|
+
**Example**
|
|
184
|
+
```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);
|
|
193
|
+
```
|
|
194
|
+
**Example**
|
|
195
|
+
```js
|
|
196
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
197
|
+
const api = new API();
|
|
198
|
+
const params - {
|
|
199
|
+
methodType: 'get',
|
|
200
|
+
docId: '5dadd01dc4af3941d42f8c5c'
|
|
201
|
+
};
|
|
202
|
+
const apiKey: '...';
|
|
203
|
+
const { signedUrl, imageType } = await api.admin.document.signedUrl(params, apiKey);
|
|
204
|
+
```
|
|
205
|
+
<a name="AdminDocuments+updateContent"></a>
|
|
206
|
+
|
|
207
|
+
### adminDocuments.updateContent(params, apiKey) ⇒ <code>Promise.<object></code>
|
|
208
|
+
Update a document content
|
|
209
|
+
|
|
210
|
+
**Kind**: instance method of [<code>AdminDocuments</code>](#AdminDocuments)
|
|
211
|
+
**Returns**: <code>Promise.<object></code> - doc Returned document data with the signed url
|
|
212
|
+
**Access**: public
|
|
213
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
214
|
+
|
|
215
|
+
| Param | Type | Description |
|
|
216
|
+
| --- | --- | --- |
|
|
217
|
+
| params | <code>object</code> | Params to request signed url |
|
|
218
|
+
| params.content | <code>string</code> | The content text |
|
|
219
|
+
| params.docId | <code>string</code> | The unique id of the document |
|
|
220
|
+
| apiKey | <code>string</code> | Api Key as permission to use this functionality |
|
|
221
|
+
|
|
222
|
+
**Example**
|
|
223
|
+
```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);
|
|
232
|
+
```
|
|
233
|
+
<a name="AdminDocuments+updateAI"></a>
|
|
234
|
+
|
|
235
|
+
### adminDocuments.updateAI(params, apiKey) ⇒ <code>Promise.<object></code>
|
|
236
|
+
Update a document content
|
|
237
|
+
|
|
238
|
+
**Kind**: instance method of [<code>AdminDocuments</code>](#AdminDocuments)
|
|
239
|
+
**Returns**: <code>Promise.<object></code> - doc Returned document data with the signed url
|
|
240
|
+
**Access**: public
|
|
241
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
242
|
+
|
|
243
|
+
| Param | Type | Description |
|
|
244
|
+
| --- | --- | --- |
|
|
245
|
+
| params | <code>object</code> | Params to request signed url |
|
|
246
|
+
| params.content | <code>string</code> | The content text |
|
|
247
|
+
| params.docId | <code>string</code> | The unique id of the document |
|
|
248
|
+
| params.searchablePDFURL | <code>string</code> | The searchable PDF Url |
|
|
249
|
+
| params.overlay | <code>object</code> | The overlay information |
|
|
250
|
+
| params.entities | <code>array</code> | The list of entities extracted from the text |
|
|
251
|
+
| params.language | <code>object</code> | The language detected |
|
|
252
|
+
| params.language.name | <code>string</code> | The language name detected |
|
|
253
|
+
| params.language.confidence | <code>string</code> | The confidence that it is the language |
|
|
254
|
+
| apiKey | <code>string</code> | Api Key as permission to use this functionality |
|
|
255
|
+
|
|
256
|
+
**Example**
|
|
257
|
+
```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);
|
|
266
|
+
```
|
|
267
|
+
<a name="AdminDocuments+getContent"></a>
|
|
268
|
+
|
|
269
|
+
### adminDocuments.getContent(params, apiKey) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>number</code>
|
|
270
|
+
Get the content of a document
|
|
271
|
+
|
|
272
|
+
**Kind**: instance method of [<code>AdminDocuments</code>](#AdminDocuments)
|
|
273
|
+
**Returns**: <code>Promise.<object></code> - data the document content<code>string</code> - data._id the _id of the document<code>string</code> - data.content all the pages or if asked by page, just one page, the one requested<code>string</code> - data.content.TextOverlay the overlay text if requested<code>string</code> - data.content.ParsedText the page text content<code>number</code> - data.total the total number of pages
|
|
274
|
+
**Access**: public
|
|
275
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
276
|
+
|
|
277
|
+
| Param | Type | Description |
|
|
278
|
+
| --- | --- | --- |
|
|
279
|
+
| params | <code>object</code> | Params to request signed url |
|
|
280
|
+
| params.docId | <code>string</code> | The unique id of the document |
|
|
281
|
+
| params.page | <code>string</code> | The page, from 0, or 'all' if all pages (the full content) |
|
|
282
|
+
| apiKey | <code>string</code> | Api Key as permission to use this functionality |
|
|
283
|
+
|
|
284
|
+
**Example**
|
|
285
|
+
```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);
|
|
294
|
+
```
|
|
295
|
+
<a name="AdminForm"></a>
|
|
296
|
+
|
|
297
|
+
## AdminForm
|
|
298
|
+
Admin Class for forms, permission admin
|
|
299
|
+
|
|
300
|
+
**Kind**: global class
|
|
301
|
+
|
|
302
|
+
* [AdminForm](#AdminForm)
|
|
303
|
+
* [.findById(params, session)](#AdminForm+findById) ⇒ <code>Promise</code>
|
|
304
|
+
* [.getFormList(params, session)](#AdminForm+getFormList) ⇒ <code>Promise</code>
|
|
305
|
+
|
|
306
|
+
<a name="AdminForm+findById"></a>
|
|
307
|
+
|
|
308
|
+
### adminForm.findById(params, session) ⇒ <code>Promise</code>
|
|
309
|
+
Get advance form by ID
|
|
310
|
+
|
|
311
|
+
**Kind**: instance method of [<code>AdminForm</code>](#AdminForm)
|
|
312
|
+
**Access**: public
|
|
313
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
314
|
+
|
|
315
|
+
| Param | Type | Description |
|
|
316
|
+
| --- | --- | --- |
|
|
317
|
+
| params | <code>object</code> | Params to find form by id |
|
|
318
|
+
| params.id | <code>string</code> | Formulary Id (_id database) |
|
|
319
|
+
| params.orgId | <code>string</code> | Organization Id (_id database) |
|
|
320
|
+
| session | <code>string</code> | Session, token JWT |
|
|
321
|
+
|
|
322
|
+
**Example**
|
|
323
|
+
```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);
|
|
332
|
+
```
|
|
333
|
+
<a name="AdminForm+getFormList"></a>
|
|
334
|
+
|
|
335
|
+
### adminForm.getFormList(params, session) ⇒ <code>Promise</code>
|
|
336
|
+
Request signed url url to put or get
|
|
337
|
+
|
|
338
|
+
**Kind**: instance method of [<code>AdminForm</code>](#AdminForm)
|
|
339
|
+
**Access**: public
|
|
340
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
341
|
+
|
|
342
|
+
| Param | Type | Default | Description |
|
|
343
|
+
| --- | --- | --- | --- |
|
|
344
|
+
| params | <code>object</code> | | Params to get form list |
|
|
345
|
+
| params.orgId | <code>string</code> | | Organization id (_id database) |
|
|
346
|
+
| params.page | <code>number</code> | <code>1</code> | Page of pagination |
|
|
347
|
+
| params.perPage | <code>number</code> | <code>200</code> | Items per page |
|
|
348
|
+
| params.type | <code>object</code> | <code>2</code> | Form type (1 to Business or 2 to Advanced) |
|
|
349
|
+
| params.project | <code>object</code> | <code>{_id:</code> | 1, name: 1} - Fields to project |
|
|
350
|
+
| params.sort | <code>object</code> | <code>{name:</code> | 1} - Sort fields |
|
|
351
|
+
| session | <code>string</code> | | Session, token JWT |
|
|
352
|
+
|
|
353
|
+
**Example**
|
|
354
|
+
```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);
|
|
362
|
+
```
|
|
363
|
+
<a name="Admin"></a>
|
|
364
|
+
|
|
365
|
+
## Admin
|
|
366
|
+
API request, admin permission level
|
|
367
|
+
|
|
368
|
+
**Kind**: global class
|
|
369
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
370
|
+
<a name="new_Admin_new"></a>
|
|
371
|
+
|
|
372
|
+
### new Admin(options)
|
|
373
|
+
|
|
374
|
+
| Param | Type | Description |
|
|
375
|
+
| --- | --- | --- |
|
|
376
|
+
| options | <code>object</code> | Params of the constructor |
|
|
377
|
+
| options.parent | <code>object</code> | This of the pararent |
|
|
378
|
+
|
|
379
|
+
<a name="AdminLists"></a>
|
|
380
|
+
|
|
381
|
+
## AdminLists
|
|
382
|
+
Admin Class for lists, permission admin
|
|
383
|
+
|
|
384
|
+
**Kind**: global class
|
|
385
|
+
|
|
386
|
+
* [AdminLists](#AdminLists)
|
|
387
|
+
* [.findById(params, session)](#AdminLists+findById) ⇒ <code>Promise</code>
|
|
388
|
+
* [.find(params, session)](#AdminLists+find) ⇒ <code>Promise</code>
|
|
389
|
+
|
|
390
|
+
<a name="AdminLists+findById"></a>
|
|
391
|
+
|
|
392
|
+
### adminLists.findById(params, session) ⇒ <code>Promise</code>
|
|
393
|
+
Get list by ID
|
|
394
|
+
|
|
395
|
+
**Kind**: instance method of [<code>AdminLists</code>](#AdminLists)
|
|
396
|
+
**Access**: public
|
|
397
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
398
|
+
|
|
399
|
+
| Param | Type | Description |
|
|
400
|
+
| --- | --- | --- |
|
|
401
|
+
| params | <code>object</code> | Params to find list by id |
|
|
402
|
+
| params.id | <code>string</code> | List Id (_id database) |
|
|
403
|
+
| params.orgId | <code>string</code> | Organization Id (_id database) |
|
|
404
|
+
| session | <code>string</code> | Session, token JWT |
|
|
405
|
+
|
|
406
|
+
**Example**
|
|
407
|
+
```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);
|
|
416
|
+
```
|
|
417
|
+
<a name="AdminLists+find"></a>
|
|
418
|
+
|
|
419
|
+
### adminLists.find(params, session) ⇒ <code>Promise</code>
|
|
420
|
+
Get all lists
|
|
421
|
+
|
|
422
|
+
**Kind**: instance method of [<code>AdminLists</code>](#AdminLists)
|
|
423
|
+
**Access**: public
|
|
424
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
425
|
+
|
|
426
|
+
| Param | Type | Default | Description |
|
|
427
|
+
| --- | --- | --- | --- |
|
|
428
|
+
| params | <code>object</code> | <code>{}</code> | Params to pagination and orgId |
|
|
429
|
+
| [params.page] | <code>number</code> | <code>0</code> | Current page to pagination |
|
|
430
|
+
| [params.perPage] | <code>number</code> | <code>200</code> | Qnt itens per page |
|
|
431
|
+
| params.orgId | <code>string</code> | | Organization Id (_id database) |
|
|
432
|
+
| session | <code>string</code> | | Session, token JWT |
|
|
433
|
+
|
|
434
|
+
**Example**
|
|
435
|
+
```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);
|
|
443
|
+
```
|
|
444
|
+
<a name="AdminMessage"></a>
|
|
445
|
+
|
|
446
|
+
## AdminMessage
|
|
447
|
+
Admin Class for user, permission admin
|
|
448
|
+
|
|
449
|
+
**Kind**: global class
|
|
450
|
+
|
|
451
|
+
* [AdminMessage](#AdminMessage)
|
|
452
|
+
* [._paginationOfTheSMS(params)](#AdminMessage+_paginationOfTheSMS)
|
|
453
|
+
* [._validItemToSendEmail(params)](#AdminMessage+_validItemToSendEmail)
|
|
454
|
+
* [.sendSMS(params)](#AdminMessage+sendSMS) ⇒ <code>Promise.<{}></code>
|
|
455
|
+
* [.sendEmail(params, session)](#AdminMessage+sendEmail) ⇒ <code>Promise.<{success: boolean, sent: Array.<object>}></code>
|
|
456
|
+
|
|
457
|
+
<a name="AdminMessage+_paginationOfTheSMS"></a>
|
|
458
|
+
|
|
459
|
+
### adminMessage.\_paginationOfTheSMS(params)
|
|
460
|
+
Pagination SMS texts
|
|
461
|
+
|
|
462
|
+
**Kind**: instance method of [<code>AdminMessage</code>](#AdminMessage)
|
|
463
|
+
|
|
464
|
+
| Param | Type | Default | Description |
|
|
465
|
+
| --- | --- | --- | --- |
|
|
466
|
+
| params | <code>object</code> | | Params to pagintion SMS |
|
|
467
|
+
| params.message | <code>string</code> | | Message to pagination |
|
|
468
|
+
| params.limitSize | <code>number</code> | <code>130</code> | Limit of the start pagination |
|
|
469
|
+
| params.continueText | <code>number</code> | <code>continua...</code> | Text to continue other SMS |
|
|
470
|
+
|
|
471
|
+
<a name="AdminMessage+_validItemToSendEmail"></a>
|
|
472
|
+
|
|
473
|
+
### adminMessage.\_validItemToSendEmail(params)
|
|
474
|
+
Validation struct to send email
|
|
475
|
+
|
|
476
|
+
**Kind**: instance method of [<code>AdminMessage</code>](#AdminMessage)
|
|
477
|
+
|
|
478
|
+
| Param | Type | Description |
|
|
479
|
+
| --- | --- | --- |
|
|
480
|
+
| params | <code>object</code> | Params to send email |
|
|
481
|
+
| params.subject | <code>string</code> | Subject of the email |
|
|
482
|
+
| params.message | <code>string</code> | Body of the email |
|
|
483
|
+
| params.to | <code>string</code> | Destination email |
|
|
484
|
+
| params.from | <code>string</code> | Source email |
|
|
485
|
+
|
|
486
|
+
<a name="AdminMessage+sendSMS"></a>
|
|
487
|
+
|
|
488
|
+
### adminMessage.sendSMS(params) ⇒ <code>Promise.<{}></code>
|
|
489
|
+
Send an SMS message
|
|
490
|
+
|
|
491
|
+
**Kind**: instance method of [<code>AdminMessage</code>](#AdminMessage)
|
|
492
|
+
|
|
493
|
+
| Param | Type | Default | Description |
|
|
494
|
+
| --- | --- | --- | --- |
|
|
495
|
+
| params | <code>object</code> | | Params to send SMS |
|
|
496
|
+
| params.apiKey | <code>string</code> | | Organization API key |
|
|
497
|
+
| params.message | <code>string</code> | | The text message to send |
|
|
498
|
+
| params.recipient | <code>string</code> | | The telephone number without with only numbers |
|
|
499
|
+
| params.limitSize | <code>number</code> | <code>130</code> | Size limit to send SMS |
|
|
500
|
+
|
|
501
|
+
<a name="AdminMessage+sendEmail"></a>
|
|
502
|
+
|
|
503
|
+
### adminMessage.sendEmail(params, session) ⇒ <code>Promise.<{success: boolean, sent: Array.<object>}></code>
|
|
504
|
+
Send email, array with email list or send one email
|
|
505
|
+
|
|
506
|
+
**Kind**: instance method of [<code>AdminMessage</code>](#AdminMessage)
|
|
507
|
+
**Returns**: <code>Promise.<{success: boolean, sent: Array.<object>}></code> - - Success and email sent
|
|
508
|
+
|
|
509
|
+
| Param | Type | Description |
|
|
510
|
+
| --- | --- | --- |
|
|
511
|
+
| params | <code>object</code> | Params to send email |
|
|
512
|
+
| params.subject | <code>string</code> | Subject of the email |
|
|
513
|
+
| params.message | <code>string</code> | Body of the email |
|
|
514
|
+
| params.to | <code>string</code> | Destination email |
|
|
515
|
+
| params.from | <code>string</code> | Source email |
|
|
516
|
+
| session | <code>string</code> | Session, token JWT |
|
|
517
|
+
|
|
518
|
+
**Example**
|
|
519
|
+
```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);
|
|
529
|
+
```
|
|
530
|
+
<a name="AdminNotification"></a>
|
|
531
|
+
|
|
532
|
+
## AdminNotification
|
|
533
|
+
Admin Class for notification, permission admin
|
|
534
|
+
|
|
535
|
+
**Kind**: global class
|
|
536
|
+
|
|
537
|
+
* [AdminNotification](#AdminNotification)
|
|
538
|
+
* [.realTime(params, session)](#AdminNotification+realTime) ⇒ <code>Promise.<\*></code>
|
|
539
|
+
* [.add(params, session)](#AdminNotification+add) ⇒ <code>Promise</code>
|
|
540
|
+
* [.findById(params, session)](#AdminNotification+findById) ⇒ <code>Promise</code>
|
|
541
|
+
* [.findByIdAndUpdate(params, session)](#AdminNotification+findByIdAndUpdate) ⇒ <code>Promise</code>
|
|
542
|
+
* [.findByIdAndRemove(params, session)](#AdminNotification+findByIdAndRemove) ⇒ <code>Promise</code>
|
|
543
|
+
|
|
544
|
+
<a name="AdminNotification+realTime"></a>
|
|
545
|
+
|
|
546
|
+
### adminNotification.realTime(params, session) ⇒ <code>Promise.<\*></code>
|
|
547
|
+
Send real time notification
|
|
548
|
+
|
|
549
|
+
**Kind**: instance method of [<code>AdminNotification</code>](#AdminNotification)
|
|
550
|
+
|
|
551
|
+
| Param | Type | Description |
|
|
552
|
+
| --- | --- | --- |
|
|
553
|
+
| params | <code>object</code> | Params to send notification |
|
|
554
|
+
| params.userIds | <code>string</code> | Users to send notification |
|
|
555
|
+
| params.message | <code>object</code> | Object with data to send user |
|
|
556
|
+
| session | <code>object</code> | Session, token JWT |
|
|
557
|
+
|
|
558
|
+
<a name="AdminNotification+add"></a>
|
|
559
|
+
|
|
560
|
+
### adminNotification.add(params, session) ⇒ <code>Promise</code>
|
|
561
|
+
Create notification
|
|
562
|
+
|
|
563
|
+
**Kind**: instance method of [<code>AdminNotification</code>](#AdminNotification)
|
|
564
|
+
**Access**: public
|
|
565
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
566
|
+
|
|
567
|
+
| Param | Type | Description |
|
|
568
|
+
| --- | --- | --- |
|
|
569
|
+
| params | <code>object</code> | Params to create notification |
|
|
570
|
+
| params.orgId | <code>string</code> | OrgId of the user SU |
|
|
571
|
+
| params.userId | <code>string</code> | User to create notification |
|
|
572
|
+
| params.message | <code>object</code> | Object with data to send user |
|
|
573
|
+
| session | <code>string</code> | Session, token JWT |
|
|
574
|
+
|
|
575
|
+
**Example**
|
|
576
|
+
```js
|
|
577
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
578
|
+
const api = new API();
|
|
579
|
+
const params = {
|
|
580
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
581
|
+
userId: '55e4a3bd6be6b45210833fae',
|
|
582
|
+
message: 'Olá como vai tudo bem?'
|
|
583
|
+
};
|
|
584
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
585
|
+
await api.admin.notifications.add(params, session);
|
|
586
|
+
```
|
|
587
|
+
<a name="AdminNotification+findById"></a>
|
|
588
|
+
|
|
589
|
+
### adminNotification.findById(params, session) ⇒ <code>Promise</code>
|
|
590
|
+
Search notification using (notificationId or userId)
|
|
591
|
+
|
|
592
|
+
**Kind**: instance method of [<code>AdminNotification</code>](#AdminNotification)
|
|
593
|
+
**Access**: public
|
|
594
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
595
|
+
|
|
596
|
+
| Param | Type | Description |
|
|
597
|
+
| --- | --- | --- |
|
|
598
|
+
| params | <code>object</code> | Params to create notification |
|
|
599
|
+
| params.orgId | <code>string</code> | OrgId of the user SU |
|
|
600
|
+
| params.id | <code>string</code> | ALERT! Id is userId or id is notificationId |
|
|
601
|
+
| session | <code>string</code> | Session, token JWT |
|
|
602
|
+
|
|
603
|
+
**Example**
|
|
604
|
+
```js
|
|
605
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
606
|
+
const api = new API();
|
|
607
|
+
const params = {
|
|
608
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
609
|
+
id: '55e4a3bd6be6b45210833fae',
|
|
610
|
+
};
|
|
611
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
612
|
+
await api.admin.notifications.findById(params, session);
|
|
613
|
+
```
|
|
614
|
+
<a name="AdminNotification+findByIdAndUpdate"></a>
|
|
615
|
+
|
|
616
|
+
### adminNotification.findByIdAndUpdate(params, session) ⇒ <code>Promise</code>
|
|
617
|
+
Update notification using (notificationId or userId)
|
|
618
|
+
|
|
619
|
+
**Kind**: instance method of [<code>AdminNotification</code>](#AdminNotification)
|
|
620
|
+
**Access**: public
|
|
621
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
622
|
+
|
|
623
|
+
| Param | Type | Description |
|
|
624
|
+
| --- | --- | --- |
|
|
625
|
+
| params | <code>object</code> | Params to create notification |
|
|
626
|
+
| params.orgId | <code>string</code> | OrgId of the user SU |
|
|
627
|
+
| params.id | <code>string</code> | ALERT! Id is userId or id is notificationId |
|
|
628
|
+
| params.read | <code>boolean</code> | If message is read true or false |
|
|
629
|
+
| session | <code>string</code> | Session, token JWT |
|
|
630
|
+
|
|
631
|
+
**Example**
|
|
632
|
+
```js
|
|
633
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
634
|
+
const api = new API();
|
|
635
|
+
const params = {
|
|
636
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
637
|
+
id: '55e4a3bd6be6b45210833fae',
|
|
638
|
+
read: true
|
|
639
|
+
};
|
|
640
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
641
|
+
await api.admin.notifications.findByIdAndUpdate(params, session);
|
|
642
|
+
```
|
|
643
|
+
<a name="AdminNotification+findByIdAndRemove"></a>
|
|
644
|
+
|
|
645
|
+
### adminNotification.findByIdAndRemove(params, session) ⇒ <code>Promise</code>
|
|
646
|
+
Delete notification using (notificationId or userId)
|
|
647
|
+
|
|
648
|
+
**Kind**: instance method of [<code>AdminNotification</code>](#AdminNotification)
|
|
649
|
+
**Access**: public
|
|
650
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
651
|
+
|
|
652
|
+
| Param | Type | Description |
|
|
653
|
+
| --- | --- | --- |
|
|
654
|
+
| params | <code>object</code> | Params to create notification |
|
|
655
|
+
| params.orgId | <code>string</code> | OrgId of the user SU |
|
|
656
|
+
| params.id | <code>string</code> | ALERT! Id is userId or id is notificationId |
|
|
657
|
+
| session | <code>string</code> | Session, token JWT |
|
|
658
|
+
|
|
659
|
+
**Example**
|
|
660
|
+
```js
|
|
661
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
662
|
+
const api = new API();
|
|
663
|
+
const params = {
|
|
664
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
665
|
+
id: '55e4a3bd6be6b45210833fae',
|
|
666
|
+
};
|
|
667
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
668
|
+
await api.admin.notifications.findByIdAndDelete(params, session);
|
|
669
|
+
```
|
|
670
|
+
<a name="Organization"></a>
|
|
671
|
+
|
|
672
|
+
## Organization
|
|
673
|
+
Class for organizations, permission user
|
|
674
|
+
|
|
675
|
+
**Kind**: global class
|
|
676
|
+
|
|
677
|
+
* [Organization](#Organization)
|
|
678
|
+
* [.upsertAvatar(params, session)](#Organization+upsertAvatar) ⇒ <code>Promise</code>
|
|
679
|
+
* [.removeAvatar(session)](#Organization+removeAvatar) ⇒ <code>Promise</code>
|
|
680
|
+
* [.findById(orgId, session)](#Organization+findById)
|
|
681
|
+
* [.idCardExist(idcard, session)](#Organization+idCardExist)
|
|
682
|
+
* [.upsertAvatar(params, session)](#Organization+upsertAvatar) ⇒ <code>Promise</code>
|
|
683
|
+
* [.removeAvatar(session)](#Organization+removeAvatar) ⇒ <code>Promise</code>
|
|
684
|
+
* [.callFetch(params)](#Organization+callFetch) ⇒ <code>promise</code>
|
|
685
|
+
|
|
686
|
+
<a name="Organization+upsertAvatar"></a>
|
|
687
|
+
|
|
688
|
+
### organization.upsertAvatar(params, session) ⇒ <code>Promise</code>
|
|
689
|
+
Update avatar of organization by session of user not allow session user SU
|
|
690
|
+
|
|
691
|
+
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
692
|
+
**Access**: public
|
|
693
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
694
|
+
|
|
695
|
+
| Param | Type | Description |
|
|
696
|
+
| --- | --- | --- |
|
|
697
|
+
| params | <code>object</code> | Params to update avatar |
|
|
698
|
+
| params.orgId | <code>string</code> | Organization id |
|
|
699
|
+
| params.avatar | <code>string</code> | Image in base64 to update |
|
|
700
|
+
| params.type | <code>string</code> | MimeType (image/png) |
|
|
701
|
+
| session | <code>string</code> | Is token JWT of user SU |
|
|
702
|
+
|
|
703
|
+
**Example**
|
|
704
|
+
```js
|
|
705
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
706
|
+
const api = new API();
|
|
707
|
+
const params = {
|
|
708
|
+
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
709
|
+
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
710
|
+
type: 'image/png',
|
|
711
|
+
};
|
|
712
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
713
|
+
await api.admin.organizations.upsertAvatar(params, session);
|
|
714
|
+
```
|
|
715
|
+
<a name="Organization+removeAvatar"></a>
|
|
716
|
+
|
|
717
|
+
### organization.removeAvatar(session) ⇒ <code>Promise</code>
|
|
718
|
+
Remove avatar of user by session of user not allow session user SU
|
|
719
|
+
|
|
720
|
+
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
721
|
+
**Access**: public
|
|
722
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
723
|
+
|
|
724
|
+
| Param | Type | Description |
|
|
725
|
+
| --- | --- | --- |
|
|
726
|
+
| params.orgId | <code>string</code> | Organization id |
|
|
727
|
+
| session | <code>string</code> | Is token JWT of user SU |
|
|
728
|
+
|
|
729
|
+
**Example**
|
|
730
|
+
```js
|
|
731
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
732
|
+
const api = new API();
|
|
733
|
+
const orgId = '5dadd01dc4af3941d42f8c5c';
|
|
734
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
735
|
+
await api.admin.organizations.removeAvatar(orgId, session);
|
|
736
|
+
```
|
|
737
|
+
<a name="Organization+findById"></a>
|
|
738
|
+
|
|
739
|
+
### organization.findById(orgId, session)
|
|
740
|
+
Find organization by id
|
|
741
|
+
|
|
742
|
+
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
743
|
+
**Access**: public
|
|
744
|
+
**Author**: Augusto Pissarra <abernardo.br@gmail.com>
|
|
745
|
+
|
|
746
|
+
| Param | Type | Description |
|
|
747
|
+
| --- | --- | --- |
|
|
748
|
+
| orgId | <code>string</code> | ID of the organization to find (_id database) |
|
|
749
|
+
| session | <code>string</code> | Is token JWT |
|
|
750
|
+
|
|
751
|
+
**Example**
|
|
752
|
+
```js
|
|
753
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
754
|
+
const api = new API();
|
|
755
|
+
const orgId = '80443245000122';
|
|
756
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
757
|
+
await api.user.organization.findById(idCard, session);
|
|
758
|
+
```
|
|
759
|
+
<a name="Organization+idCardExist"></a>
|
|
760
|
+
|
|
761
|
+
### organization.idCardExist(idcard, session)
|
|
762
|
+
Check if id card exist
|
|
763
|
+
|
|
764
|
+
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
765
|
+
**Access**: public
|
|
766
|
+
**Author**: Augusto Pissarra <abernardo.br@gmail.com>
|
|
767
|
+
|
|
768
|
+
| Param | Type | Description |
|
|
769
|
+
| --- | --- | --- |
|
|
770
|
+
| idcard | <code>string</code> | Check if id card exist |
|
|
771
|
+
| session | <code>string</code> | Is token JWT |
|
|
772
|
+
|
|
773
|
+
**Example**
|
|
774
|
+
```js
|
|
775
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
776
|
+
const api = new API();
|
|
777
|
+
const idCard = '80443245000122';
|
|
778
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
779
|
+
await api.user.organization.idCardExist(idCard, session);
|
|
780
|
+
```
|
|
781
|
+
<a name="Organization+upsertAvatar"></a>
|
|
782
|
+
|
|
783
|
+
### organization.upsertAvatar(params, session) ⇒ <code>Promise</code>
|
|
784
|
+
Update avatar of organization by session of user not allow session user SU
|
|
785
|
+
|
|
786
|
+
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
787
|
+
**Access**: public
|
|
788
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
789
|
+
|
|
790
|
+
| Param | Type | Description |
|
|
791
|
+
| --- | --- | --- |
|
|
792
|
+
| params | <code>object</code> | Params to update avatar |
|
|
793
|
+
| params.avatar | <code>string</code> | Image in base64 to update |
|
|
794
|
+
| params.type | <code>string</code> | mimeType (image/png) |
|
|
795
|
+
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
796
|
+
|
|
797
|
+
**Example**
|
|
798
|
+
```js
|
|
799
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
800
|
+
const api = new API();
|
|
801
|
+
const params = {
|
|
802
|
+
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
803
|
+
type: 'image/png',
|
|
804
|
+
};
|
|
805
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
806
|
+
await api.user.profile.updateAvatar(params, session);
|
|
807
|
+
```
|
|
808
|
+
<a name="Organization+removeAvatar"></a>
|
|
809
|
+
|
|
810
|
+
### organization.removeAvatar(session) ⇒ <code>Promise</code>
|
|
811
|
+
Remove avatar of user by session of user not allow session user SU
|
|
812
|
+
|
|
813
|
+
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
814
|
+
**Access**: public
|
|
815
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
816
|
+
|
|
817
|
+
| Param | Type | Description |
|
|
818
|
+
| --- | --- | --- |
|
|
819
|
+
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
820
|
+
|
|
821
|
+
**Example**
|
|
822
|
+
```js
|
|
823
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
824
|
+
const api = new API();
|
|
825
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
826
|
+
await api.user.profile.removeAvatar(session);
|
|
827
|
+
```
|
|
828
|
+
<a name="Organization+callFetch"></a>
|
|
829
|
+
|
|
830
|
+
### organization.callFetch(params) ⇒ <code>promise</code>
|
|
831
|
+
Call URL internal, need auth JWT (session)
|
|
832
|
+
|
|
833
|
+
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
834
|
+
**Access**: public
|
|
835
|
+
**Author**: Thiago Anselmo <thiagoo.anselmoo@gmail.com>
|
|
836
|
+
|
|
837
|
+
| Param | Type | Default | Description |
|
|
838
|
+
| --- | --- | --- | --- |
|
|
839
|
+
| params | <code>object</code> | | Params to call fectch (URL internal) |
|
|
840
|
+
| params.url | <code>string</code> | | URL to call |
|
|
841
|
+
| [params.method] | <code>string</code> | <code>"POST"</code> | Fetch Method |
|
|
842
|
+
| params.payload | <code>string</code> | | Payload to send system manager |
|
|
843
|
+
|
|
844
|
+
**Example**
|
|
845
|
+
```js
|
|
846
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
847
|
+
const api = new API();
|
|
848
|
+
|
|
849
|
+
const params = {
|
|
850
|
+
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
851
|
+
method: 'POST'
|
|
852
|
+
}
|
|
853
|
+
await api.user.organization.callFetchs(params, session);
|
|
854
|
+
```
|
|
855
|
+
<a name="AdminPlugin"></a>
|
|
856
|
+
|
|
857
|
+
## AdminPlugin
|
|
858
|
+
Admin Class for plugin, permission admin
|
|
859
|
+
|
|
860
|
+
**Kind**: global class
|
|
861
|
+
|
|
862
|
+
* [AdminPlugin](#AdminPlugin)
|
|
863
|
+
* [.find(params)](#AdminPlugin+find)
|
|
864
|
+
* [.findById(id, session)](#AdminPlugin+findById) ⇒ <code>Promise</code>
|
|
865
|
+
|
|
866
|
+
<a name="AdminPlugin+find"></a>
|
|
867
|
+
|
|
868
|
+
### adminPlugin.find(params)
|
|
869
|
+
Find plugins
|
|
870
|
+
|
|
871
|
+
**Kind**: instance method of [<code>AdminPlugin</code>](#AdminPlugin)
|
|
872
|
+
**Access**: public
|
|
873
|
+
**Author**: Augusto Pissarra <abernardo.br@gmail.com>
|
|
874
|
+
|
|
875
|
+
| Param | Type | Description |
|
|
876
|
+
| --- | --- | --- |
|
|
877
|
+
| params | <code>object</code> | Params to search plugins |
|
|
878
|
+
| params.page | <code>number</code> | Start page to pagination |
|
|
879
|
+
| params.perPage | <code>number</code> | Items per page |
|
|
880
|
+
|
|
881
|
+
**Example**
|
|
882
|
+
```js
|
|
883
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
884
|
+
const api = new API();
|
|
885
|
+
const params = {page: 1, perPage: 200};
|
|
886
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
887
|
+
await api.user.organization.findById(params, session);
|
|
888
|
+
```
|
|
889
|
+
<a name="AdminPlugin+findById"></a>
|
|
890
|
+
|
|
891
|
+
### adminPlugin.findById(id, session) ⇒ <code>Promise</code>
|
|
892
|
+
Get plugin by ID
|
|
893
|
+
|
|
894
|
+
**Kind**: instance method of [<code>AdminPlugin</code>](#AdminPlugin)
|
|
895
|
+
**Access**: public
|
|
896
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
897
|
+
|
|
898
|
+
| Param | Type | Description |
|
|
899
|
+
| --- | --- | --- |
|
|
900
|
+
| id | <code>string</code> | Plugin Id (_id database) |
|
|
901
|
+
| session | <code>string</code> | Session, token JWT |
|
|
902
|
+
|
|
903
|
+
**Example**
|
|
904
|
+
```js
|
|
905
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
906
|
+
const api = new API();
|
|
907
|
+
const id ='55e4a3bd6be6b45210833fae',
|
|
908
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
909
|
+
await api.admin.plugin.findById(id, session);
|
|
910
|
+
```
|
|
911
|
+
<a name="AdminPolicy"></a>
|
|
912
|
+
|
|
913
|
+
## AdminPolicy
|
|
914
|
+
Admin Class for policy, permission admin
|
|
915
|
+
|
|
916
|
+
**Kind**: global class
|
|
917
|
+
<a name="AdminPolicy+find"></a>
|
|
918
|
+
|
|
919
|
+
### adminPolicy.find(session) ⇒ <code>Promise</code>
|
|
920
|
+
Find all policies
|
|
921
|
+
|
|
922
|
+
**Kind**: instance method of [<code>AdminPolicy</code>](#AdminPolicy)
|
|
923
|
+
**Access**: public
|
|
924
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
925
|
+
|
|
926
|
+
| Param | Type | Description |
|
|
927
|
+
| --- | --- | --- |
|
|
928
|
+
| session | <code>string</code> | Session, token JWT |
|
|
929
|
+
|
|
930
|
+
**Example**
|
|
931
|
+
```js
|
|
932
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
933
|
+
const api = new API();
|
|
934
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
935
|
+
await api.admin.policy.find(session);
|
|
936
|
+
```
|
|
937
|
+
<a name="AdminProcesses"></a>
|
|
938
|
+
|
|
939
|
+
## AdminProcesses
|
|
940
|
+
Admin Class for processes, permission admin
|
|
941
|
+
|
|
942
|
+
**Kind**: global class
|
|
943
|
+
|
|
944
|
+
* [AdminProcesses](#AdminProcesses)
|
|
945
|
+
* [.search()](#AdminProcesses+search) ⇒ <code>Promise</code>
|
|
946
|
+
* [.advancedSearch(params, session)](#AdminProcesses+advancedSearch) ⇒ <code>Promise</code>
|
|
947
|
+
|
|
948
|
+
<a name="AdminProcesses+search"></a>
|
|
949
|
+
|
|
950
|
+
### adminProcesses.search() ⇒ <code>Promise</code>
|
|
951
|
+
Advanced search of processes, check documentation, to verify all params, pass to method search
|
|
952
|
+
|
|
953
|
+
**Kind**: instance method of [<code>AdminProcesses</code>](#AdminProcesses)
|
|
954
|
+
**Access**: public
|
|
955
|
+
**See**: https://confluence.external-share.com/content/7450b014-52c6-4d9e-b30e-a062b57453b5/17104899/17694721/532545537
|
|
956
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
957
|
+
**Example**
|
|
958
|
+
```js
|
|
959
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
960
|
+
const api = new API();
|
|
961
|
+
const params = {
|
|
962
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
963
|
+
...
|
|
964
|
+
...
|
|
965
|
+
...
|
|
966
|
+
};
|
|
967
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
968
|
+
await api.admin.processes.search(params, session);
|
|
969
|
+
```
|
|
970
|
+
<a name="AdminProcesses+advancedSearch"></a>
|
|
971
|
+
|
|
972
|
+
### adminProcesses.advancedSearch(params, session) ⇒ <code>Promise</code>
|
|
973
|
+
Advanced search of process in elastic search ussing system manager
|
|
974
|
+
|
|
975
|
+
**Kind**: instance method of [<code>AdminProcesses</code>](#AdminProcesses)
|
|
976
|
+
**Access**: public
|
|
977
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
978
|
+
|
|
979
|
+
| Param | Type | Description |
|
|
980
|
+
| --- | --- | --- |
|
|
981
|
+
| params | <code>object</code> | Params to search document |
|
|
982
|
+
| params.orgProcessId | <code>string</code> | Document id (_id database) of the process |
|
|
983
|
+
| params.query | <code>object</code> | Query to search in elastic search |
|
|
984
|
+
| session | <code>string</code> | Session, token JWT |
|
|
985
|
+
|
|
986
|
+
**Example**
|
|
987
|
+
```js
|
|
988
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
989
|
+
const api = new API();
|
|
990
|
+
const params = {
|
|
991
|
+
orgProcessId: '5edd11c46b6ce9729c2c297c',
|
|
992
|
+
query: {
|
|
993
|
+
"_source": "processData.properties.processProperties",
|
|
994
|
+
"query": {
|
|
995
|
+
"term": {
|
|
996
|
+
"initParams.email.keyword": {
|
|
997
|
+
"value": "clintes001@gmail.com"
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1004
|
+
await api.admin.processes.advancedSearch(params, session);
|
|
1005
|
+
```
|
|
1006
|
+
<a name="AdminTask"></a>
|
|
1007
|
+
|
|
1008
|
+
## AdminTask
|
|
1009
|
+
Admin Class for task, permission admin
|
|
1010
|
+
|
|
1011
|
+
**Kind**: global class
|
|
1012
|
+
<a name="AdminTask+find"></a>
|
|
1013
|
+
|
|
1014
|
+
### adminTask.find(params, session)
|
|
1015
|
+
Get task by user Id
|
|
1016
|
+
|
|
1017
|
+
**Kind**: instance method of [<code>AdminTask</code>](#AdminTask)
|
|
1018
|
+
**Access**: public
|
|
1019
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1020
|
+
|
|
1021
|
+
| Param | Type | Default | Description |
|
|
1022
|
+
| --- | --- | --- | --- |
|
|
1023
|
+
| params | <code>object</code> | | Params to get task |
|
|
1024
|
+
| params.userId | <code>string</code> | | User id (_id database) |
|
|
1025
|
+
| [params.filter] | <code>string</code> | <code>"NOT_DONE"</code> | Filter type CLEAN | EXECUTED | PENDING | LATE | NOT_DONE | DONE |
|
|
1026
|
+
| params.project | <code>object</code> | | Project to return |
|
|
1027
|
+
| params.project.returnProcessProperties | <code>boolean</code> | | Return process properties |
|
|
1028
|
+
| params.project.returnInitParams | <code>boolean</code> | | Return init params |
|
|
1029
|
+
| params.userId | <code>string</code> | | User id (_id database) |
|
|
1030
|
+
| [params.includeOwner] | <code>boolean</code> | <code>false</code> | Include owner true | false |
|
|
1031
|
+
| session | <code>string</code> | | Session, token JWT |
|
|
1032
|
+
|
|
1033
|
+
**Example**
|
|
1034
|
+
```js
|
|
1035
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1036
|
+
const api = new API();
|
|
1037
|
+
const params = {
|
|
1038
|
+
userId: '55e4a3bd6be6b45210833fae',
|
|
1039
|
+
};
|
|
1040
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1041
|
+
await api.admin.task.find(params, session);
|
|
1042
|
+
```
|
|
1043
|
+
<a name="AdminUser"></a>
|
|
1044
|
+
|
|
1045
|
+
## AdminUser
|
|
1046
|
+
Admin Class for user, permission admin
|
|
1047
|
+
|
|
1048
|
+
**Kind**: global class
|
|
1049
|
+
|
|
1050
|
+
* [AdminUser](#AdminUser)
|
|
1051
|
+
* [.findById(userId, session)](#AdminUser+findById) ⇒ <code>Promise</code>
|
|
1052
|
+
* [.findByIdAndUpdatePassword(params, session)](#AdminUser+findByIdAndUpdatePassword) ⇒ <code>Promise.<unknown></code>
|
|
1053
|
+
* [.emailExist(email, session)](#AdminUser+emailExist)
|
|
1054
|
+
* [.findByIdAndUpdate(userId, payload, session)](#AdminUser+findByIdAndUpdate) ⇒ <code>Promise.<\*></code>
|
|
1055
|
+
|
|
1056
|
+
<a name="AdminUser+findById"></a>
|
|
1057
|
+
|
|
1058
|
+
### adminUser.findById(userId, session) ⇒ <code>Promise</code>
|
|
1059
|
+
Request profile by userId
|
|
1060
|
+
|
|
1061
|
+
**Kind**: instance method of [<code>AdminUser</code>](#AdminUser)
|
|
1062
|
+
**Access**: public
|
|
1063
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1064
|
+
|
|
1065
|
+
| Param | Type | Description |
|
|
1066
|
+
| --- | --- | --- |
|
|
1067
|
+
| userId | <code>string</code> | User identifier (_id database) |
|
|
1068
|
+
| session | <code>string</code> | Is token JWT |
|
|
1069
|
+
|
|
1070
|
+
**Example**
|
|
1071
|
+
```js
|
|
1072
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1073
|
+
const api = new API();
|
|
1074
|
+
const userId = '55e4a3bd6be6b45210833fae';
|
|
1075
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1076
|
+
await api.admin.user.findById(userId, session);
|
|
1077
|
+
```
|
|
1078
|
+
<a name="AdminUser+findByIdAndUpdatePassword"></a>
|
|
1079
|
+
|
|
1080
|
+
### adminUser.findByIdAndUpdatePassword(params, session) ⇒ <code>Promise.<unknown></code>
|
|
1081
|
+
Update password by userId
|
|
1082
|
+
|
|
1083
|
+
**Kind**: instance method of [<code>AdminUser</code>](#AdminUser)
|
|
1084
|
+
**Access**: public
|
|
1085
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1086
|
+
|
|
1087
|
+
| Param | Type | Description |
|
|
1088
|
+
| --- | --- | --- |
|
|
1089
|
+
| params | <code>object</code> | Params to update password |
|
|
1090
|
+
| params.userId | <code>string</code> | Id of the user |
|
|
1091
|
+
| params.oldPassword | <code>string</code> | Old password |
|
|
1092
|
+
| params.newPassword | <code>string</code> | New password |
|
|
1093
|
+
| session | <code>string</code> | Is token JWT |
|
|
1094
|
+
|
|
1095
|
+
**Example**
|
|
1096
|
+
```js
|
|
1097
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1098
|
+
const api = new API();
|
|
1099
|
+
const params = {
|
|
1100
|
+
userId: '55e4a3bd6be6b45210833fae',
|
|
1101
|
+
oldPassword: '123456',
|
|
1102
|
+
newPassword: '123456789'
|
|
1103
|
+
};
|
|
1104
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1105
|
+
await api.admin.user.findByIdAndUpdatePassword(params, session);
|
|
1106
|
+
```
|
|
1107
|
+
<a name="AdminUser+emailExist"></a>
|
|
1108
|
+
|
|
1109
|
+
### adminUser.emailExist(email, session)
|
|
1110
|
+
Check if email is unique
|
|
1111
|
+
|
|
1112
|
+
**Kind**: instance method of [<code>AdminUser</code>](#AdminUser)
|
|
1113
|
+
**Access**: public
|
|
1114
|
+
**Author**: Thiago Anselmo <thiagoo.anselmoo@gmail.com>
|
|
1115
|
+
|
|
1116
|
+
| Param | Type | Description |
|
|
1117
|
+
| --- | --- | --- |
|
|
1118
|
+
| email | <code>string</code> | Check if email is unique |
|
|
1119
|
+
| session | <code>string</code> | Is token JWT |
|
|
1120
|
+
|
|
1121
|
+
**Example**
|
|
1122
|
+
```js
|
|
1123
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1124
|
+
const api = new API();
|
|
1125
|
+
const email = 'ana.silva@gmail.com';
|
|
1126
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1127
|
+
await api.admin.user.emailExist(email, session);
|
|
1128
|
+
```
|
|
1129
|
+
<a name="AdminUser+findByIdAndUpdate"></a>
|
|
1130
|
+
|
|
1131
|
+
### adminUser.findByIdAndUpdate(userId, payload, session) ⇒ <code>Promise.<\*></code>
|
|
1132
|
+
update userData by userSMId
|
|
1133
|
+
|
|
1134
|
+
**Kind**: instance method of [<code>AdminUser</code>](#AdminUser)
|
|
1135
|
+
**Access**: public
|
|
1136
|
+
|
|
1137
|
+
| Param | Type | Description |
|
|
1138
|
+
| --- | --- | --- |
|
|
1139
|
+
| userId | <code>string</code> | User SM Id |
|
|
1140
|
+
| payload | <code>object</code> | Payload to update |
|
|
1141
|
+
| session | <code>string</code> | Is token JWT |
|
|
1142
|
+
|
|
1143
|
+
**Example**
|
|
1144
|
+
```js
|
|
1145
|
+
const userId = '55e4a3bd6be6b45210833fae';
|
|
1146
|
+
const payload = {
|
|
1147
|
+
name: 'Maria joaquina',
|
|
1148
|
+
email: 'maria@gmail.com'
|
|
1149
|
+
};
|
|
1150
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1151
|
+
```
|
|
1152
|
+
<a name="GeoLocation"></a>
|
|
1153
|
+
|
|
1154
|
+
## GeoLocation
|
|
1155
|
+
General Class for user, permission organization
|
|
1156
|
+
|
|
1157
|
+
**Kind**: global class
|
|
1158
|
+
<a name="GeoLocation+location"></a>
|
|
1159
|
+
|
|
1160
|
+
### geoLocation.location(params) ⇒ <code>Promise</code>
|
|
1161
|
+
Get geo location of the address
|
|
1162
|
+
|
|
1163
|
+
**Kind**: instance method of [<code>GeoLocation</code>](#GeoLocation)
|
|
1164
|
+
**Access**: public
|
|
1165
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1166
|
+
|
|
1167
|
+
| Param | Type | Description |
|
|
1168
|
+
| --- | --- | --- |
|
|
1169
|
+
| params | <code>object</code> | Params to get geo location |
|
|
1170
|
+
| params.address | <code>string</code> | The address to get the location for |
|
|
1171
|
+
| params.apiKey | <code>string</code> | The Organization API Key |
|
|
1172
|
+
|
|
1173
|
+
**Example**
|
|
1174
|
+
```js
|
|
1175
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1176
|
+
const api = new API();
|
|
1177
|
+
const params = {
|
|
1178
|
+
address: 'Rua Sud Menucci, 615 - Vila Camilopolis, Santo André - SP',
|
|
1179
|
+
apiKey: 'AIzaSyC7gJFOkuT-Mel3WZbX5uKuJ1USqLVkGnY',
|
|
1180
|
+
};
|
|
1181
|
+
await api.general.geo.location(params);
|
|
1182
|
+
```
|
|
1183
|
+
<a name="Users"></a>
|
|
1184
|
+
|
|
1185
|
+
## Users
|
|
1186
|
+
API request, user permission level
|
|
1187
|
+
|
|
1188
|
+
**Kind**: global class
|
|
1189
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1190
|
+
|
|
1191
|
+
* [Users](#Users)
|
|
1192
|
+
* [new Users(options)](#new_Users_new)
|
|
1193
|
+
* [new Users(options)](#new_Users_new)
|
|
1194
|
+
|
|
1195
|
+
<a name="new_Users_new"></a>
|
|
1196
|
+
|
|
1197
|
+
### new Users(options)
|
|
1198
|
+
|
|
1199
|
+
| Param | Type | Description |
|
|
1200
|
+
| --- | --- | --- |
|
|
1201
|
+
| options | <code>object</code> | Params of the constructor |
|
|
1202
|
+
| options.parent | <code>object</code> | This of the pararent |
|
|
1203
|
+
|
|
1204
|
+
<a name="new_Users_new"></a>
|
|
1205
|
+
|
|
1206
|
+
### new Users(options)
|
|
1207
|
+
|
|
1208
|
+
| Param | Type | Description |
|
|
1209
|
+
| --- | --- | --- |
|
|
1210
|
+
| options | <code>object</code> | Params of the constructor |
|
|
1211
|
+
| options.parent | <code>object</code> | This of the pararent |
|
|
1212
|
+
|
|
1213
|
+
<a name="Datasource"></a>
|
|
1214
|
+
|
|
1215
|
+
## Datasource
|
|
1216
|
+
Class for user datasource access, to be used with when creating new documents
|
|
1217
|
+
|
|
1218
|
+
**Kind**: global class
|
|
1219
|
+
<a name="Datasource+autocomplete"></a>
|
|
1220
|
+
|
|
1221
|
+
### datasource.autocomplete(params, session) ⇒ <code>promise.<array></code> \| <code>string</code> \| <code>object</code>
|
|
1222
|
+
Method to get autocomplete data from a datasource
|
|
1223
|
+
|
|
1224
|
+
**Kind**: instance method of [<code>Datasource</code>](#Datasource)
|
|
1225
|
+
**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
|
|
1226
|
+
**Access**: public
|
|
1227
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1228
|
+
|
|
1229
|
+
| Param | Type | Description |
|
|
1230
|
+
| --- | --- | --- |
|
|
1231
|
+
| params | <code>object</code> | Params to add notification token |
|
|
1232
|
+
| params.orgId | <code>string</code> | The user organization _id |
|
|
1233
|
+
| params.dataSources | <code>array.<object></code> | The document type data sources information |
|
|
1234
|
+
| params.dataSources._id | <code>string</code> | The document type data sources _id |
|
|
1235
|
+
| params.dataSources.fields | <code>array.<object></code> | The document type data sources list of fields |
|
|
1236
|
+
| params.documents | <code>array.<object></code> | The document list |
|
|
1237
|
+
| params.documents._id | <code>string</code> | The document _id |
|
|
1238
|
+
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
1239
|
+
|
|
1240
|
+
**Example**
|
|
1241
|
+
```js
|
|
1242
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1243
|
+
const api = new API();
|
|
1244
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1245
|
+
const params = {
|
|
1246
|
+
orgId: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
|
|
1247
|
+
dataSources: [{}],
|
|
1248
|
+
documents: [{}]
|
|
1249
|
+
};
|
|
1250
|
+
const retData = await api.user.datasource.autocomplete(params, session);
|
|
1251
|
+
```
|
|
1252
|
+
<a name="Documents"></a>
|
|
1253
|
+
|
|
1254
|
+
## Documents
|
|
1255
|
+
Class for documents, permission user
|
|
1256
|
+
|
|
1257
|
+
**Kind**: global class
|
|
1258
|
+
|
|
1259
|
+
* [Documents](#Documents)
|
|
1260
|
+
* [.add(params, session)](#Documents+add) ⇒ <code>Promise</code>
|
|
1261
|
+
* [.find(params, session)](#Documents+find) ⇒ <code>Promise</code>
|
|
1262
|
+
* [.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>
|
|
1263
|
+
* [.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>
|
|
1264
|
+
* [.signedUrl(params, session)](#Documents+signedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1265
|
+
* [.signedUrls(params, session)](#Documents+signedUrls) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1266
|
+
* [.uploadSignedDocument(params)](#Documents+uploadSignedDocument) ⇒ <code>Promise.<boolean></code>
|
|
1267
|
+
* [.checkPrimaryKeys(params, session)](#Documents+checkPrimaryKeys) ⇒ <code>Promise.<array></code> \| <code>array.<string></code>
|
|
1268
|
+
* [.searchDocuments(params, session)](#Documents+searchDocuments) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
1269
|
+
|
|
1270
|
+
<a name="Documents+add"></a>
|
|
1271
|
+
|
|
1272
|
+
### documents.add(params, session) ⇒ <code>Promise</code>
|
|
1273
|
+
Create new document
|
|
1274
|
+
|
|
1275
|
+
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1276
|
+
**Access**: public
|
|
1277
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1278
|
+
|
|
1279
|
+
| Param | Type | Default | Description |
|
|
1280
|
+
| --- | --- | --- | --- |
|
|
1281
|
+
| params | <code>object</code> | | Object for add new document |
|
|
1282
|
+
| params.orgname | <code>string</code> | | Organization name |
|
|
1283
|
+
| params.areaId | <code>string</code> | | Doc area id (_id database) |
|
|
1284
|
+
| params.docId | <code>string</code> | | Document id (_id database) |
|
|
1285
|
+
| [params.documentDate] | <code>string</code> | <code>"new Date()"</code> | Date of document |
|
|
1286
|
+
| params.document | <code>string</code> | | The path to the file. If S3, the key to S3, gotten after getting a signed URL |
|
|
1287
|
+
| params.filename | <code>string</code> | | File name |
|
|
1288
|
+
| params.type | <code>string</code> | | Mimetype of the document (image/png) |
|
|
1289
|
+
| params.name | <code>string</code> | | Document name |
|
|
1290
|
+
| [params.content] | <code>string</code> | <code>"''"</code> | Content of document |
|
|
1291
|
+
| [params.description] | <code>string</code> | <code>"''"</code> | Description of document |
|
|
1292
|
+
| [params.category] | <code>string</code> | <code>"''"</code> | Category of document |
|
|
1293
|
+
| [params.tags] | <code>array</code> | <code>[]</code> | Tags of document |
|
|
1294
|
+
| params.docTypeId | <code>string</code> | | Document type id (_id database) |
|
|
1295
|
+
| [params.hasPhisicalStorage] | <code>boolean</code> | <code>false</code> | Has Phisical Storage |
|
|
1296
|
+
| [params.boxId] | <code>string</code> | <code>"''"</code> | Box ID |
|
|
1297
|
+
| [params.storageStatus] | <code>string</code> | <code>"''"</code> | Storage status |
|
|
1298
|
+
| [params.ocrDocumentBackend] | <code>boolean</code> | <code>false</code> | Ocr document backend |
|
|
1299
|
+
| params.bytes | <code>number</code> | | Size document in bytes |
|
|
1300
|
+
| [params.docAreaPermission] | <code>object</code> | <code>{}</code> | Permission to doc area |
|
|
1301
|
+
| [params.docTypeFieldsData] | <code>object</code> | <code>{}</code> | Fields data "extraField' |
|
|
1302
|
+
| params.signedUrl | <code>string</code> | | SIgned URL |
|
|
1303
|
+
| [params.urlType] | <code>string</code> | <code>"'S3'"</code> | URL type |
|
|
1304
|
+
| [params.addType] | <code>string</code> | <code>"'S3_SIGNED'"</code> | Add type |
|
|
1305
|
+
| params.orgId | <code>string</code> | | Organization id (_id database) |
|
|
1306
|
+
| session | <code>string</code> | | Session, token JWT |
|
|
1307
|
+
|
|
1308
|
+
**Example**
|
|
1309
|
+
```js
|
|
1310
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1311
|
+
const api = new API();
|
|
1312
|
+
const params = {
|
|
1313
|
+
orgname: 'cloundbrasil',
|
|
1314
|
+
areaId: '5edf9f8ee896b817e45b8dac',
|
|
1315
|
+
docId: '5edf86fbe896b817e45b8da6',
|
|
1316
|
+
fileName: 'foto',
|
|
1317
|
+
type: 'image/png',
|
|
1318
|
+
name: 'Fotografia',
|
|
1319
|
+
docTypeId = '5edf9f8ee896b817e45b8dac',
|
|
1320
|
+
bytes: 12345,
|
|
1321
|
+
signedUrl: 'https://s3.amazonaws.com...'
|
|
1322
|
+
docTypeFieldsData: {extraUser: '12349f8ee896b817e45b8dac'},
|
|
1323
|
+
orgId: '5df7f19618430c89a41a19d2',
|
|
1324
|
+
};
|
|
1325
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1326
|
+
await api.user.document.add(params, session);
|
|
1327
|
+
```
|
|
1328
|
+
<a name="Documents+find"></a>
|
|
1329
|
+
|
|
1330
|
+
### documents.find(params, session) ⇒ <code>Promise</code>
|
|
1331
|
+
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1332
|
+
**Access**: public
|
|
1333
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1334
|
+
|
|
1335
|
+
| Param | Type | Default | Description |
|
|
1336
|
+
| --- | --- | --- | --- |
|
|
1337
|
+
| params | <code>object</code> | | Object with params |
|
|
1338
|
+
| params.index | <code>string</code> | | Field to search |
|
|
1339
|
+
| params.txtToSearch | <code>string</code> | | Text to search |
|
|
1340
|
+
| [params.compare] | <code>string</code> | <code>"*"</code> | Filter to search (=, ~, *, =*, *=, *?) |
|
|
1341
|
+
| params.docId | <code>string</code> | | Document id for serach |
|
|
1342
|
+
| params.docAreaId | <code>string</code> | | Doc area id |
|
|
1343
|
+
| params.tag | <code>string</code> | | Tag of the document |
|
|
1344
|
+
| [params.projection] | <code>string</code> | <code>"\"\""</code> | Projection to return fields |
|
|
1345
|
+
| [params.sort] | <code>string</code> | <code>"\"Mais+recentes\""</code> | Sort data |
|
|
1346
|
+
| params.orgId | <code>string</code> | | Organization id (_id database) |
|
|
1347
|
+
| params.pagination | <code>string</code> | | Set pagination |
|
|
1348
|
+
| [params.pagination.page] | <code>number</code> | <code>1</code> | Page |
|
|
1349
|
+
| [params.pagination.perPage] | <code>number</code> | <code>100</code> | perPage Itens per page |
|
|
1350
|
+
| session | <code>string</code> | | Session, token JWT |
|
|
1351
|
+
|
|
1352
|
+
**Example**
|
|
1353
|
+
```js
|
|
1354
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1355
|
+
const api = new API();
|
|
1356
|
+
const params - {
|
|
1357
|
+
index: 'extraCity',
|
|
1358
|
+
txtToSearch: 'São',
|
|
1359
|
+
docId: '5df7f19618430c89a41a19d2',
|
|
1360
|
+
docAreaId: '5edd11c46b6ce9729c2c297c',
|
|
1361
|
+
tag: 'Nome da cidade',
|
|
1362
|
+
orgId: '1234d01dc4af3941d42f8c5c'
|
|
1363
|
+
};
|
|
1364
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1365
|
+
await api.user.document.findByIdAndRemove(params, session);
|
|
1366
|
+
```
|
|
1367
|
+
<a name="Documents+findByIdAndRemove"></a>
|
|
1368
|
+
|
|
1369
|
+
### documents.findByIdAndRemove(params, session) ⇒ <code>Promise.<object></code> \| <code>number</code> \| <code>array.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1370
|
+
Remove document by id
|
|
1371
|
+
|
|
1372
|
+
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1373
|
+
**Returns**: <code>Promise.<object></code> - data The returned data<code>number</code> - data.removed The quantity of removed documents<code>array.<object></code> - data.errors Array of errors<code>string</code> - data.errors.id Id of the document that had an error<code>string</code> - data.errors.code Error code<code>string</code> - data.errors.message Error message
|
|
1374
|
+
**Access**: public
|
|
1375
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1376
|
+
|
|
1377
|
+
| Param | Type | Description |
|
|
1378
|
+
| --- | --- | --- |
|
|
1379
|
+
| params | <code>object</code> | Params to remove document |
|
|
1380
|
+
| params.docId | <code>string</code> | Document Id (_id database) |
|
|
1381
|
+
| params.orgId | <code>string</code> | Organizarion id (_id database) |
|
|
1382
|
+
| session | <code>string</code> | Session, token JWT |
|
|
1383
|
+
|
|
1384
|
+
**Example**
|
|
1385
|
+
```js
|
|
1386
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1387
|
+
const api = new API();
|
|
1388
|
+
const params - {
|
|
1389
|
+
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1390
|
+
orgIdId: '5df7f19618430c89a41a19d2',
|
|
1391
|
+
};
|
|
1392
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1393
|
+
await api.user.document.findByIdAndRemove(params, session);
|
|
1394
|
+
```
|
|
1395
|
+
<a name="Documents+findByIdsAndRemove"></a>
|
|
1396
|
+
|
|
1397
|
+
### documents.findByIdsAndRemove(params, session) ⇒ <code>Promise.<object></code> \| <code>number</code> \| <code>array.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1398
|
+
Remove documents
|
|
1399
|
+
|
|
1400
|
+
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1401
|
+
**Returns**: <code>Promise.<object></code> - data The returned data<code>number</code> - data.removed The quantity of removed documents<code>array.<object></code> - data.errors Array of errors<code>string</code> - data.errors.id Id of the document that had an error<code>string</code> - data.errors.code Error code<code>string</code> - data.errors.message Error message
|
|
1402
|
+
**Access**: public
|
|
1403
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1404
|
+
|
|
1405
|
+
| Param | Type | Description |
|
|
1406
|
+
| --- | --- | --- |
|
|
1407
|
+
| params | <code>object</code> | Params to remove document |
|
|
1408
|
+
| params.documents | <code>array.<string></code> | An array ids of documents (_id database) |
|
|
1409
|
+
| params.documents._id | <code>array.<string></code> | The document id (_id database) |
|
|
1410
|
+
| params.orgId | <code>string</code> | Organizarion id (_id database) |
|
|
1411
|
+
| session | <code>string</code> | Session, token JWT |
|
|
1412
|
+
|
|
1413
|
+
**Example**
|
|
1414
|
+
```js
|
|
1415
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1416
|
+
const api = new API();
|
|
1417
|
+
const params - {
|
|
1418
|
+
documents: [{ _id: '5dadd01dc4af3941d42f8c5c' }],
|
|
1419
|
+
orgId: '5df7f19618430c89a41a19d2',
|
|
1420
|
+
};
|
|
1421
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1422
|
+
await api.user.document.findByIdsAndRemove(params, session);
|
|
1423
|
+
```
|
|
1424
|
+
<a name="Documents+signedUrl"></a>
|
|
1425
|
+
|
|
1426
|
+
### documents.signedUrl(params, session) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1427
|
+
Request signed url url to put or get
|
|
1428
|
+
|
|
1429
|
+
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1430
|
+
**Returns**: <code>Promise.<object></code> - doc Returned document data with the signed url<code>string</code> - doc.docId Document id<code>string</code> - doc.name The name of the document, which is the fileName<code>string</code> - doc.areaId docAreaId of the document<code>string</code> - doc.type the document mimi type<code>string</code> - doc.signedUrl the signed URL to upload
|
|
1431
|
+
**Access**: public
|
|
1432
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1433
|
+
|
|
1434
|
+
| Param | Type | Description |
|
|
1435
|
+
| --- | --- | --- |
|
|
1436
|
+
| params | <code>object</code> | Params to request signed url |
|
|
1437
|
+
| params.methodType | <code>string</code> | Method type HTTP get or put |
|
|
1438
|
+
| params.docId | <code>string</code> | Document id |
|
|
1439
|
+
| params.fileName | <code>string</code> | File name |
|
|
1440
|
+
| params.docAreaId | <code>string</code> | docAreaId of the document |
|
|
1441
|
+
| params.type | <code>string</code> | mimeType image/png image/jpg others |
|
|
1442
|
+
| params.document | <code>string</code> | Name document to request if method type is get |
|
|
1443
|
+
| params.orgId | <code>string</code> | Organization id (_id database) |
|
|
1444
|
+
| session | <code>string</code> | Session, token JWT |
|
|
1445
|
+
|
|
1446
|
+
**Example**
|
|
1447
|
+
```js
|
|
1448
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1449
|
+
const api = new API();
|
|
1450
|
+
const params - {
|
|
1451
|
+
methodType: 'put',
|
|
1452
|
+
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1453
|
+
docAreaId: '5df7f19618430c89a41a19d2',
|
|
1454
|
+
fileName: 'Foto',
|
|
1455
|
+
type: 'image/png'
|
|
1456
|
+
orgId: '5df7f19618430c89a41a19f8'
|
|
1457
|
+
};
|
|
1458
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1459
|
+
// each doc: { docId, name, areaId, type, signedUrl }
|
|
1460
|
+
const { docs } = await api.user.document.signedUrl(params, session);
|
|
1461
|
+
```
|
|
1462
|
+
**Example**
|
|
1463
|
+
```js
|
|
1464
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1465
|
+
const api = new API();
|
|
1466
|
+
const params - {
|
|
1467
|
+
methodType: 'get',
|
|
1468
|
+
document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf',
|
|
1469
|
+
};
|
|
1470
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1471
|
+
const base64Data = await api.user.document.signedUrl(params, session);
|
|
1472
|
+
```
|
|
1473
|
+
<a name="Documents+signedUrls"></a>
|
|
1474
|
+
|
|
1475
|
+
### documents.signedUrls(params, session) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1476
|
+
Request signed url url to put or get
|
|
1477
|
+
|
|
1478
|
+
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1479
|
+
**Returns**: <code>Promise.<object></code> - doc Returned document data with the signed url<code>string</code> - doc.docId Document id<code>string</code> - doc.name The name of the document, which is the fileName<code>string</code> - doc.areaId docAreaId of the document<code>string</code> - doc.type the document mimi type<code>string</code> - doc.signedUrl the signed URL to upload
|
|
1480
|
+
**Access**: public
|
|
1481
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1482
|
+
|
|
1483
|
+
| Param | Type | Description |
|
|
1484
|
+
| --- | --- | --- |
|
|
1485
|
+
| params | <code>object</code> | Params to request signed url |
|
|
1486
|
+
| params.docs | <code>array</code> | the list of documents to get the signed urls |
|
|
1487
|
+
| params.docs.docId | <code>string</code> | Document id |
|
|
1488
|
+
| params.docs.name | <code>string</code> | File name |
|
|
1489
|
+
| params.docs.areaId | <code>string</code> | docAreaId of the document |
|
|
1490
|
+
| params.docs.type | <code>string</code> | mimeType image/png image/jpg others |
|
|
1491
|
+
| params.docs.document | <code>string</code> | Name document to request if method type is get |
|
|
1492
|
+
| params.methodType | <code>string</code> | Method type HTTP get or put |
|
|
1493
|
+
| params.orgId | <code>string</code> | Organization id (_id database) |
|
|
1494
|
+
| session | <code>string</code> | Session, token JWT |
|
|
1495
|
+
|
|
1496
|
+
**Example**
|
|
1497
|
+
```js
|
|
1498
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1499
|
+
const api = new API();
|
|
1500
|
+
const params - {
|
|
1501
|
+
methodType: 'put',
|
|
1502
|
+
orgId: '5df7f19618430c89a41a19f8'
|
|
1503
|
+
docs: [
|
|
1504
|
+
{
|
|
1505
|
+
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1506
|
+
areaId: '5df7f19618430c89a41a19d2',
|
|
1507
|
+
name: 'Foto.png',
|
|
1508
|
+
type: 'image/png'
|
|
1509
|
+
}
|
|
1510
|
+
]
|
|
1511
|
+
};
|
|
1512
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1513
|
+
// each doc: { docId, name, areaId, type, signedUrl }
|
|
1514
|
+
const { docs } = await api.user.document.signedUrls(params, session);
|
|
1515
|
+
```
|
|
1516
|
+
**Example**
|
|
1517
|
+
```js
|
|
1518
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1519
|
+
const api = new API();
|
|
1520
|
+
const params - {
|
|
1521
|
+
methodType: 'get',
|
|
1522
|
+
docs: [
|
|
1523
|
+
{ document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf' }
|
|
1524
|
+
],
|
|
1525
|
+
};
|
|
1526
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1527
|
+
const base64Data = await api.user.document.signedUrls(params, session);
|
|
1528
|
+
```
|
|
1529
|
+
<a name="Documents+uploadSignedDocument"></a>
|
|
1530
|
+
|
|
1531
|
+
### documents.uploadSignedDocument(params) ⇒ <code>Promise.<boolean></code>
|
|
1532
|
+
Uploads the file
|
|
1533
|
+
|
|
1534
|
+
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1535
|
+
**Returns**: <code>Promise.<boolean></code> - True if success
|
|
1536
|
+
**Access**: public
|
|
1537
|
+
|
|
1538
|
+
| Param | Type | Description |
|
|
1539
|
+
| --- | --- | --- |
|
|
1540
|
+
| params | <code>object</code> | Params to upload document |
|
|
1541
|
+
| params.content | <code>buffer</code> | The content of the file (Buffer) |
|
|
1542
|
+
| params.signedUrl | <code>string</code> | The signed URL |
|
|
1543
|
+
| params.type | <code>string</code> | The file mime type |
|
|
1544
|
+
| params.onUploadProgress | <code>string</code> | A callback for the upload progress. It will return a progressEvent. |
|
|
1545
|
+
|
|
1546
|
+
**Example**
|
|
1547
|
+
```js
|
|
1548
|
+
const FS = require('fs');
|
|
1549
|
+
const Path = require('path');
|
|
1550
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1551
|
+
const api = new API();
|
|
1552
|
+
const params - {
|
|
1553
|
+
content: FS.readFileSync(Path.join(__dirname, '.mypdf.pdf')),
|
|
1554
|
+
signedUrl: 'https://signedurl.com/token...',
|
|
1555
|
+
type: 'application/pdf'
|
|
1556
|
+
};
|
|
1557
|
+
const retData = await api.user.document.uploadSignedDocument(params);
|
|
1558
|
+
|
|
1559
|
+
onUploadProgress return the progressEvent
|
|
1560
|
+
- lengthComputable: A Boolean that indicates whether or not the total number of bytes is known.
|
|
1561
|
+
- loaded: The number of bytes of the file that have been uploaded.
|
|
1562
|
+
- total: The total number of bytes in the file.
|
|
1563
|
+
```
|
|
1564
|
+
<a name="Documents+checkPrimaryKeys"></a>
|
|
1565
|
+
|
|
1566
|
+
### documents.checkPrimaryKeys(params, session) ⇒ <code>Promise.<array></code> \| <code>array.<string></code>
|
|
1567
|
+
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1568
|
+
**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
|
|
1569
|
+
**Access**: public
|
|
1570
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1571
|
+
Checks if a document can be added and it does not repeat its primary key
|
|
1572
|
+
|
|
1573
|
+
| Param | Type | Description |
|
|
1574
|
+
| --- | --- | --- |
|
|
1575
|
+
| params | | |
|
|
1576
|
+
| params.orgId | <code>string</code> | the organization id |
|
|
1577
|
+
| params.docTypeId | <code>string</code> | the id of the doc type |
|
|
1578
|
+
| params.docs | <code>array.<object></code> | an array of documents |
|
|
1579
|
+
| params.docs.id | <code>string</code> | an unique id representing the document |
|
|
1580
|
+
| params.docs.docTypeFields | <code>object</code> | thje docTypeFields of the document |
|
|
1581
|
+
| params.docs.docTypeFieldsData | <code>object</code> | thje docTypeFieldsData of the document |
|
|
1582
|
+
| session | | |
|
|
1583
|
+
|
|
1584
|
+
**Example**
|
|
1585
|
+
```js
|
|
1586
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1587
|
+
const api = new API();
|
|
1588
|
+
const docTypeFields = [...]; // the doc type fields array
|
|
1589
|
+
const docTypeFieldsData = {...}; // the data of this fields
|
|
1590
|
+
const params - {
|
|
1591
|
+
docs: [{ id: '5dadd01dc4af3941d42f8c5c', docTypeFields, docTypeFieldsData }],
|
|
1592
|
+
orgId: '5df7f19618430c89a41a19d2',
|
|
1593
|
+
docTypeId: '5df7f19618430c89a41a19d5',
|
|
1594
|
+
};
|
|
1595
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1596
|
+
const retDocs = await api.user.document.checkPrimaryKeys(params, session);
|
|
1597
|
+
```
|
|
1598
|
+
<a name="Documents+searchDocuments"></a>
|
|
1599
|
+
|
|
1600
|
+
### documents.searchDocuments(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
1601
|
+
Method to search documents for
|
|
1602
|
+
|
|
1603
|
+
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1604
|
+
**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
|
|
1605
|
+
**Access**: public
|
|
1606
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1607
|
+
|
|
1608
|
+
| Param | Type | Description |
|
|
1609
|
+
| --- | --- | --- |
|
|
1610
|
+
| params | <code>object</code> | Params to search the documents |
|
|
1611
|
+
| params.query | <code>object</code> | Search documents query |
|
|
1612
|
+
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
1613
|
+
| session | <code>string</code> | Session, token JWT |
|
|
1614
|
+
|
|
1615
|
+
**Example**
|
|
1616
|
+
```js
|
|
1617
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1618
|
+
const api = new API();
|
|
1619
|
+
const params = {
|
|
1620
|
+
query: {p: 20, i: 1, s: 'Mais recentes', as: '', m: 'w', ai: '57e6a3bd6be6b45210833fae'},
|
|
1621
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
1622
|
+
};
|
|
1623
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1624
|
+
const retSearch = await api.user.document.searchDocuments(params, session);
|
|
1625
|
+
```
|
|
1626
|
+
<a name="Users"></a>
|
|
1627
|
+
|
|
1628
|
+
## Users
|
|
1629
|
+
API request, user permission level
|
|
1630
|
+
|
|
1631
|
+
**Kind**: global class
|
|
1632
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1633
|
+
|
|
1634
|
+
* [Users](#Users)
|
|
1635
|
+
* [new Users(options)](#new_Users_new)
|
|
1636
|
+
* [new Users(options)](#new_Users_new)
|
|
1637
|
+
|
|
1638
|
+
<a name="new_Users_new"></a>
|
|
1639
|
+
|
|
1640
|
+
### new Users(options)
|
|
1641
|
+
|
|
1642
|
+
| Param | Type | Description |
|
|
1643
|
+
| --- | --- | --- |
|
|
1644
|
+
| options | <code>object</code> | Params of the constructor |
|
|
1645
|
+
| options.parent | <code>object</code> | This of the pararent |
|
|
1646
|
+
|
|
1647
|
+
<a name="new_Users_new"></a>
|
|
1648
|
+
|
|
1649
|
+
### new Users(options)
|
|
1650
|
+
|
|
1651
|
+
| Param | Type | Description |
|
|
1652
|
+
| --- | --- | --- |
|
|
1653
|
+
| options | <code>object</code> | Params of the constructor |
|
|
1654
|
+
| options.parent | <code>object</code> | This of the pararent |
|
|
1655
|
+
|
|
1656
|
+
<a name="Notification"></a>
|
|
1657
|
+
|
|
1658
|
+
## Notification
|
|
1659
|
+
Class for user registration in a user
|
|
1660
|
+
|
|
1661
|
+
**Kind**: global class
|
|
1662
|
+
|
|
1663
|
+
* [Notification](#Notification)
|
|
1664
|
+
* [.tokenTypes](#Notification+tokenTypes) ⇒ <code>Object</code>
|
|
1665
|
+
* [.addToken(params, session)](#Notification+addToken) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1666
|
+
|
|
1667
|
+
<a name="Notification+tokenTypes"></a>
|
|
1668
|
+
|
|
1669
|
+
### notification.tokenTypes ⇒ <code>Object</code>
|
|
1670
|
+
Notification token types
|
|
1671
|
+
|
|
1672
|
+
**Kind**: instance property of [<code>Notification</code>](#Notification)
|
|
1673
|
+
<a name="Notification+addToken"></a>
|
|
1674
|
+
|
|
1675
|
+
### notification.addToken(params, session) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1676
|
+
Method to add a notification token
|
|
1677
|
+
|
|
1678
|
+
**Kind**: instance method of [<code>Notification</code>](#Notification)
|
|
1679
|
+
**Returns**: <code>promise.<object></code> - data<code>boolean</code> - data._id the id of the added token
|
|
1680
|
+
**Access**: public
|
|
1681
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1682
|
+
|
|
1683
|
+
| Param | Type | Description |
|
|
1684
|
+
| --- | --- | --- |
|
|
1685
|
+
| params | <code>object</code> | Params to add notification token |
|
|
1686
|
+
| params.token | <code>string</code> | The token |
|
|
1687
|
+
| params.type | <code>object</code> | The token type |
|
|
1688
|
+
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
1689
|
+
|
|
1690
|
+
**Example**
|
|
1691
|
+
```js
|
|
1692
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1693
|
+
const api = new API();
|
|
1694
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1695
|
+
const params = {
|
|
1696
|
+
token: 'V6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz2',
|
|
1697
|
+
type: 'FCM_WEB'
|
|
1698
|
+
};
|
|
1699
|
+
const retData = await api.user.notification.addToken(params, session);
|
|
1700
|
+
```
|
|
1701
|
+
<a name="Organization"></a>
|
|
1702
|
+
|
|
1703
|
+
## Organization
|
|
1704
|
+
Class for organizations, permission user
|
|
1705
|
+
|
|
1706
|
+
**Kind**: global class
|
|
1707
|
+
|
|
1708
|
+
* [Organization](#Organization)
|
|
1709
|
+
* [.upsertAvatar(params, session)](#Organization+upsertAvatar) ⇒ <code>Promise</code>
|
|
1710
|
+
* [.removeAvatar(session)](#Organization+removeAvatar) ⇒ <code>Promise</code>
|
|
1711
|
+
* [.findById(orgId, session)](#Organization+findById)
|
|
1712
|
+
* [.idCardExist(idcard, session)](#Organization+idCardExist)
|
|
1713
|
+
* [.upsertAvatar(params, session)](#Organization+upsertAvatar) ⇒ <code>Promise</code>
|
|
1714
|
+
* [.removeAvatar(session)](#Organization+removeAvatar) ⇒ <code>Promise</code>
|
|
1715
|
+
* [.callFetch(params)](#Organization+callFetch) ⇒ <code>promise</code>
|
|
1716
|
+
|
|
1717
|
+
<a name="Organization+upsertAvatar"></a>
|
|
1718
|
+
|
|
1719
|
+
### organization.upsertAvatar(params, session) ⇒ <code>Promise</code>
|
|
1720
|
+
Update avatar of organization by session of user not allow session user SU
|
|
1721
|
+
|
|
1722
|
+
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
1723
|
+
**Access**: public
|
|
1724
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1725
|
+
|
|
1726
|
+
| Param | Type | Description |
|
|
1727
|
+
| --- | --- | --- |
|
|
1728
|
+
| params | <code>object</code> | Params to update avatar |
|
|
1729
|
+
| params.orgId | <code>string</code> | Organization id |
|
|
1730
|
+
| params.avatar | <code>string</code> | Image in base64 to update |
|
|
1731
|
+
| params.type | <code>string</code> | MimeType (image/png) |
|
|
1732
|
+
| session | <code>string</code> | Is token JWT of user SU |
|
|
1733
|
+
|
|
1734
|
+
**Example**
|
|
1735
|
+
```js
|
|
1736
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1737
|
+
const api = new API();
|
|
1738
|
+
const params = {
|
|
1739
|
+
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
1740
|
+
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
1741
|
+
type: 'image/png',
|
|
1742
|
+
};
|
|
1743
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1744
|
+
await api.admin.organizations.upsertAvatar(params, session);
|
|
1745
|
+
```
|
|
1746
|
+
<a name="Organization+removeAvatar"></a>
|
|
1747
|
+
|
|
1748
|
+
### organization.removeAvatar(session) ⇒ <code>Promise</code>
|
|
1749
|
+
Remove avatar of user by session of user not allow session user SU
|
|
1750
|
+
|
|
1751
|
+
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
1752
|
+
**Access**: public
|
|
1753
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1754
|
+
|
|
1755
|
+
| Param | Type | Description |
|
|
1756
|
+
| --- | --- | --- |
|
|
1757
|
+
| params.orgId | <code>string</code> | Organization id |
|
|
1758
|
+
| session | <code>string</code> | Is token JWT of user SU |
|
|
1759
|
+
|
|
1760
|
+
**Example**
|
|
1761
|
+
```js
|
|
1762
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1763
|
+
const api = new API();
|
|
1764
|
+
const orgId = '5dadd01dc4af3941d42f8c5c';
|
|
1765
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1766
|
+
await api.admin.organizations.removeAvatar(orgId, session);
|
|
1767
|
+
```
|
|
1768
|
+
<a name="Organization+findById"></a>
|
|
1769
|
+
|
|
1770
|
+
### organization.findById(orgId, session)
|
|
1771
|
+
Find organization by id
|
|
1772
|
+
|
|
1773
|
+
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
1774
|
+
**Access**: public
|
|
1775
|
+
**Author**: Augusto Pissarra <abernardo.br@gmail.com>
|
|
1776
|
+
|
|
1777
|
+
| Param | Type | Description |
|
|
1778
|
+
| --- | --- | --- |
|
|
1779
|
+
| orgId | <code>string</code> | ID of the organization to find (_id database) |
|
|
1780
|
+
| session | <code>string</code> | Is token JWT |
|
|
1781
|
+
|
|
1782
|
+
**Example**
|
|
1783
|
+
```js
|
|
1784
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1785
|
+
const api = new API();
|
|
1786
|
+
const orgId = '80443245000122';
|
|
1787
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1788
|
+
await api.user.organization.findById(idCard, session);
|
|
1789
|
+
```
|
|
1790
|
+
<a name="Organization+idCardExist"></a>
|
|
1791
|
+
|
|
1792
|
+
### organization.idCardExist(idcard, session)
|
|
1793
|
+
Check if id card exist
|
|
1794
|
+
|
|
1795
|
+
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
1796
|
+
**Access**: public
|
|
1797
|
+
**Author**: Augusto Pissarra <abernardo.br@gmail.com>
|
|
1798
|
+
|
|
1799
|
+
| Param | Type | Description |
|
|
1800
|
+
| --- | --- | --- |
|
|
1801
|
+
| idcard | <code>string</code> | Check if id card exist |
|
|
1802
|
+
| session | <code>string</code> | Is token JWT |
|
|
1803
|
+
|
|
1804
|
+
**Example**
|
|
1805
|
+
```js
|
|
1806
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1807
|
+
const api = new API();
|
|
1808
|
+
const idCard = '80443245000122';
|
|
1809
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1810
|
+
await api.user.organization.idCardExist(idCard, session);
|
|
1811
|
+
```
|
|
1812
|
+
<a name="Organization+upsertAvatar"></a>
|
|
1813
|
+
|
|
1814
|
+
### organization.upsertAvatar(params, session) ⇒ <code>Promise</code>
|
|
1815
|
+
Update avatar of organization by session of user not allow session user SU
|
|
1816
|
+
|
|
1817
|
+
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
1818
|
+
**Access**: public
|
|
1819
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1820
|
+
|
|
1821
|
+
| Param | Type | Description |
|
|
1822
|
+
| --- | --- | --- |
|
|
1823
|
+
| params | <code>object</code> | Params to update avatar |
|
|
1824
|
+
| params.avatar | <code>string</code> | Image in base64 to update |
|
|
1825
|
+
| params.type | <code>string</code> | mimeType (image/png) |
|
|
1826
|
+
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
1827
|
+
|
|
1828
|
+
**Example**
|
|
1829
|
+
```js
|
|
1830
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1831
|
+
const api = new API();
|
|
1832
|
+
const params = {
|
|
1833
|
+
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
1834
|
+
type: 'image/png',
|
|
1835
|
+
};
|
|
1836
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1837
|
+
await api.user.profile.updateAvatar(params, session);
|
|
1838
|
+
```
|
|
1839
|
+
<a name="Organization+removeAvatar"></a>
|
|
1840
|
+
|
|
1841
|
+
### organization.removeAvatar(session) ⇒ <code>Promise</code>
|
|
1842
|
+
Remove avatar of user by session of user not allow session user SU
|
|
1843
|
+
|
|
1844
|
+
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
1845
|
+
**Access**: public
|
|
1846
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1847
|
+
|
|
1848
|
+
| Param | Type | Description |
|
|
1849
|
+
| --- | --- | --- |
|
|
1850
|
+
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
1851
|
+
|
|
1852
|
+
**Example**
|
|
1853
|
+
```js
|
|
1854
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1855
|
+
const api = new API();
|
|
1856
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1857
|
+
await api.user.profile.removeAvatar(session);
|
|
1858
|
+
```
|
|
1859
|
+
<a name="Organization+callFetch"></a>
|
|
1860
|
+
|
|
1861
|
+
### organization.callFetch(params) ⇒ <code>promise</code>
|
|
1862
|
+
Call URL internal, need auth JWT (session)
|
|
1863
|
+
|
|
1864
|
+
**Kind**: instance method of [<code>Organization</code>](#Organization)
|
|
1865
|
+
**Access**: public
|
|
1866
|
+
**Author**: Thiago Anselmo <thiagoo.anselmoo@gmail.com>
|
|
1867
|
+
|
|
1868
|
+
| Param | Type | Default | Description |
|
|
1869
|
+
| --- | --- | --- | --- |
|
|
1870
|
+
| params | <code>object</code> | | Params to call fectch (URL internal) |
|
|
1871
|
+
| params.url | <code>string</code> | | URL to call |
|
|
1872
|
+
| [params.method] | <code>string</code> | <code>"POST"</code> | Fetch Method |
|
|
1873
|
+
| params.payload | <code>string</code> | | Payload to send system manager |
|
|
1874
|
+
|
|
1875
|
+
**Example**
|
|
1876
|
+
```js
|
|
1877
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1878
|
+
const api = new API();
|
|
1879
|
+
|
|
1880
|
+
const params = {
|
|
1881
|
+
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
1882
|
+
method: 'POST'
|
|
1883
|
+
}
|
|
1884
|
+
await api.user.organization.callFetchs(params, session);
|
|
1885
|
+
```
|
|
1886
|
+
<a name="Process"></a>
|
|
1887
|
+
|
|
1888
|
+
## Process
|
|
1889
|
+
Class for process, permission user
|
|
1890
|
+
|
|
1891
|
+
**Kind**: global class
|
|
1892
|
+
|
|
1893
|
+
* [Process](#Process)
|
|
1894
|
+
* [.start(params, session)](#Process+start) ⇒ <code>Promise</code>
|
|
1895
|
+
* [.getProcessProperties(params, session)](#Process+getProcessProperties) ⇒ <code>Promise</code>
|
|
1896
|
+
* [.getOrgProcessSearchInfo(params, session)](#Process+getOrgProcessSearchInfo) ⇒ <code>Promise</code> \| <code>string</code> \| <code>object</code> \| <code>object</code> \| <code>object</code> \| <code>string</code>
|
|
1897
|
+
|
|
1898
|
+
<a name="Process+start"></a>
|
|
1899
|
+
|
|
1900
|
+
### process.start(params, session) ⇒ <code>Promise</code>
|
|
1901
|
+
Start process
|
|
1902
|
+
|
|
1903
|
+
**Kind**: instance method of [<code>Process</code>](#Process)
|
|
1904
|
+
**Access**: public
|
|
1905
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1906
|
+
|
|
1907
|
+
| Param | Type | Default | Description |
|
|
1908
|
+
| --- | --- | --- | --- |
|
|
1909
|
+
| params | <code>object</code> | | Params to start process |
|
|
1910
|
+
| params.processId | <code>string</code> | | Process id (_id database); |
|
|
1911
|
+
| params.orgId | <code>string</code> | | Organization id (_id database); |
|
|
1912
|
+
| [params.payload] | <code>object</code> | <code>{}</code> | Start process with data |
|
|
1913
|
+
| session | <code>string</code> | | Session, token JWT |
|
|
1914
|
+
|
|
1915
|
+
**Example**
|
|
1916
|
+
```js
|
|
1917
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1918
|
+
const api = new API();
|
|
1919
|
+
const params = {
|
|
1920
|
+
processId: '5dadd01dc4af3941d42f8c5c',
|
|
1921
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
1922
|
+
payload: {}
|
|
1923
|
+
}
|
|
1924
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1925
|
+
await api.user.process.start(params, session);
|
|
1926
|
+
```
|
|
1927
|
+
<a name="Process+getProcessProperties"></a>
|
|
1928
|
+
|
|
1929
|
+
### process.getProcessProperties(params, session) ⇒ <code>Promise</code>
|
|
1930
|
+
Get process properties of process
|
|
1931
|
+
|
|
1932
|
+
**Kind**: instance method of [<code>Process</code>](#Process)
|
|
1933
|
+
**Access**: public
|
|
1934
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1935
|
+
|
|
1936
|
+
| Param | Type | Description |
|
|
1937
|
+
| --- | --- | --- |
|
|
1938
|
+
| params | <code>object</code> | Params to get process properties |
|
|
1939
|
+
| params.processId | <code>string</code> | Process id (_id database); |
|
|
1940
|
+
| params.orgId | <code>string</code> | Organization id (_id database); |
|
|
1941
|
+
| session | <code>string</code> | Session, token JWT |
|
|
1942
|
+
|
|
1943
|
+
**Example**
|
|
1944
|
+
```js
|
|
1945
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1946
|
+
const api = new API();
|
|
1947
|
+
const params = {
|
|
1948
|
+
processId: '5dadd01dc4af3941d42f8c5c',
|
|
1949
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
1950
|
+
}
|
|
1951
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1952
|
+
await api.user.process.getProcessProperties(params, session);
|
|
1953
|
+
```
|
|
1954
|
+
<a name="Process+getOrgProcessSearchInfo"></a>
|
|
1955
|
+
|
|
1956
|
+
### process.getOrgProcessSearchInfo(params, session) ⇒ <code>Promise</code> \| <code>string</code> \| <code>object</code> \| <code>object</code> \| <code>object</code> \| <code>string</code>
|
|
1957
|
+
Get the search info of a organization process
|
|
1958
|
+
|
|
1959
|
+
**Kind**: instance method of [<code>Process</code>](#Process)
|
|
1960
|
+
**Returns**: <code>Promise</code> - the search info result<code>string</code> - name the name of the organization process<code>object</code> - processIndexFields the list of fields to index<code>object</code> - processParticipantsGroup the permissions in this organization process<code>object</code> - stepsProperties the organization process steps properties<code>string</code> - _id the same organization id
|
|
1961
|
+
@
|
|
1962
|
+
**Access**: public
|
|
1963
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1964
|
+
|
|
1965
|
+
| Param | Type | Description |
|
|
1966
|
+
| --- | --- | --- |
|
|
1967
|
+
| params | <code>object</code> | Params to get search info |
|
|
1968
|
+
| params.orgProcessId | <code>string</code> | The id of an organization process (_id database); |
|
|
1969
|
+
| params.orgId | <code>string</code> | Organization id (_id database); |
|
|
1970
|
+
| session | <code>string</code> | Session, token JWT |
|
|
1971
|
+
|
|
1972
|
+
**Example**
|
|
1973
|
+
```js
|
|
1974
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1975
|
+
const api = new API();
|
|
1976
|
+
const params = {
|
|
1977
|
+
orgProcessId: '5dadd01dc4af3941d42f8c67',
|
|
1978
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
1979
|
+
}
|
|
1980
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1981
|
+
const retSearchInfo = await api.user.process.getOrgProcessSearchInfo(params, session);
|
|
1982
|
+
```
|
|
1983
|
+
<a name="Register"></a>
|
|
1984
|
+
|
|
1985
|
+
## Register
|
|
1986
|
+
Class for user registration in a user
|
|
1987
|
+
|
|
1988
|
+
**Kind**: global class
|
|
1989
|
+
|
|
1990
|
+
* [Register](#Register)
|
|
1991
|
+
* [.getOrgname()](#Register+getOrgname) ⇒ <code>string</code>
|
|
1992
|
+
* [.validateEmail(params)](#Register+validateEmail) ⇒ <code>promise.<object></code> \| <code>boolean</code> \| <code>boolean</code> \| <code>string</code> \| <code>object</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>object</code> \| <code>string</code> \| <code>string</code>
|
|
1993
|
+
* [.execute(params)](#Register+execute) ⇒ <code>promise.<object></code> \| <code>boolean</code> \| <code>boolean</code> \| <code>object</code> \| <code>string</code>
|
|
1994
|
+
|
|
1995
|
+
<a name="Register+getOrgname"></a>
|
|
1996
|
+
|
|
1997
|
+
### register.getOrgname() ⇒ <code>string</code>
|
|
1998
|
+
**Kind**: instance method of [<code>Register</code>](#Register)
|
|
1999
|
+
**Returns**: <code>string</code> - orgname The orgname of the organization in the registerId
|
|
2000
|
+
**Access**: public
|
|
2001
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2002
|
+
|
|
2003
|
+
| Param | Type | Description |
|
|
2004
|
+
| --- | --- | --- |
|
|
2005
|
+
| params.registerId | <code>object</code> | The registerId that comes with the registration page context |
|
|
2006
|
+
|
|
2007
|
+
**Example**
|
|
2008
|
+
```js
|
|
2009
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2010
|
+
const api = new API();
|
|
2011
|
+
const params = {
|
|
2012
|
+
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...'
|
|
2013
|
+
};
|
|
2014
|
+
const orgname = await api.user.register.getOrgname(params);
|
|
2015
|
+
```
|
|
2016
|
+
<a name="Register+validateEmail"></a>
|
|
2017
|
+
|
|
2018
|
+
### register.validateEmail(params) ⇒ <code>promise.<object></code> \| <code>boolean</code> \| <code>boolean</code> \| <code>string</code> \| <code>object</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>object</code> \| <code>string</code> \| <code>string</code>
|
|
2019
|
+
Method to find task by id
|
|
2020
|
+
|
|
2021
|
+
**Kind**: instance method of [<code>Register</code>](#Register)
|
|
2022
|
+
**Returns**: <code>promise.<object></code> - data<code>boolean</code> - data.success If the operation was successfully done (true|false)<code>boolean</code> - data.userAlreadyExists If the user already exists (true|false), if true, then the other information is not returned<code>string</code> - data.registrationEmailInfoRaw The fully cryptographed registration information<code>object</code> - data.registrationEmailInfo The registration information<code>string</code> - data.registrationEmailInfo.orgname The orgname<code>string</code> - data.registrationEmailInfo.orgId The orgId of the organization<code>string</code> - data.registrationEmailInfo.guid The unique id for the registration<code>object</code> - data.registrationEmailInfo.emailValidation The email validation information<code>string</code> - data.registrationEmailInfo.emailValidation.email The email that the code was sent to<code>string</code> - data.registrationEmailInfo.emailValidation.code The 4 digit code to validate the email
|
|
2023
|
+
**Access**: public
|
|
2024
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2025
|
+
|
|
2026
|
+
| Param | Type | Description |
|
|
2027
|
+
| --- | --- | --- |
|
|
2028
|
+
| params | <code>object</code> | Params to get task |
|
|
2029
|
+
| params.registerId | <code>string</code> | The registerId that comes with the registration page context |
|
|
2030
|
+
| params.email | <code>object</code> | The email to validate |
|
|
2031
|
+
|
|
2032
|
+
**Example**
|
|
2033
|
+
```js
|
|
2034
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2035
|
+
const api = new API();
|
|
2036
|
+
const params = {
|
|
2037
|
+
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2038
|
+
email: 'myemail@company.com'
|
|
2039
|
+
};
|
|
2040
|
+
const retData = await api.user.register.validateEmail(params);
|
|
2041
|
+
```
|
|
2042
|
+
<a name="Register+execute"></a>
|
|
2043
|
+
|
|
2044
|
+
### register.execute(params) ⇒ <code>promise.<object></code> \| <code>boolean</code> \| <code>boolean</code> \| <code>object</code> \| <code>string</code>
|
|
2045
|
+
Method to register a user
|
|
2046
|
+
|
|
2047
|
+
**Kind**: instance method of [<code>Register</code>](#Register)
|
|
2048
|
+
**Returns**: <code>promise.<object></code> - data<code>boolean</code> - data.success If the operation was successfully done (true|false)<code>boolean</code> - data.userAlreadyExists If the user already exists (true|false), if true, then the other information is not returned<code>object</code> - auth The full authentication data with session, if login is true.<code>string</code> - auth.redirectUrl The url to redirect.
|
|
2049
|
+
**Access**: public
|
|
2050
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2051
|
+
|
|
2052
|
+
| Param | Type | Default | Description |
|
|
2053
|
+
| --- | --- | --- | --- |
|
|
2054
|
+
| params | <code>object</code> | | Params to get task |
|
|
2055
|
+
| params.registerId | <code>string</code> | | The registerId that comes with the registration page context |
|
|
2056
|
+
| params.type | <code>string</code> | <code>"sign"</code> | The type of the registration. By defailt, |
|
|
2057
|
+
| params.login | <code>boolean</code> | <code>false</code> | If we want to login the user directly after registering the user successfully. If you have a redirect, the best option is to login automatically. |
|
|
2058
|
+
| params.emailInfo | <code>object</code> | | The information for the email validation |
|
|
2059
|
+
| params.emailInfo.email | <code>string</code> | | The email validation information |
|
|
2060
|
+
| params.emailInfo.code | <code>string</code> | | The 4 digit code to validate the email |
|
|
2061
|
+
| params.registerData | <code>object</code> | | The registration data |
|
|
2062
|
+
| params.registerData.name | <code>string</code> | | The name if the user |
|
|
2063
|
+
| params.registerData.registerEmail | <code>string</code> | | The email of the user |
|
|
2064
|
+
| params.registerData.phone | <code>string</code> | | The phone of the user |
|
|
2065
|
+
| params.registerData.idcard | <code>string</code> | | The ID card of the user |
|
|
2066
|
+
| params.registerData.registerPassword | <code>string</code> | | The user password in open text |
|
|
2067
|
+
| params.registerData.emailValidationCode | <code>string</code> | | The code used to validate the email |
|
|
2068
|
+
| params.registerData.phoneValidationCode | <code>string</code> | | The code used to validate the phone |
|
|
2069
|
+
| params.registerData.language | <code>string</code> | | The defaulf navigator language (i.e.: navigator.language) |
|
|
2070
|
+
| params.registerData.timezone | <code>string</code> | | The defaulf navigator timezone (i.e.: Intl.DateTimeFormat().resolvedOptions().timeZone) |
|
|
2071
|
+
|
|
2072
|
+
**Example**
|
|
2073
|
+
```js
|
|
2074
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2075
|
+
const api = new API();
|
|
2076
|
+
const params ={
|
|
2077
|
+
"registerId": 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2078
|
+
"type": 'sign',
|
|
2079
|
+
"login": false,
|
|
2080
|
+
"emailInfo": {
|
|
2081
|
+
"code": "5974",
|
|
2082
|
+
"email": "cbtoto_1@mailinator.com"
|
|
2083
|
+
},
|
|
2084
|
+
"registerData": {
|
|
2085
|
+
"name": "Augusto Totlo",
|
|
2086
|
+
"registerEmail": "cbtoto_1@mailinator.com",
|
|
2087
|
+
"phone": "",
|
|
2088
|
+
"idcard": "",
|
|
2089
|
+
"dob": "1978-01-12T03:00:00.000Z",
|
|
2090
|
+
"registerPassword": "123456",
|
|
2091
|
+
"emailValidationCode": "5974",
|
|
2092
|
+
"phoneValidationCode": "",
|
|
2093
|
+
"language": "en-US",
|
|
2094
|
+
"timezone": "Europe/Dublin"
|
|
2095
|
+
}
|
|
2096
|
+
};
|
|
2097
|
+
const retData = await api.user.register.execute(params);
|
|
2098
|
+
```
|
|
2099
|
+
<a name="Task"></a>
|
|
2100
|
+
|
|
2101
|
+
## Task
|
|
2102
|
+
Class for task, permission user
|
|
2103
|
+
|
|
2104
|
+
**Kind**: global class
|
|
2105
|
+
|
|
2106
|
+
* [Task](#Task)
|
|
2107
|
+
* [.findById(params, session)](#Task+findById) ⇒ <code>promise</code>
|
|
2108
|
+
* [.findByIdAndUpdate(params, session)](#Task+findByIdAndUpdate) ⇒ <code>Promise</code>
|
|
2109
|
+
* [.executeActionFinalize(params, session)](#Task+executeActionFinalize) ⇒ <code>Promise</code>
|
|
2110
|
+
|
|
2111
|
+
<a name="Task+findById"></a>
|
|
2112
|
+
|
|
2113
|
+
### task.findById(params, session) ⇒ <code>promise</code>
|
|
2114
|
+
Method to find task by id
|
|
2115
|
+
|
|
2116
|
+
**Kind**: instance method of [<code>Task</code>](#Task)
|
|
2117
|
+
**Access**: public
|
|
2118
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2119
|
+
|
|
2120
|
+
| Param | Type | Description |
|
|
2121
|
+
| --- | --- | --- |
|
|
2122
|
+
| params | <code>object</code> | Params to get task |
|
|
2123
|
+
| params.processId | <code>object</code> | Proccess id (_id database) |
|
|
2124
|
+
| params.taskId | <code>object</code> | Task id (_id database) |
|
|
2125
|
+
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
2126
|
+
| session | <code>string</code> | Session, token JWT |
|
|
2127
|
+
|
|
2128
|
+
**Example**
|
|
2129
|
+
```js
|
|
2130
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2131
|
+
const api = new API();
|
|
2132
|
+
const params = {
|
|
2133
|
+
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2134
|
+
taskId: '5df7f19618430c89a41a19d2',
|
|
2135
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2136
|
+
};
|
|
2137
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2138
|
+
await api.user.task.findById(params, session);
|
|
2139
|
+
```
|
|
2140
|
+
<a name="Task+findByIdAndUpdate"></a>
|
|
2141
|
+
|
|
2142
|
+
### task.findByIdAndUpdate(params, session) ⇒ <code>Promise</code>
|
|
2143
|
+
Find task by id and update
|
|
2144
|
+
|
|
2145
|
+
**Kind**: instance method of [<code>Task</code>](#Task)
|
|
2146
|
+
**Access**: public
|
|
2147
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2148
|
+
|
|
2149
|
+
| Param | Type | Description |
|
|
2150
|
+
| --- | --- | --- |
|
|
2151
|
+
| params | <code>object</code> | Params to update task |
|
|
2152
|
+
| params.userId | <code>object</code> | User id (_id database) |
|
|
2153
|
+
| params.processId | <code>string</code> | Proccess id (_id database) |
|
|
2154
|
+
| params.taskId | <code>string</code> | Task id (_id database) |
|
|
2155
|
+
| params.flowName | <code>string</code> | Flow name |
|
|
2156
|
+
| params.action | <code>string</code> | Button action |
|
|
2157
|
+
| params.formData | <code>object</code> | Data to update task |
|
|
2158
|
+
| [params.actionGuid] | <code>string</code> | GUID of the action |
|
|
2159
|
+
| params.orgId | <code>string</code> | Organization id (_id database) |
|
|
2160
|
+
| session | <code>string</code> | Session, token JWT |
|
|
2161
|
+
|
|
2162
|
+
**Example**
|
|
2163
|
+
```js
|
|
2164
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2165
|
+
const api = new API();
|
|
2166
|
+
const params = {
|
|
2167
|
+
userId: '5739d4c6ccb0ebc61f2a9557',
|
|
2168
|
+
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2169
|
+
taskId: '5df7f19618430c89a41a19d2',
|
|
2170
|
+
action: 1,
|
|
2171
|
+
formData: {name: 'CloudBrasil'},
|
|
2172
|
+
};
|
|
2173
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2174
|
+
await api.user.task.findByIdAndUpdate(params, session);
|
|
2175
|
+
```
|
|
2176
|
+
<a name="Task+executeActionFinalize"></a>
|
|
2177
|
+
|
|
2178
|
+
### task.executeActionFinalize(params, session) ⇒ <code>Promise</code>
|
|
2179
|
+
Find task by id and update
|
|
2180
|
+
|
|
2181
|
+
**Kind**: instance method of [<code>Task</code>](#Task)
|
|
2182
|
+
**Access**: public
|
|
2183
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2184
|
+
|
|
2185
|
+
| Param | Type | Default | Description |
|
|
2186
|
+
| --- | --- | --- | --- |
|
|
2187
|
+
| params | <code>object</code> | | Params - to update task |
|
|
2188
|
+
| params.taskId | <code>string</code> | | Task id (_id database) |
|
|
2189
|
+
| params.actionGuid | <code>string</code> | | GUID of the action |
|
|
2190
|
+
| params.orgId | <code>string</code> | | Organization id (_id database) |
|
|
2191
|
+
| params.payload | <code>any</code> | <code>{}</code> | Payload to send in action |
|
|
2192
|
+
| session | <code>string</code> | | Session, token JWT |
|
|
2193
|
+
|
|
2194
|
+
**Example**
|
|
2195
|
+
```js
|
|
2196
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2197
|
+
const api = new API();
|
|
2198
|
+
const params = {
|
|
2199
|
+
taskId: '5df7f19618430c89a41a19d2',
|
|
2200
|
+
actionGuid: 'b3823a2ae52c7a05bfb9590fe427038d'
|
|
2201
|
+
orgId: '5df7f19618430c89a41a1bc3',
|
|
2202
|
+
payload: {}',
|
|
2203
|
+
};
|
|
2204
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2205
|
+
await api.user.task.executeActionFinalize(params, session);
|
|
2206
|
+
```
|
|
2207
|
+
<a name="TaskAvailable"></a>
|
|
2208
|
+
|
|
2209
|
+
## TaskAvailable
|
|
2210
|
+
Class for available tasks, permission user
|
|
2211
|
+
|
|
2212
|
+
**Kind**: global class
|
|
2213
|
+
|
|
2214
|
+
* [TaskAvailable](#TaskAvailable)
|
|
2215
|
+
* [.find(params, session)](#TaskAvailable+find) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
2216
|
+
* [.claim(params, session)](#TaskAvailable+claim) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2217
|
+
|
|
2218
|
+
<a name="TaskAvailable+find"></a>
|
|
2219
|
+
|
|
2220
|
+
### taskAvailable.find(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
2221
|
+
Method to find available tasks for a user
|
|
2222
|
+
|
|
2223
|
+
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
2224
|
+
**Returns**: <code>promise</code> - returned data from the search<code>number</code> - count the count of items searched<code>array.<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
|
|
2225
|
+
**Access**: public
|
|
2226
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2227
|
+
|
|
2228
|
+
| Param | Type | Description |
|
|
2229
|
+
| --- | --- | --- |
|
|
2230
|
+
| params | <code>object</code> | Params to get task |
|
|
2231
|
+
| params.query | <code>object</code> | Search process query |
|
|
2232
|
+
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
2233
|
+
| session | <code>string</code> | Session, token JWT |
|
|
2234
|
+
|
|
2235
|
+
**Example**
|
|
2236
|
+
```js
|
|
2237
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2238
|
+
const api = new API();
|
|
2239
|
+
const params = {
|
|
2240
|
+
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2241
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2242
|
+
};
|
|
2243
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2244
|
+
const retSearch = await api.user.task.available.find(params, session);
|
|
2245
|
+
```
|
|
2246
|
+
<a name="TaskAvailable+claim"></a>
|
|
2247
|
+
|
|
2248
|
+
### taskAvailable.claim(params, session) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2249
|
+
Method for a user to claim an available task
|
|
2250
|
+
|
|
2251
|
+
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
2252
|
+
**Returns**: <code>promise</code> - returned data from the method call<code>boolean</code> - success true|false if the method was successful
|
|
2253
|
+
**Access**: public
|
|
2254
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2255
|
+
|
|
2256
|
+
| Param | Type | Description |
|
|
2257
|
+
| --- | --- | --- |
|
|
2258
|
+
| params | <code>object</code> | Params to get task |
|
|
2259
|
+
| params.taskId | <code>object</code> | the task id to claim |
|
|
2260
|
+
| params.orgname | <code>object</code> | Organization slug (short name of the orgnization) |
|
|
2261
|
+
| session | <code>string</code> | Session, token JWT |
|
|
2262
|
+
|
|
2263
|
+
**Example**
|
|
2264
|
+
```js
|
|
2265
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2266
|
+
const api = new API();
|
|
2267
|
+
const params = {
|
|
2268
|
+
taskId: '55e4a3bd6be6b45210833f67',
|
|
2269
|
+
orgname: 'acme',
|
|
2270
|
+
};
|
|
2271
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2272
|
+
const success = await api.user.task.available.claim(params, session);
|
|
2273
|
+
```
|
|
2274
|
+
<a name="User"></a>
|
|
2275
|
+
|
|
2276
|
+
## User
|
|
2277
|
+
Class for user, permission user
|
|
2278
|
+
|
|
2279
|
+
**Kind**: global class
|
|
2280
|
+
|
|
2281
|
+
* [User](#User)
|
|
2282
|
+
* [.updateAvatar(params, session)](#User+updateAvatar) ⇒ <code>Promise</code>
|
|
2283
|
+
* [.removeAvatar(session)](#User+removeAvatar) ⇒ <code>Promise</code>
|
|
2284
|
+
* [.removeSignature(session)](#User+removeSignature) ⇒ <code>Promise</code>
|
|
2285
|
+
* [.saveSignature(data, session)](#User+saveSignature) ⇒ <code>Promise</code>
|
|
2286
|
+
* [.findByIdAndUpdate(params, session)](#User+findByIdAndUpdate) ⇒ <code>Promise.<void></code>
|
|
2287
|
+
* [.changeOrganization(id, session)](#User+changeOrganization) ⇒ <code>Promise</code>
|
|
2288
|
+
|
|
2289
|
+
<a name="User+updateAvatar"></a>
|
|
2290
|
+
|
|
2291
|
+
### user.updateAvatar(params, session) ⇒ <code>Promise</code>
|
|
2292
|
+
Update avatar of user by session of user not allow session user SU
|
|
2293
|
+
|
|
2294
|
+
**Kind**: instance method of [<code>User</code>](#User)
|
|
2295
|
+
**Access**: public
|
|
2296
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2297
|
+
|
|
2298
|
+
| Param | Type | Description |
|
|
2299
|
+
| --- | --- | --- |
|
|
2300
|
+
| params | <code>object</code> | Params to update avatar |
|
|
2301
|
+
| params.avatar | <code>string</code> | Image in base64 to update |
|
|
2302
|
+
| params.type | <code>string</code> | mimeType (image/png) |
|
|
2303
|
+
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
2304
|
+
|
|
2305
|
+
**Example**
|
|
2306
|
+
```js
|
|
2307
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2308
|
+
const api = new API();
|
|
2309
|
+
const params = {
|
|
2310
|
+
avatar: '55e4a3bd6be6b45210833fae',
|
|
2311
|
+
type: '123456',
|
|
2312
|
+
};
|
|
2313
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2314
|
+
await api.user.profile.updateAvatar(params, session);
|
|
2315
|
+
```
|
|
2316
|
+
<a name="User+removeAvatar"></a>
|
|
2317
|
+
|
|
2318
|
+
### user.removeAvatar(session) ⇒ <code>Promise</code>
|
|
2319
|
+
Remove avatar of user by session of user not allow session user SU
|
|
2320
|
+
|
|
2321
|
+
**Kind**: instance method of [<code>User</code>](#User)
|
|
2322
|
+
**Access**: public
|
|
2323
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2324
|
+
|
|
2325
|
+
| Param | Type | Description |
|
|
2326
|
+
| --- | --- | --- |
|
|
2327
|
+
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
2328
|
+
|
|
2329
|
+
**Example**
|
|
2330
|
+
```js
|
|
2331
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2332
|
+
const api = new API();
|
|
2333
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2334
|
+
await api.user.profile.removeAvatar(session);
|
|
2335
|
+
```
|
|
2336
|
+
<a name="User+removeSignature"></a>
|
|
2337
|
+
|
|
2338
|
+
### user.removeSignature(session) ⇒ <code>Promise</code>
|
|
2339
|
+
Remove the signature of user by session
|
|
2340
|
+
|
|
2341
|
+
**Kind**: instance method of [<code>User</code>](#User)
|
|
2342
|
+
**Access**: public
|
|
2343
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2344
|
+
|
|
2345
|
+
| Param | Type | Description |
|
|
2346
|
+
| --- | --- | --- |
|
|
2347
|
+
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
2348
|
+
|
|
2349
|
+
**Example**
|
|
2350
|
+
```js
|
|
2351
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2352
|
+
const api = new API();
|
|
2353
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2354
|
+
await api.user.profile.removeSignature(session);
|
|
2355
|
+
```
|
|
2356
|
+
<a name="User+saveSignature"></a>
|
|
2357
|
+
|
|
2358
|
+
### user.saveSignature(data, session) ⇒ <code>Promise</code>
|
|
2359
|
+
Sava a new signature of user by session
|
|
2360
|
+
|
|
2361
|
+
**Kind**: instance method of [<code>User</code>](#User)
|
|
2362
|
+
**Access**: public
|
|
2363
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2364
|
+
|
|
2365
|
+
| Param | Type | Description |
|
|
2366
|
+
| --- | --- | --- |
|
|
2367
|
+
| data | <code>object</code> | The signature data to save |
|
|
2368
|
+
| data.type | <code>string</code> | CURSIVE or HANDWRITE |
|
|
2369
|
+
| data.file | <code>string</code> | CURSIVE the <fontname>:<name used on the signature> HANDWRITE the base 64 image (w/o the mime a base prefix) |
|
|
2370
|
+
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
2371
|
+
|
|
2372
|
+
**Example**
|
|
2373
|
+
```js
|
|
2374
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2375
|
+
const api = new API();
|
|
2376
|
+
const data = {
|
|
2377
|
+
type: 'CURSIVE',
|
|
2378
|
+
file: 'allura:Mary John Heart'
|
|
2379
|
+
};
|
|
2380
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2381
|
+
await api.user.profile.saveSignature(data, session);
|
|
2382
|
+
|
|
2383
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2384
|
+
const api = new API();
|
|
2385
|
+
const data = {
|
|
2386
|
+
type: 'HANDWRITE',
|
|
2387
|
+
file: 'iVBORw0KGgoAAAANSUhEUgAAAj...'
|
|
2388
|
+
};
|
|
2389
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2390
|
+
await api.user.profile.saveSignature(session);
|
|
2391
|
+
```
|
|
2392
|
+
<a name="User+findByIdAndUpdate"></a>
|
|
2393
|
+
|
|
2394
|
+
### user.findByIdAndUpdate(params, session) ⇒ <code>Promise.<void></code>
|
|
2395
|
+
Update a user profile by id
|
|
2396
|
+
|
|
2397
|
+
**Kind**: instance method of [<code>User</code>](#User)
|
|
2398
|
+
**Access**: public
|
|
2399
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2400
|
+
|
|
2401
|
+
| Param | Type | Description |
|
|
2402
|
+
| --- | --- | --- |
|
|
2403
|
+
| params | <code>object</code> | Params to update task |
|
|
2404
|
+
| params.name | <code>string</code> | The name of the user |
|
|
2405
|
+
| params.site | <code>string</code> | The site of the user |
|
|
2406
|
+
| params.faceboook | <code>string</code> | The faceboook of the user |
|
|
2407
|
+
| params.linkedin | <code>string</code> | The linkedin of the user |
|
|
2408
|
+
| params.dob | <code>date</code> | The date of birth of the user |
|
|
2409
|
+
| params.gender | <code>number.<UserGender></code> | The gender of of the user self.gender |
|
|
2410
|
+
| params.phone | <code>string</code> | The phone |
|
|
2411
|
+
| params.phone2 | <code>string</code> | The phone 2 |
|
|
2412
|
+
| params.phone3 | <code>string</code> | The phone 3 |
|
|
2413
|
+
| params.password | <code>string</code> | The password to change |
|
|
2414
|
+
| params.secQuestion | <code>string</code> | The security question |
|
|
2415
|
+
| params.secAnswer | <code>string</code> | The security answer |
|
|
2416
|
+
| params.timezone | <code>string</code> | The timezone |
|
|
2417
|
+
| params.userLanguage | <code>string</code> | The user language |
|
|
2418
|
+
| params.changePassword | <code>string</code> | (required) If we need to change the status and we changed the password |
|
|
2419
|
+
| params.acceptTermsOfUse | <code>string</code> | If the user has accepted the terms of change |
|
|
2420
|
+
| session | <code>string</code> | Session, token JWT |
|
|
2421
|
+
|
|
2422
|
+
**Example**
|
|
2423
|
+
```js
|
|
2424
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2425
|
+
const api = new API();
|
|
2426
|
+
const params = {
|
|
2427
|
+
name: 'New Name'
|
|
2428
|
+
};
|
|
2429
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2430
|
+
await api.user.profile.findByIdAndUpdate(params, session);
|
|
2431
|
+
```
|
|
2432
|
+
<a name="User+changeOrganization"></a>
|
|
2433
|
+
|
|
2434
|
+
### user.changeOrganization(id, session) ⇒ <code>Promise</code>
|
|
2435
|
+
Change a user's organization
|
|
2436
|
+
|
|
2437
|
+
**Kind**: instance method of [<code>User</code>](#User)
|
|
2438
|
+
**Access**: public
|
|
2439
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2440
|
+
|
|
2441
|
+
| Param | Type | Description |
|
|
2442
|
+
| --- | --- | --- |
|
|
2443
|
+
| id | <code>string</code> | Organization id |
|
|
2444
|
+
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
2445
|
+
|
|
2446
|
+
**Example**
|
|
2447
|
+
```js
|
|
2448
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2449
|
+
const api = new API();
|
|
2450
|
+
const id = '616eccaaa9360a05293b10fe';
|
|
2451
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2452
|
+
await api.user.changeOrganization.updateAvatar(id, session);
|
|
2453
|
+
```
|