@dhyasama/totem-models 11.43.0 → 11.45.0
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/lib/Account.js +18 -0
- package/lib/LimitedPartner.js +2 -1
- package/package.json +1 -1
package/lib/Account.js
CHANGED
|
@@ -261,6 +261,24 @@ module.exports = function(mongoose, config) {
|
|
|
261
261
|
|
|
262
262
|
};
|
|
263
263
|
|
|
264
|
+
Account.statics.updateOrg = function(email, customerId, cb) {
|
|
265
|
+
|
|
266
|
+
if (!cb) { throw new Error('cb is required'); }
|
|
267
|
+
if (!email) { return cb(new Error('email is required'), null); }
|
|
268
|
+
if (!customerId) { return cb(new Error('customerId is required'), null); }
|
|
269
|
+
if (!mongoose.Types.ObjectId.isValid(customerId)) { return cb(new Error('customerId is not a valid ObjectId'), null); }
|
|
270
|
+
|
|
271
|
+
const self = this;
|
|
272
|
+
|
|
273
|
+
self.updateOne({ email: email }, { $set: { org: customerId } }, function(err, res) {
|
|
274
|
+
|
|
275
|
+
if (err) { return cb(err, null); }
|
|
276
|
+
cb(null, res);
|
|
277
|
+
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
};
|
|
281
|
+
|
|
264
282
|
Account.statics.listAdminAccounts = function (options, cb) {
|
|
265
283
|
|
|
266
284
|
const self = this;
|
package/lib/LimitedPartner.js
CHANGED