@dhyasama/totem-models 8.109.0 → 8.110.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.
Files changed (2) hide show
  1. package/lib/CapTable.js +10 -50
  2. package/package.json +1 -1
package/lib/CapTable.js CHANGED
@@ -213,62 +213,17 @@ module.exports = function(mongoose, config) {
213
213
 
214
214
  });
215
215
 
216
-
217
-
218
216
  ///////////////////////////////////////////////////////////////////////////////////////
219
217
  // METHODS
220
218
  // Methods operate on a single document that has already been returned
221
219
  // Note that running a method on a document does not save it
222
220
  ///////////////////////////////////////////////////////////////////////////////////////
223
221
 
224
- CapTable.methods.mapFundsToOrgs = function mapFundsToOrgs(cb) {
225
-
226
- // Check each stakeholder to see if it is a fund, and if so, get the org the fund belongs to
227
-
228
- var self = this;
229
- var map = [];
230
-
231
- var getOrg = function getOrg(stakeholder, callback) {
232
-
233
- if (!stakeholder.fund) return callback();
234
-
235
- var fundid = stakeholder.fund._id || stakeholder.fund;
236
-
237
- Organization.getByFund(fundid, function(err, result) {
238
-
239
- if (err) return callback(err);
240
- else if (!result) return callback();
241
-
242
- map.push({
243
- fund: fundid,
244
- org: result
245
- });
246
-
247
- return callback();
248
-
249
- });
250
-
251
- };
252
-
253
- async.each(self.stakeholders, getOrg, function(err) {
254
- if (err) return cb(err, null);
255
- else return cb(null, map);
256
- });
257
-
258
- };
259
-
260
-
261
-
262
222
  //////////////////////////////////////////////////////
263
223
  // STATICS
264
224
  // Statics operate on the entire collection
265
225
  //////////////////////////////////////////////////////
266
226
 
267
- CapTable.statics.delete = function(id, cb) {
268
- var self = this;
269
- self.findByIdAndRemove(id, cb);
270
- };
271
-
272
227
  CapTable.statics.getForCustomer = function getForCustomer(orgId, customerId, cb) {
273
228
 
274
229
  var self = this;
@@ -311,7 +266,7 @@ module.exports = function(mongoose, config) {
311
266
 
312
267
  };
313
268
 
314
- CapTable.statics.deleteAllForCustomer = function(customerId, cb) {
269
+ CapTable.statics.deleteAllForCustomer = function deleteAllForCustomer(customerId, cb) {
315
270
  var self = this;
316
271
  self.remove({ customer: customerId, 'entered.by': { $ne: 'carta-parser' } }, cb);
317
272
  };
@@ -371,7 +326,7 @@ module.exports = function(mongoose, config) {
371
326
 
372
327
  };
373
328
 
374
- CapTable.statics.insert = function(capTable, username, cb) {
329
+ CapTable.statics.insert = function insert(capTable, username, cb) {
375
330
 
376
331
  var self = this;
377
332
 
@@ -392,7 +347,7 @@ module.exports = function(mongoose, config) {
392
347
 
393
348
  };
394
349
 
395
- CapTable.statics.replace = function(capTable, username, cb) {
350
+ CapTable.statics.replace = function replace(capTable, username, cb) {
396
351
 
397
352
  var self = this;
398
353
 
@@ -411,7 +366,7 @@ module.exports = function(mongoose, config) {
411
366
 
412
367
  };
413
368
 
414
- CapTable.statics.search = function (terms, options, cb) {
369
+ CapTable.statics.search = function search(terms, options, cb) {
415
370
 
416
371
  const self = this;
417
372
 
@@ -458,7 +413,12 @@ module.exports = function(mongoose, config) {
458
413
 
459
414
  capTable.save(cb);
460
415
 
461
- }
416
+ };
417
+
418
+ CapTable.statics.delete = function(id, cb) {
419
+ var self = this;
420
+ self.findByIdAndRemove(id, cb);
421
+ };
462
422
 
463
423
  ///////////////////////////////////////////////////////////////////////////////////////
464
424
  // HOOKS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "8.109.0",
3
+ "version": "8.110.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",