@docbrasil/api-systemmanager 1.1.21 → 1.1.23
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/form.js +27 -2
- package/api/admin/user.js +55 -0
- package/api/user/user.js +3 -4
- package/dist/bundle.cjs +85 -6
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +52 -4
- package/docs/AdminForm.html +103 -2
- package/docs/AdminUser.html +349 -0
- package/docs/User.html +6 -33
- package/docs/admin_form.js.html +27 -2
- package/docs/admin_user.js.html +55 -0
- package/docs/user_user.js.html +3 -4
- package/package.json +1 -1
package/docs/admin_form.js.html
CHANGED
|
@@ -134,6 +134,32 @@ class AdminForm {
|
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/**
|
|
138
|
+
* @author Myndware <augusto.pissarra@myndware.com>
|
|
139
|
+
* @description Get the types for forms
|
|
140
|
+
* @return {Promise}
|
|
141
|
+
* @public
|
|
142
|
+
* @async
|
|
143
|
+
* @example
|
|
144
|
+
*
|
|
145
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
146
|
+
* const api = new API();
|
|
147
|
+
* const params = {
|
|
148
|
+
* id: '55e4a3bd6be6b45210833fae',
|
|
149
|
+
* orgId: '5edd11c46b6ce9729c2c297c',
|
|
150
|
+
* };
|
|
151
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
152
|
+
* await api.admin.form.findById(params, session);
|
|
153
|
+
*/
|
|
154
|
+
get types() {
|
|
155
|
+
return {
|
|
156
|
+
BUSINESS: 1,
|
|
157
|
+
ADVANCED: 2,
|
|
158
|
+
CHECKLIST: 3,
|
|
159
|
+
EXTERNAL: 4
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
|
|
137
163
|
/**
|
|
138
164
|
* @author Myndware <augusto.pissarra@myndware.com>
|
|
139
165
|
* @description Get advance form by ID
|
|
@@ -209,7 +235,6 @@ class AdminForm {
|
|
|
209
235
|
Joi.assert(params.sort, Joi.object(), 'Sort fields for');
|
|
210
236
|
Joi.assert(session, Joi.string().required(), 'Session, token JWT');
|
|
211
237
|
|
|
212
|
-
const FORM_ADVANCED = 2;
|
|
213
238
|
const PROJECTION_DEFAULT = {_id: 1, name: 1};
|
|
214
239
|
const SORT_DEFAULT = {name: 1};
|
|
215
240
|
|
|
@@ -217,7 +242,7 @@ class AdminForm {
|
|
|
217
242
|
orgId,
|
|
218
243
|
page = 1,
|
|
219
244
|
perPage = 200,
|
|
220
|
-
type =
|
|
245
|
+
type = self.types.ADVANCED,
|
|
221
246
|
project = PROJECTION_DEFAULT,
|
|
222
247
|
sort = SORT_DEFAULT
|
|
223
248
|
} = params;
|
package/docs/admin_user.js.html
CHANGED
|
@@ -359,6 +359,61 @@ class AdminUser {
|
|
|
359
359
|
throw ex;
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* @author Myndware <augusto.pissarra@myndware.com>
|
|
365
|
+
* @description Request signed url url to put or get
|
|
366
|
+
* @param {object} params - Params to get form list
|
|
367
|
+
* @param {number} params.page=1 - Page of pagination
|
|
368
|
+
* @param {number} params.perPage=200 - Items per page
|
|
369
|
+
* @param {object} params.project={_id: 1, name: 1} - Fields to project
|
|
370
|
+
* @param {object} params.sort={name: 1} - Sort fields
|
|
371
|
+
* @param {string} session - Session, token JWT
|
|
372
|
+
* @return {Promise}
|
|
373
|
+
* @public
|
|
374
|
+
* @async
|
|
375
|
+
* @example
|
|
376
|
+
*
|
|
377
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
378
|
+
* const api = new API();
|
|
379
|
+
* const params - {
|
|
380
|
+
* project: {_id: 1, name: 1, orgId: 1, orgIds: 1},
|
|
381
|
+
* };
|
|
382
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
383
|
+
* await api.user.form.getUserList(params, session);
|
|
384
|
+
*/
|
|
385
|
+
async getUserList(params, session) {
|
|
386
|
+
const self = this;
|
|
387
|
+
|
|
388
|
+
try {
|
|
389
|
+
Joi.assert(params, Joi.object().required(), 'Params to get form list');
|
|
390
|
+
Joi.assert(params.page, Joi.number(), 'Page of pagination');
|
|
391
|
+
Joi.assert(params.perPage, Joi.number(), 'Items per page');
|
|
392
|
+
Joi.assert(params.project, Joi.object(), 'Fields to project');
|
|
393
|
+
Joi.assert(params.sort, Joi.object(), 'Sort fields for');
|
|
394
|
+
Joi.assert(session, Joi.string().required(), 'Session, token JWT');
|
|
395
|
+
|
|
396
|
+
const PROJECTION_DEFAULT = {_id: 1, name: 1};
|
|
397
|
+
const SORT_DEFAULT = {name: 1};
|
|
398
|
+
|
|
399
|
+
const {
|
|
400
|
+
page = 1,
|
|
401
|
+
perPage = 200,
|
|
402
|
+
project = PROJECTION_DEFAULT,
|
|
403
|
+
sort = SORT_DEFAULT
|
|
404
|
+
} = params;
|
|
405
|
+
|
|
406
|
+
const payloadToSend = {$project: project, sort};
|
|
407
|
+
|
|
408
|
+
const apiCall = self._client
|
|
409
|
+
.post(`/admin/users?page=${page}&perPage=${perPage}`, payloadToSend, self._setHeader(session));
|
|
410
|
+
|
|
411
|
+
return self._returnData(await apiCall);
|
|
412
|
+
|
|
413
|
+
} catch (ex) {
|
|
414
|
+
throw ex;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
362
417
|
}
|
|
363
418
|
|
|
364
419
|
export default AdminUser;
|
package/docs/user_user.js.html
CHANGED
|
@@ -376,7 +376,6 @@ class User {
|
|
|
376
376
|
* @param {object} query={} The query, if any, to add to the JWT token
|
|
377
377
|
* @param {array<string>} query.orgIds An array of orgIds that we want to filter by
|
|
378
378
|
* @param {array<string>} query.orgProcessIds An array of orgProcessId that we want to filter by
|
|
379
|
-
* @param {array<string>} query.tags An array of org processes tags that we want to filter by
|
|
380
379
|
* @param {date} query.startDate The start date in ISO format that we want to filter by
|
|
381
380
|
* @param {date} query.endDate The start date in ISO format that we want to filter by
|
|
382
381
|
* @param {string} session Is token JWT of user NOT allow SU
|
|
@@ -389,7 +388,7 @@ class User {
|
|
|
389
388
|
* const api = new API();
|
|
390
389
|
* const query = { orgIds: ['616eccaaa9360a05293b10fe'] };
|
|
391
390
|
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
392
|
-
* const jwtToken = await api.user.
|
|
391
|
+
* const jwtToken = await api.user.getChartJWT(query, session);
|
|
393
392
|
*/
|
|
394
393
|
async getChartJWT(query = {}, session) {
|
|
395
394
|
const self = this;
|
|
@@ -420,7 +419,7 @@ class User {
|
|
|
420
419
|
* const API = require('@docbrasil/api-systemmanager');
|
|
421
420
|
* const api = new API();
|
|
422
421
|
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
423
|
-
* const organizations = await api.user.
|
|
422
|
+
* const organizations = await api.user.getChartOrganizations(session);
|
|
424
423
|
*/
|
|
425
424
|
async getChartOrganizations(session) {
|
|
426
425
|
const self = this;
|
|
@@ -452,7 +451,7 @@ class User {
|
|
|
452
451
|
* const api = new API();
|
|
453
452
|
* const orgIds: ['616eccaaa9360a05293b10fe'];
|
|
454
453
|
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
455
|
-
* const jwtToken = await api.user.
|
|
454
|
+
* const jwtToken = await api.user.getChartTags(orgIds, session);
|
|
456
455
|
*/
|
|
457
456
|
async getChartTags(orgIds = [], session) {
|
|
458
457
|
const self = this;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docbrasil/api-systemmanager",
|
|
3
3
|
"description": "Module API System Manager",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.23",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"htmldoc": "rm -rf docs && jsdoc api/** -d docs -t ./node_modules/better-docs",
|
|
7
7
|
"doc": "rm -rf doc && mkdir doc && jsdoc2md api/**/* api/* > doc/api.md",
|