@docbrasil/api-systemmanager 1.1.26 → 1.1.28

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.
@@ -168,6 +168,46 @@ class Chart {
168
168
  throw ex;
169
169
  }
170
170
  }
171
+
172
+ /**
173
+ * @author Myndware <augusto.pissarra@myndware.com>
174
+ * @description Get the question data from a chart data
175
+ * @param {object} params Params to get helps from topic
176
+ * @param {object} params.orgId The organization id of the question
177
+ * @param {object} params.processId The process id of the question
178
+ * @param {object} params.path The path of the question so we can retrieve it
179
+ * @param {string} session Session, token JWT
180
+ * @returns {promise} data the question data
181
+ * @public
182
+ * @example
183
+ *
184
+ * const API = require('@docbrasil/api-systemmanager');
185
+ * const api = new API();
186
+ * const params = {
187
+ * orgId: '637e7523f555fabdfb1ed7b6',
188
+ * processId: '123e7523f555fabdfb1ed7c6',
189
+ * path: 'Checklist.Group Name.Field Name'
190
+ * };
191
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
192
+ * await api.user.dashboard.chart.getQuestion(params, session);
193
+ */
194
+ async getQuestion(params, session) {
195
+ const self = this;
196
+
197
+ try {
198
+ Joi.assert(params, Joi.object().required(), 'Params to helps from a topic');
199
+ Joi.assert(params.orgId, Joi.string().required(), 'The organization id of the question');
200
+ Joi.assert(params.processId, Joi.string().required(), 'The process id of the question');
201
+ Joi.assert(params.path, Joi.string().required(), 'The path of the field of the question');
202
+ Joi.assert(session, Joi.string().required(), 'Session token JWT');
203
+
204
+ const apiCall = self._client.post(`/organizations/dashboard/chart/question/data`, params, self._setHeader(session));
205
+
206
+ return self._returnData(await apiCall);
207
+ } catch (ex) {
208
+ throw ex;
209
+ }
210
+ }
171
211
  }
172
212
 
173
213
  /**
@@ -234,7 +274,7 @@ class Dashboard {
234
274
  }
235
275
  }
236
276
 
237
- export default Help;
277
+ export default Dashboard;
238
278
  </code></pre>
239
279
  </article>
240
280
  </section>
@@ -889,6 +889,181 @@ class Documents {
889
889
  throw ex;
890
890
  }
891
891
  }
892
+
893
+ /**
894
+ * @author Myndware &lt;augusto.pissarra@myndware.com>
895
+ * @description Method to export excel for all pages
896
+ * @param {object} params Params to export excel for all pages
897
+ * @param {object} params.query Export excel for all pages query
898
+ * @param {object} params.orgId Organization id (_id database)
899
+ * @param {string} session Session, token JWT
900
+ * @returns {promise} returned data from the export excel for all pages
901
+ * @public
902
+ * @example
903
+ *
904
+ * const API = require('@docbrasil/api-systemmanager');
905
+ * const api = new API();
906
+ * const params = {
907
+ * query: {p: 20, i: 1, s: 'Mais recentes', as: '', m: 'w', ai: '57e6a3bd6be6b45210833fae'},
908
+ * orgId: '55e4a3bd6be6b45210833fae',
909
+ * };
910
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
911
+ * const retSearch = await api.user.document.exportExcelForAllPages(params, session);
912
+ */
913
+ async exportExcelForAllPages(params, session) {
914
+ const self = this;
915
+
916
+ try {
917
+ Joi.assert(params, Joi.object().required(), 'Params to export excel for all pages');
918
+ Joi.assert(params.query, Joi.object().required(), 'The query for the export excel for all pages');
919
+ Joi.assert(params.orgId, Joi.string().required(), 'Organization id (_id database)');
920
+ Joi.assert(session, Joi.string().required(), 'Session token JWT');
921
+
922
+ const {query, orgId} = params;
923
+ const searchParams = new URLSearchParams(query);
924
+ const queryString = searchParams.toString();
925
+ const apiCall = self._client.get(`/organizations/${orgId}/documents/export/excel?${queryString}`, self._setHeader(session));
926
+
927
+ return self._returnData(await apiCall);
928
+ } catch (ex) {
929
+ throw ex;
930
+ }
931
+ }
932
+
933
+ /**
934
+ * @author Myndware &lt;augusto.pissarra@myndware.com>
935
+ * @description Method to export Wms Excel for all pages
936
+ * @param {object} params Params to export Wms Excel for all pages
937
+ * @param {object} params.query export Wms Excel for all pages query
938
+ * @param {object} params.orgId Organization id (_id database)
939
+ * @param {string} session Session, token JWT
940
+ * @returns {promise} returned data from the export Wms Excel for all pages
941
+ * @public
942
+ * @example
943
+ *
944
+ * const API = require('@docbrasil/api-systemmanager');
945
+ * const api = new API();
946
+ * const params = {
947
+ * query: {p: 20, i: 1, s: 'Mais recentes', as: '', m: 'w', ai: '57e6a3bd6be6b45210833fae'},
948
+ * orgId: '55e4a3bd6be6b45210833fae',
949
+ * };
950
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
951
+ * const retSearch = await api.user.document.exportWmsExcelForAllPages(params, session);
952
+ */
953
+ async exportWmsExcelForAllPages(params, session) {
954
+ const self = this;
955
+
956
+ try {
957
+ Joi.assert(params, Joi.object().required(), 'Params to export Wms Excel for all pages');
958
+ Joi.assert(params.query, Joi.object().required(), 'The query for the export Wms Excel for all pages');
959
+ Joi.assert(params.orgId, Joi.string().required(), 'Organization id (_id database)');
960
+ Joi.assert(session, Joi.string().required(), 'Session token JWT');
961
+
962
+ const {query, orgId} = params;
963
+ const searchParams = new URLSearchParams(query);
964
+ const queryString = searchParams.toString();
965
+ const apiCall = self._client.get(`/organizations/${orgId}/documents/wms/export/excel?${queryString}`, self._setHeader(session));
966
+
967
+ return self._returnData(await apiCall);
968
+ } catch (ex) {
969
+ throw ex;
970
+ }
971
+ }
972
+
973
+ /**
974
+ * @author Myndware &lt;augusto.pissarra@myndware.com>
975
+ * @description Method to perform download complete for all pages
976
+ * @param {object} params Params to perform download complete for all pages
977
+ * @param {object} params.data data to be send to download
978
+ * @param {object} params.query perform download complete for all pages query
979
+ * @param {object} params.orgId Organization id (_id database)
980
+ * @param {string} session Session, token JWT
981
+ * @returns {promise} returned data from the perform download complete for all pages
982
+ * @public
983
+ * @example
984
+ *
985
+ * const API = require('@docbrasil/api-systemmanager');
986
+ * const api = new API();
987
+ * const params = {
988
+ * query: {p: 20, i: 1, s: 'Mais recentes', as: '', m: 'w', ai: '57e6a3bd6be6b45210833fae'},
989
+ * orgId: '55e4a3bd6be6b45210833fae',
990
+ * data: {
991
+ * destAws = {
992
+ destAwsKey: '',
993
+ destAwsSecret: '',
994
+ destAwsBucket: '',
995
+ destAwsRegion: ''
996
+ },
997
+ maxFileSize: ''
998
+ * }
999
+ * };
1000
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1001
+ * const retSearch = await api.user.document.performDownloadComplete(params, session);
1002
+ */
1003
+ async performDownloadComplete(params, session) {
1004
+ const self = this;
1005
+
1006
+ Joi.assert(params, Joi.object().required(), 'Params to perform download complete for all pages');
1007
+ Joi.assert(params.data, Joi.object().required(), 'The data for the perform download complete for all pages');
1008
+ Joi.assert(params.query, Joi.object().required(), 'The query for the perform download complete for all pages');
1009
+ Joi.assert(params.orgId, Joi.string().required(), 'Organization id (_id database)');
1010
+ Joi.assert(session, Joi.string().required(), 'Session token JWT');
1011
+
1012
+ try {
1013
+ const {query, orgId, data} = params;
1014
+ const searchParams = new URLSearchParams(query);
1015
+ const queryString = searchParams.toString();
1016
+
1017
+ const apiCall = self._client.post(`/organizations/${orgId}/documents/download/attachments?${queryString}`, data, self._setHeader(session));
1018
+ return self._returnData(await apiCall);
1019
+ } catch (ex) {
1020
+ throw ex;
1021
+ }
1022
+ }
1023
+
1024
+ /**
1025
+ * @author Myndware &lt;augusto.pissarra@myndware.com>
1026
+ * @description Method to search documents direct on MongoDB (use carefully and only in cases you need to access direct data
1027
+ * @param {object} params Params to search the documents
1028
+ * @param {object} params.query Search documents query
1029
+ * @param {object} params.orgId Organization id (_id database)
1030
+ * @param {string} session Session, token JWT
1031
+ * @returns {promise} returned data from the search
1032
+ * @returns {number} count the count of items searched
1033
+ * @returns {array&lt;object>} items the items returned from search
1034
+ * @returns {number} took the number of documents taken
1035
+ * @returns {number} totalCount the total count of all documents
1036
+ * @public
1037
+ * @example
1038
+ *
1039
+ * const API = require('@docbrasil/api-systemmanager');
1040
+ * const api = new API();
1041
+ * const params = {
1042
+ * query: {p: 20, i: 1, s: 'Mais recentes', as: '', m: 'w', ai: '57e6a3bd6be6b45210833fae'},
1043
+ * orgId: '55e4a3bd6be6b45210833fae',
1044
+ * };
1045
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1046
+ * const retSearch = await api.user.document.searchDocumentsMongo(params, session);
1047
+ */
1048
+ async searchDocumentsMongo(params, session) {
1049
+ const self = this;
1050
+
1051
+ try {
1052
+ Joi.assert(params, Joi.object().required(), 'Params to search the documents');
1053
+ Joi.assert(params.query, Joi.object().required(), 'The query for the search documents');
1054
+ Joi.assert(params.orgId, Joi.string().required(), 'Organization id (_id database)');
1055
+ Joi.assert(session, Joi.string().required(), 'Session token JWT');
1056
+
1057
+ const {query, orgId} = params;
1058
+ const searchParams = new URLSearchParams(query);
1059
+ const queryString = searchParams.toString();
1060
+ const apiCall = self._client.get(`/organizations/${orgId}/documents/search/direct?${queryString}`, self._setHeader(session));
1061
+
1062
+ return self._returnData(await apiCall);
1063
+ } catch (ex) {
1064
+ throw ex;
1065
+ }
1066
+ }
892
1067
  }
893
1068
 
894
1069
  export default Documents;
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.26",
4
+ "version": "1.1.28",
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",
package/.project DELETED
@@ -1,11 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <projectDescription>
3
- <name>api-systemmanager</name>
4
- <comment></comment>
5
- <projects>
6
- </projects>
7
- <buildSpec>
8
- </buildSpec>
9
- <natures>
10
- </natures>
11
- </projectDescription>