@dhyasama/totem-models 12.15.0 → 12.16.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/Financials.js +6 -6
- package/lib/Round.js +8 -12
- package/package.json +1 -1
package/lib/Financials.js
CHANGED
|
@@ -36,8 +36,8 @@ module.exports = function(mongoose, config) {
|
|
|
36
36
|
period: { type: String, enum: [null, 'month', 'quarter', 'half', 'year']},
|
|
37
37
|
time: {
|
|
38
38
|
hour: { type: Number },
|
|
39
|
-
minute: { type: Number
|
|
40
|
-
second: { type: Number
|
|
39
|
+
minute: { type: Number },
|
|
40
|
+
second: { type: Number }
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
remind: {
|
|
@@ -45,16 +45,16 @@ module.exports = function(mongoose, config) {
|
|
|
45
45
|
occurrences: { type: Number },
|
|
46
46
|
time: {
|
|
47
47
|
hour: { type: Number },
|
|
48
|
-
minute: { type: Number
|
|
49
|
-
second: { type: Number
|
|
48
|
+
minute: { type: Number },
|
|
49
|
+
second: { type: Number }
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
due: {
|
|
53
53
|
daysAfter: { type: Number },
|
|
54
54
|
time: {
|
|
55
55
|
hour: { type: Number },
|
|
56
|
-
minute: { type: Number
|
|
57
|
-
second: { type: Number
|
|
56
|
+
minute: { type: Number },
|
|
57
|
+
second: { type: Number }
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
fiscal: {
|
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
|
-
|
|
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
|