@dhyasama/totem-models 6.4.2 → 6.5.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/Deal.js +0 -24
- package/package.json +1 -1
- package/.npmignore +0 -14
- package/package-lock.json +0 -1829
package/lib/Deal.js
CHANGED
|
@@ -56,14 +56,6 @@ module.exports = function(mongoose, config) {
|
|
|
56
56
|
description: { type: String, trim: true, required: true }
|
|
57
57
|
}],
|
|
58
58
|
|
|
59
|
-
votes: [{
|
|
60
|
-
timestamp: { type: Date, required: true, default: Date.now },
|
|
61
|
-
person: { type: Schema.ObjectId, ref: 'Person', required: true },
|
|
62
|
-
value: { type: Number }
|
|
63
|
-
}],
|
|
64
|
-
|
|
65
|
-
sectors: [{ type: String, trim: true }],
|
|
66
|
-
|
|
67
59
|
customFields: { type: Schema.Types.Mixed }
|
|
68
60
|
|
|
69
61
|
});
|
|
@@ -106,21 +98,6 @@ module.exports = function(mongoose, config) {
|
|
|
106
98
|
|
|
107
99
|
});
|
|
108
100
|
|
|
109
|
-
Deal.virtual('voteValue').get(function () {
|
|
110
|
-
|
|
111
|
-
var self = this;
|
|
112
|
-
|
|
113
|
-
if(!self.votes || self.votes.length == 0) return null;
|
|
114
|
-
|
|
115
|
-
var voteValue = 0;
|
|
116
|
-
_.each(self.votes, function(vote) {
|
|
117
|
-
voteValue += vote.value;
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
return voteValue;
|
|
121
|
-
|
|
122
|
-
});
|
|
123
|
-
|
|
124
101
|
///////////////////////////////////////////////////////////////////////////////////////
|
|
125
102
|
// METHODS
|
|
126
103
|
// Methods operate on a single document that has already been returned
|
|
@@ -198,7 +175,6 @@ module.exports = function(mongoose, config) {
|
|
|
198
175
|
.populate('messages')
|
|
199
176
|
.populate('sources.person', 'name avatarUrl title')
|
|
200
177
|
.populate('referrers.person', 'name avatarUrl title')
|
|
201
|
-
.populate('votes.person', 'name avatarUrl title')
|
|
202
178
|
.populate({
|
|
203
179
|
path: 'documents',
|
|
204
180
|
match: { customer: customerId }
|
package/package.json
CHANGED