@docbrasil/api-systemmanager 1.1.22 → 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.
@@ -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;
@@ -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
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.22",
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",