@docbrasil/api-systemmanager 1.0.122 → 1.1.0-test
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/user.js +30 -0
- package/dist/bundle.cjs +30 -0
- package/dist/bundle.mjs +1 -1
- package/package.json +1 -1
- package/.project +0 -11
- package/package-lock.json +0 -4635
package/api/admin/user.js
CHANGED
|
@@ -78,6 +78,36 @@ class AdminUser {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
/**
|
|
82
|
+
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
83
|
+
* @description Request profile by userId
|
|
84
|
+
* @param {string} userIds Users identifier (_id database)
|
|
85
|
+
* @param {string} apiKey Api to use to search users
|
|
86
|
+
* @return {Promise}
|
|
87
|
+
* @public
|
|
88
|
+
* @async
|
|
89
|
+
* @example
|
|
90
|
+
*
|
|
91
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
92
|
+
* const api = new API();
|
|
93
|
+
* const userIds = ['55e4a3bd6be6b45210833fae', '55e4a3bd6be6b45210833fae'];
|
|
94
|
+
* const apiKey = 'c9bbd652-d112-454e-8595-f1669f49dde0';
|
|
95
|
+
* await api.admin.user.findByIds(userIds, apiKey);
|
|
96
|
+
*/
|
|
97
|
+
async findByIds(userIds, apiKey) {
|
|
98
|
+
const self = this;
|
|
99
|
+
|
|
100
|
+
try {
|
|
101
|
+
Joi.assert(userIds, Joi.array().items(Joi.string()).required(), 'Users identifier (_id database)');
|
|
102
|
+
Joi.assert(apiKey, Joi.string().required(), 'Api to use to search users');
|
|
103
|
+
|
|
104
|
+
const apiCall = self.client.post(`/api/users?apiKey=${apiKey}`, { userIds });
|
|
105
|
+
return self._returnData(await apiCall);
|
|
106
|
+
} catch (ex) {
|
|
107
|
+
throw ex;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
81
111
|
/**
|
|
82
112
|
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
83
113
|
* @description Update password by userId
|
package/dist/bundle.cjs
CHANGED
|
@@ -11261,6 +11261,36 @@ class AdminUser {
|
|
|
11261
11261
|
}
|
|
11262
11262
|
}
|
|
11263
11263
|
|
|
11264
|
+
/**
|
|
11265
|
+
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
11266
|
+
* @description Request profile by userId
|
|
11267
|
+
* @param {string} userIds Users identifier (_id database)
|
|
11268
|
+
* @param {string} apiKey Api to use to search users
|
|
11269
|
+
* @return {Promise}
|
|
11270
|
+
* @public
|
|
11271
|
+
* @async
|
|
11272
|
+
* @example
|
|
11273
|
+
*
|
|
11274
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
11275
|
+
* const api = new API();
|
|
11276
|
+
* const userIds = ['55e4a3bd6be6b45210833fae', '55e4a3bd6be6b45210833fae'];
|
|
11277
|
+
* const apiKey = 'c9bbd652-d112-454e-8595-f1669f49dde0';
|
|
11278
|
+
* await api.admin.user.findByIds(userIds, apiKey);
|
|
11279
|
+
*/
|
|
11280
|
+
async findByIds(userIds, apiKey) {
|
|
11281
|
+
const self = this;
|
|
11282
|
+
|
|
11283
|
+
try {
|
|
11284
|
+
Joi__default["default"].assert(userIds, Joi__default["default"].array().items(Joi__default["default"].string()).required(), 'Users identifier (_id database)');
|
|
11285
|
+
Joi__default["default"].assert(apiKey, Joi__default["default"].string().required(), 'Api to use to search users');
|
|
11286
|
+
|
|
11287
|
+
const apiCall = self.client.post(`/api/users?apiKey=${apiKey}`, { userIds });
|
|
11288
|
+
return self._returnData(await apiCall);
|
|
11289
|
+
} catch (ex) {
|
|
11290
|
+
throw ex;
|
|
11291
|
+
}
|
|
11292
|
+
}
|
|
11293
|
+
|
|
11264
11294
|
/**
|
|
11265
11295
|
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
11266
11296
|
* @description Update password by userId
|