@dhyasama/totem-models 6.16.0 → 6.16.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.
@@ -1818,20 +1818,18 @@ module.exports = function(mongoose, config) {
1818
1818
  this.collection.stats(cb);
1819
1819
  };
1820
1820
 
1821
- LimitedPartner.statics.upsert = function(lp, username, role, cb) {
1821
+ Organization.statics.upsert = function(org, username, cb) {
1822
1822
 
1823
- if (!lp) { return cb(new Error('lp is required'), null); }
1824
- if (!username) { return cb(new Error('username is required'), null); }
1823
+ if (!org) { return cb(new Error('Organization is required'), null); }
1824
+ if (!username) { return cb(new Error('Username is required'), null); }
1825
1825
 
1826
- lp.entered.by = username;
1827
- lp.entered.on = new Date();
1826
+ org.entered.by = username;
1827
+ org.entered.on = new Date();
1828
1828
 
1829
- lp.extendWithWriteFilter(lp, role);
1830
- lp.save(function(err, result) {
1831
- if (err) return cb(err, null);
1832
- result.applyReadFilter(role);
1833
- return cb(null, result);
1834
- });
1829
+ // Clean up missing references
1830
+ org.people = _.reject(org.people, function(item) { return !item.person; });
1831
+
1832
+ org.save(cb);
1835
1833
 
1836
1834
  };
1837
1835
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "6.16.0",
3
+ "version": "6.16.1",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",