@dhyasama/totem-models 12.15.0 → 12.15.1

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/Round.js +8 -12
  2. package/package.json +1 -1
package/lib/Round.js CHANGED
@@ -806,19 +806,15 @@ module.exports = function(mongoose, config) {
806
806
  if (!options) { throw new Error('options is required'); }
807
807
  if (!options.CUSTOMER_ID) { throw new Error('options.CUSTOMER_ID is required'); }
808
808
  if (!mongoose.Types.ObjectId.isValid(options.CUSTOMER_ID)) { throw new Error('options.CUSTOMER_ID is not a valid ObjectId'); }
809
-
810
- // We need customerFunds to filter rounds - extract from options or get all customer funds
809
+ if (!options.customerFunds) { throw new Error('options.customerFunds is required'); }
810
+
811
+ // Fund has no direct customer field — callers are expected to compute
812
+ // customerFunds via the web-app's cacheHelpers.getCustomerFunds and pass
813
+ // it in. A previous fallback tried to call Fund.findByCustomer(), which
814
+ // has never existed on the Fund model; the fallback was unreachable dead
815
+ // code masked by the fact that every production caller already passes
816
+ // customerFunds explicitly.
811
817
  var customerFunds = options.customerFunds;
812
- if (!customerFunds) {
813
- const Fund = mongoose.model('Fund');
814
- const funds = await new Promise((resolve, reject) => {
815
- Fund.findByCustomer(options.CUSTOMER_ID, (err, result) => {
816
- if (err) reject(err); else resolve(result);
817
- });
818
- });
819
- options.customerFunds = funds;
820
- customerFunds = funds;
821
- }
822
818
 
823
819
  // Find organizations acquired by this org (acquirees)
824
820
  const acquirees = await Organization
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "12.15.0",
3
+ "version": "12.15.1",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",