@docbrasil/api-systemmanager 1.1.20 → 1.1.22

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.
@@ -152,7 +152,7 @@ class MyTasks {
152
152
  * const API = require('@docbrasil/api-systemmanager');
153
153
  * const api = new API();
154
154
  * const params = {
155
- * query: {"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
155
+ * query: {"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20, filter: {checklistsTags:['checklist']}},
156
156
  * orgId: '55e4a3bd6be6b45210833fae',
157
157
  * };
158
158
  * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
@@ -354,7 +354,7 @@ class User {
354
354
  * const api = new API();
355
355
  * const id = '616eccaaa9360a05293b10fe';
356
356
  * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
357
- * await api.user.changeOrganization.updateAvatar(id, session);
357
+ * await api.user.changeOrganization(id, session);
358
358
  */
359
359
  async changeOrganization(id, session) {
360
360
  const self = this;
@@ -369,6 +369,105 @@ class User {
369
369
  throw ex;
370
370
  }
371
371
  }
372
+
373
+ /**
374
+ * @author Myndware <augusto.pissarra@myndware.com>
375
+ * @description Get the Atlas Chart JWT Token, so we can access authorized the created charts
376
+ * @param {object} query={} The query, if any, to add to the JWT token
377
+ * @param {array<string>} query.orgIds An array of orgIds that we want to filter by
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
+ * @param {date} query.startDate The start date in ISO format that we want to filter by
381
+ * @param {date} query.endDate The start date in ISO format that we want to filter by
382
+ * @param {string} session Is token JWT of user NOT allow SU
383
+ * @return {Promise<string>} JWT Token
384
+ * @public
385
+ * @async
386
+ * @example
387
+ *
388
+ * const API = require('@docbrasil/api-systemmanager');
389
+ * const api = new API();
390
+ * const query = { orgIds: ['616eccaaa9360a05293b10fe'] };
391
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
392
+ * const jwtToken = await api.user.getChartJWT(query, session);
393
+ */
394
+ async getChartJWT(query = {}, session) {
395
+ const self = this;
396
+
397
+ try {
398
+ Joi.assert(session, Joi.string().required());
399
+ const url = `/users/charts/info?query=${JSON.stringify(query)}`;
400
+
401
+ const apiCall = self._client.get(url, self._setHeader(session));
402
+ return self._returnData(await apiCall);
403
+ } catch (ex) {
404
+ throw ex;
405
+ }
406
+ }
407
+
408
+ /**
409
+ * @author Myndware <augusto.pissarra@myndware.com>
410
+ * @description Get the user organizations to run dashboard filtering
411
+ * @param {string} session Is token JWT of user NOT allow SU
412
+ * @return {Promise}
413
+ * @return {array<object>} Array of organizations
414
+ * @return {array<object>} id The id of the organization
415
+ * @return {array<object>} text The name of the organization
416
+ * @public
417
+ * @async
418
+ * @example
419
+ *
420
+ * const API = require('@docbrasil/api-systemmanager');
421
+ * const api = new API();
422
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
423
+ * const organizations = await api.user.getChartOrganizations(session);
424
+ */
425
+ async getChartOrganizations(session) {
426
+ const self = this;
427
+
428
+ try {
429
+ Joi.assert(session, Joi.string().required());
430
+ const apiCall = self._client.get('/users/charts/organizations', self._setHeader(session));
431
+ return self._returnData(await apiCall);
432
+ } catch (ex) {
433
+ throw ex;
434
+ }
435
+ }
436
+
437
+ /**
438
+ * @author Myndware <augusto.pissarra@myndware.com>
439
+ * @description Given orgIds, return all the tags and org processes ids that can be used to filter dashboards
440
+ * @param {array<string>} orgIds=[] An array of orgIds
441
+ * @param {string} session Is token JWT of user NOT allow SU
442
+ * @return {Promise}
443
+ * @return {array<object>} The array of each org process and tags associated with them
444
+ * @return {srting} id The id of the org process
445
+ * @return {srting} name The name of the org process
446
+ * @return {array<srting>} tags The array of tags of the org process
447
+ * @public
448
+ * @async
449
+ * @example
450
+ *
451
+ * const API = require('@docbrasil/api-systemmanager');
452
+ * const api = new API();
453
+ * const orgIds: ['616eccaaa9360a05293b10fe'];
454
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
455
+ * const jwtToken = await api.user.getChartTags(orgIds, session);
456
+ */
457
+ async getChartTags(orgIds = [], session) {
458
+ const self = this;
459
+
460
+ try {
461
+ Joi.assert(session, Joi.string().required());
462
+ const url = `/users/charts/tags?orgIds=${JSON.stringify(orgIds)}`;
463
+
464
+ const apiCall = self._client.get(url, self._setHeader(session));
465
+ return self._returnData(await apiCall);
466
+ } catch (ex) {
467
+ throw ex;
468
+ }
469
+ }
470
+
372
471
  }
373
472
 
374
473
  export default User;
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.20",
4
+ "version": "1.1.22",
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",