@dhyasama/totem-models 1.22.0 → 1.22.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 (3) hide show
  1. package/.npmignore +14 -0
  2. package/lib/List.js +46 -0
  3. package/package.json +1 -1
package/.npmignore ADDED
@@ -0,0 +1,14 @@
1
+ lib-cov
2
+ *.seed
3
+ *.log
4
+ *.csv
5
+ *.dat
6
+ *.out
7
+ *.pid
8
+ *.gz
9
+
10
+ npm-debug.log
11
+ node_modules
12
+
13
+ .DS_Store
14
+ .idea
package/lib/List.js CHANGED
@@ -122,6 +122,48 @@ module.exports = function(mongoose, config) {
122
122
  .exec(cb);
123
123
  };
124
124
 
125
+ // Get all lists that contain an lp
126
+ List.statics.getByLP = function(lpId, cb) {
127
+
128
+ var self = this;
129
+
130
+ self
131
+ .find({ 'customer': config.CUSTOMER_ID, limitedPartners: lpId })
132
+ .populate('limitedPartners', 'name logoUrl')
133
+ .populate('organizations', 'name logoUrl')
134
+ .populate('people', 'name title avatarUrl')
135
+ .exec(cb);
136
+
137
+ };
138
+
139
+ // Get all lists that contain an org
140
+ List.statics.getByOrg = function(orgId, cb) {
141
+
142
+ var self = this;
143
+
144
+ self
145
+ .find({ 'customer': config.CUSTOMER_ID, organizations: orgId })
146
+ .populate('limitedPartners', 'name logoUrl')
147
+ .populate('organizations', 'name logoUrl')
148
+ .populate('people', 'name title avatarUrl')
149
+ .exec(cb);
150
+
151
+ };
152
+
153
+ // Get all lists that contain a person
154
+ List.statics.getByPerson = function(personId, cb) {
155
+
156
+ var self = this;
157
+
158
+ self
159
+ .find({ 'customer': config.CUSTOMER_ID, people: personId })
160
+ .populate('limitedPartners', 'name logoUrl')
161
+ .populate('organizations', 'name logoUrl')
162
+ .populate('people', 'name title avatarUrl')
163
+ .exec(cb);
164
+
165
+ };
166
+
125
167
  List.statics.getLists = function(cb) {
126
168
 
127
169
  var self = this;
@@ -156,6 +198,10 @@ module.exports = function(mongoose, config) {
156
198
 
157
199
  };
158
200
 
201
+ List.statics.upsert = function (list, cb) {
202
+ list.save(cb);
203
+ };
204
+
159
205
  List.pre('save', function(next) {
160
206
 
161
207
  var self = this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "1.22.0",
3
+ "version": "1.22.1",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",