@docbrasil/api-systemmanager 1.0.106 → 1.0.107
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/user/process.js +44 -0
- package/api/user/task.js +1 -0
- package/api/user/task_available.js +1 -1
- package/dist/bundle.cjs +46 -1
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +30 -1
- package/package.json +1 -1
package/api/user/process.js
CHANGED
|
@@ -186,6 +186,50 @@ class Process {
|
|
|
186
186
|
throw ex;
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
192
|
+
* @description Method to search processes
|
|
193
|
+
* @param {object} params Params to search processes
|
|
194
|
+
* @param {object} params.query Search process query
|
|
195
|
+
* @param {object} params.orgId Organization id (_id database)
|
|
196
|
+
* @param {string} session Session, token JWT
|
|
197
|
+
* @returns {promise} returned data from the search
|
|
198
|
+
* @returns {number} count the count of items searched
|
|
199
|
+
* @returns {array<object>} items the items returned from search
|
|
200
|
+
* @returns {number} page the page of the search (on pagination), zero indexed
|
|
201
|
+
* @returns {number} perPage how many items per page
|
|
202
|
+
* @public
|
|
203
|
+
* @example
|
|
204
|
+
*
|
|
205
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
206
|
+
* const api = new API();
|
|
207
|
+
* const params = {
|
|
208
|
+
* query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
209
|
+
* orgId: '55e4a3bd6be6b45210833fae',
|
|
210
|
+
* };
|
|
211
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
212
|
+
* const retSearch = await api.user.process.find(params, session);
|
|
213
|
+
*/
|
|
214
|
+
async find(params, session) {
|
|
215
|
+
const self = this;
|
|
216
|
+
|
|
217
|
+
try {
|
|
218
|
+
Joi.assert(params, Joi.object().required(), 'Params to search processes');
|
|
219
|
+
Joi.assert(params.query, Joi.object().required(), 'The query for the search');
|
|
220
|
+
Joi.assert(params.orgId, Joi.string().required(), 'Organization id (_id database)');
|
|
221
|
+
Joi.assert(session, Joi.string().required(), 'Session token JWT');
|
|
222
|
+
|
|
223
|
+
const {query, orgId} = params;
|
|
224
|
+
const queryString = JSON.stringify(query);
|
|
225
|
+
const apiCall = self._client
|
|
226
|
+
.post(`/organizations/${orgId}/process/advsearch?query=${queryString}`, {}, self._setHeader(session));
|
|
227
|
+
|
|
228
|
+
return self._returnData(await apiCall);
|
|
229
|
+
} catch (ex) {
|
|
230
|
+
throw ex;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
189
233
|
}
|
|
190
234
|
|
|
191
235
|
export default Process;
|
package/api/user/task.js
CHANGED
|
@@ -51,7 +51,7 @@ class TaskAvailable {
|
|
|
51
51
|
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
52
52
|
* @description Method to find available tasks for a user
|
|
53
53
|
* @param {object} params Params to get task
|
|
54
|
-
* @param {object} params.query Search
|
|
54
|
+
* @param {object} params.query Search available tasks query
|
|
55
55
|
* @param {object} params.orgId Organization id (_id database)
|
|
56
56
|
* @param {string} session Session, token JWT
|
|
57
57
|
* @returns {promise} returned data from the search
|
package/dist/bundle.cjs
CHANGED
|
@@ -1687,6 +1687,50 @@ class Process {
|
|
|
1687
1687
|
throw ex;
|
|
1688
1688
|
}
|
|
1689
1689
|
}
|
|
1690
|
+
|
|
1691
|
+
/**
|
|
1692
|
+
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
1693
|
+
* @description Method to search processes
|
|
1694
|
+
* @param {object} params Params to search processes
|
|
1695
|
+
* @param {object} params.query Search process query
|
|
1696
|
+
* @param {object} params.orgId Organization id (_id database)
|
|
1697
|
+
* @param {string} session Session, token JWT
|
|
1698
|
+
* @returns {promise} returned data from the search
|
|
1699
|
+
* @returns {number} count the count of items searched
|
|
1700
|
+
* @returns {array<object>} items the items returned from search
|
|
1701
|
+
* @returns {number} page the page of the search (on pagination), zero indexed
|
|
1702
|
+
* @returns {number} perPage how many items per page
|
|
1703
|
+
* @public
|
|
1704
|
+
* @example
|
|
1705
|
+
*
|
|
1706
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
1707
|
+
* const api = new API();
|
|
1708
|
+
* const params = {
|
|
1709
|
+
* query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
1710
|
+
* orgId: '55e4a3bd6be6b45210833fae',
|
|
1711
|
+
* };
|
|
1712
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1713
|
+
* const retSearch = await api.user.process.find(params, session);
|
|
1714
|
+
*/
|
|
1715
|
+
async find(params, session) {
|
|
1716
|
+
const self = this;
|
|
1717
|
+
|
|
1718
|
+
try {
|
|
1719
|
+
Joi__default["default"].assert(params, Joi__default["default"].object().required(), 'Params to search processes');
|
|
1720
|
+
Joi__default["default"].assert(params.query, Joi__default["default"].object().required(), 'The query for the search');
|
|
1721
|
+
Joi__default["default"].assert(params.orgId, Joi__default["default"].string().required(), 'Organization id (_id database)');
|
|
1722
|
+
Joi__default["default"].assert(session, Joi__default["default"].string().required(), 'Session token JWT');
|
|
1723
|
+
|
|
1724
|
+
const {query, orgId} = params;
|
|
1725
|
+
const queryString = JSON.stringify(query);
|
|
1726
|
+
const apiCall = self._client
|
|
1727
|
+
.post(`/organizations/${orgId}/process/advsearch?query=${queryString}`, {}, self._setHeader(session));
|
|
1728
|
+
|
|
1729
|
+
return self._returnData(await apiCall);
|
|
1730
|
+
} catch (ex) {
|
|
1731
|
+
throw ex;
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1690
1734
|
}
|
|
1691
1735
|
|
|
1692
1736
|
/**
|
|
@@ -1738,7 +1782,7 @@ class TaskAvailable {
|
|
|
1738
1782
|
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
1739
1783
|
* @description Method to find available tasks for a user
|
|
1740
1784
|
* @param {object} params Params to get task
|
|
1741
|
-
* @param {object} params.query Search
|
|
1785
|
+
* @param {object} params.query Search available tasks query
|
|
1742
1786
|
* @param {object} params.orgId Organization id (_id database)
|
|
1743
1787
|
* @param {string} session Session, token JWT
|
|
1744
1788
|
* @returns {promise} returned data from the search
|
|
@@ -1940,6 +1984,7 @@ class Task {
|
|
|
1940
1984
|
async findByIdAndUpdate(params, session) {
|
|
1941
1985
|
const self = this;
|
|
1942
1986
|
|
|
1987
|
+
|
|
1943
1988
|
try {
|
|
1944
1989
|
Joi__default["default"].assert(params, Joi__default["default"].object().required());
|
|
1945
1990
|
Joi__default["default"].assert(params.userId, Joi__default["default"].string().required(), 'User id (_id database)');
|