@docbrasil/api-systemmanager 1.0.73 → 1.0.75
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/notification.js +24 -0
- package/api/admin/task.js +16 -4
- package/dist/bundle.cjs +40 -4
- package/dist/bundle.mjs +1 -1
- package/package.json +1 -1
|
@@ -47,6 +47,30 @@ class AdminNotification {
|
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/**
|
|
51
|
+
* @description Send real time notification
|
|
52
|
+
* @param {object} params Params to send notification
|
|
53
|
+
* @param {string} params.userIds Users to send notification
|
|
54
|
+
* @param {object} params.message Object with data to send user
|
|
55
|
+
* @param {object} session Session, token JWT
|
|
56
|
+
* @returns {Promise<*>}
|
|
57
|
+
*/
|
|
58
|
+
async realTime(params, session) {
|
|
59
|
+
const self = this;
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
Joi.assert(params, Joi.object().required(), 'Object with params to add notifications');
|
|
63
|
+
Joi.assert(params.userIds, Joi.array().required(), 'OrgId of the user SU');
|
|
64
|
+
Joi.assert(params.message, Joi.object().required(), 'Object with data to send user');
|
|
65
|
+
Joi.assert(session, Joi.string().required(), 'Session, token JWT');
|
|
66
|
+
|
|
67
|
+
const apiCall = self.client.post(`/admin/send/notifications`, params, self._setHeader(session));
|
|
68
|
+
return self._returnData(await apiCall);
|
|
69
|
+
} catch (ex) {
|
|
70
|
+
throw ex;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
50
74
|
/**
|
|
51
75
|
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
52
76
|
* @description Create notification
|
package/api/admin/task.js
CHANGED
|
@@ -72,6 +72,12 @@ class AdminTask {
|
|
|
72
72
|
* @param {object} params Params to get task
|
|
73
73
|
* @param {string} params.userId User id (_id database)
|
|
74
74
|
* @param {string} [params.filter=NOT_DONE] Filter type CLEAN | EXECUTED | PENDING | LATE | NOT_DONE | DONE
|
|
75
|
+
|
|
76
|
+
* @param {object} params.project Project to return
|
|
77
|
+
* @param {boolean} params.project.returnProcessProperties Return process properties
|
|
78
|
+
* @param {boolean} params.project.returnInitParams Return init params
|
|
79
|
+
|
|
80
|
+
* @param {string} params.userId User id (_id database)
|
|
75
81
|
* @param {boolean} [params.includeOwner=false] Include owner true | false
|
|
76
82
|
* @param {string} session Session, token JWT
|
|
77
83
|
* @public
|
|
@@ -93,15 +99,21 @@ class AdminTask {
|
|
|
93
99
|
Joi.assert(params, Joi.object().required());
|
|
94
100
|
Joi.assert(params.userId, Joi.string().required());
|
|
95
101
|
Joi.assert(params.filter, Joi.string());
|
|
102
|
+
Joi.assert(params.project, Joi.object());
|
|
96
103
|
Joi.assert(params.includeOwner, Joi.boolean());
|
|
97
104
|
Joi.assert(session, Joi.string().required());
|
|
98
105
|
|
|
99
|
-
const filterType = _.get(params, 'filter', 'NOT_DONE');
|
|
100
|
-
const includeOwner = _.get(params, 'includeOwner', false);
|
|
106
|
+
const filterType = _.get(params, 'filter', 'NOT_DONE') || 'NOT_DONE';
|
|
107
|
+
const includeOwner = _.get(params, 'includeOwner', false) || false;
|
|
101
108
|
const {userId} = params;
|
|
102
|
-
|
|
103
109
|
const filter = self._taskFilters(filterType);
|
|
104
|
-
const
|
|
110
|
+
const { returnProcessProperties, returnInitParams } = params?.project ?? {};
|
|
111
|
+
|
|
112
|
+
let queryString = `taskFilter=${filter}&includeOwner=${includeOwner}`;
|
|
113
|
+
|
|
114
|
+
if (returnProcessProperties) queryString = `${queryString}&returnProcessProperties=${returnProcessProperties}`;
|
|
115
|
+
if (returnInitParams) queryString = `${queryString}&returnInitParams=${returnInitParams}`;
|
|
116
|
+
|
|
105
117
|
const apiCall = self._client.get(`/admin/users/${userId}/tasks?${queryString}`, self._setHeader(session));
|
|
106
118
|
return self._returnData(await apiCall);
|
|
107
119
|
} catch (ex) {
|
package/dist/bundle.cjs
CHANGED
|
@@ -9597,6 +9597,30 @@ class AdminNotification {
|
|
|
9597
9597
|
};
|
|
9598
9598
|
}
|
|
9599
9599
|
|
|
9600
|
+
/**
|
|
9601
|
+
* @description Send real time notification
|
|
9602
|
+
* @param {object} params Params to send notification
|
|
9603
|
+
* @param {string} params.userIds Users to send notification
|
|
9604
|
+
* @param {object} params.message Object with data to send user
|
|
9605
|
+
* @param {object} session Session, token JWT
|
|
9606
|
+
* @returns {Promise<*>}
|
|
9607
|
+
*/
|
|
9608
|
+
async realTime(params, session) {
|
|
9609
|
+
const self = this;
|
|
9610
|
+
|
|
9611
|
+
try {
|
|
9612
|
+
Joi__default["default"].assert(params, Joi__default["default"].object().required(), 'Object with params to add notifications');
|
|
9613
|
+
Joi__default["default"].assert(params.userIds, Joi__default["default"].array().required(), 'OrgId of the user SU');
|
|
9614
|
+
Joi__default["default"].assert(params.message, Joi__default["default"].object().required(), 'Object with data to send user');
|
|
9615
|
+
Joi__default["default"].assert(session, Joi__default["default"].string().required(), 'Session, token JWT');
|
|
9616
|
+
|
|
9617
|
+
const apiCall = self.client.post(`/admin/send/notifications`, params, self._setHeader(session));
|
|
9618
|
+
return self._returnData(await apiCall);
|
|
9619
|
+
} catch (ex) {
|
|
9620
|
+
throw ex;
|
|
9621
|
+
}
|
|
9622
|
+
}
|
|
9623
|
+
|
|
9600
9624
|
/**
|
|
9601
9625
|
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
9602
9626
|
* @description Create notification
|
|
@@ -10138,6 +10162,12 @@ class AdminTask {
|
|
|
10138
10162
|
* @param {object} params Params to get task
|
|
10139
10163
|
* @param {string} params.userId User id (_id database)
|
|
10140
10164
|
* @param {string} [params.filter=NOT_DONE] Filter type CLEAN | EXECUTED | PENDING | LATE | NOT_DONE | DONE
|
|
10165
|
+
|
|
10166
|
+
* @param {object} params.project Project to return
|
|
10167
|
+
* @param {boolean} params.project.returnProcessProperties Return process properties
|
|
10168
|
+
* @param {boolean} params.project.returnInitParams Return init params
|
|
10169
|
+
|
|
10170
|
+
* @param {string} params.userId User id (_id database)
|
|
10141
10171
|
* @param {boolean} [params.includeOwner=false] Include owner true | false
|
|
10142
10172
|
* @param {string} session Session, token JWT
|
|
10143
10173
|
* @public
|
|
@@ -10159,15 +10189,21 @@ class AdminTask {
|
|
|
10159
10189
|
Joi__default["default"].assert(params, Joi__default["default"].object().required());
|
|
10160
10190
|
Joi__default["default"].assert(params.userId, Joi__default["default"].string().required());
|
|
10161
10191
|
Joi__default["default"].assert(params.filter, Joi__default["default"].string());
|
|
10192
|
+
Joi__default["default"].assert(params.project, Joi__default["default"].object());
|
|
10162
10193
|
Joi__default["default"].assert(params.includeOwner, Joi__default["default"].boolean());
|
|
10163
10194
|
Joi__default["default"].assert(session, Joi__default["default"].string().required());
|
|
10164
10195
|
|
|
10165
|
-
const filterType = ___default["default"].get(params, 'filter', 'NOT_DONE');
|
|
10166
|
-
const includeOwner = ___default["default"].get(params, 'includeOwner', false);
|
|
10196
|
+
const filterType = ___default["default"].get(params, 'filter', 'NOT_DONE') || 'NOT_DONE';
|
|
10197
|
+
const includeOwner = ___default["default"].get(params, 'includeOwner', false) || false;
|
|
10167
10198
|
const {userId} = params;
|
|
10168
|
-
|
|
10169
10199
|
const filter = self._taskFilters(filterType);
|
|
10170
|
-
const
|
|
10200
|
+
const { returnProcessProperties, returnInitParams } = params?.project ?? {};
|
|
10201
|
+
|
|
10202
|
+
let queryString = `taskFilter=${filter}&includeOwner=${includeOwner}`;
|
|
10203
|
+
|
|
10204
|
+
if (returnProcessProperties) queryString = `${queryString}&returnProcessProperties=${returnProcessProperties}`;
|
|
10205
|
+
if (returnInitParams) queryString = `${queryString}&returnInitParams=${returnInitParams}`;
|
|
10206
|
+
|
|
10171
10207
|
const apiCall = self._client.get(`/admin/users/${userId}/tasks?${queryString}`, self._setHeader(session));
|
|
10172
10208
|
return self._returnData(await apiCall);
|
|
10173
10209
|
} catch (ex) {
|