@dhyasama/totem-models 3.9.0 → 3.11.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.
@@ -650,10 +650,49 @@ module.exports = function(mongoose, config) {
650
650
 
651
651
  };
652
652
 
653
+ Organization.statics.removeCustomerFilters = function(customerId, cb) {
654
+
655
+ var self = this;
656
+
657
+ self
658
+ .update(
659
+ { 'filters.customer': customerId },
660
+ { $pull : { 'filters': { 'customer': customerId } } },
661
+ { multi : true }
662
+ )
663
+ .exec(cb);
664
+
665
+ };
666
+
653
667
  Organization.statics.findByDomains = function findByDomains(domains, cb) {
654
- domains = domains.map(function(domain){ return domain.toLowerCase() })
668
+
669
+ // we haven't been able to avoid some domains having a protocol prefix in the database
670
+ // until we can, use protocol as part of searching by domain
671
+
672
+ domains = domains || [];
673
+ domains = _.compact(domains);
674
+
675
+ // standardize with lowercase and no protocol
676
+ domains = domains.map(function(d) {
677
+ d = d.toLowerCase();
678
+ d = d.replace('http://', '').replace('https://', '');
679
+ return d.toLowerCase()
680
+ });
681
+
682
+ // add http and https alternatives for each domain
683
+ var alternativeDomains = [];
684
+ _.each(domains, function(d) {
685
+ alternativeDomains.push('http://' + d);
686
+ alternativeDomains.push('https://' + d);
687
+ });
688
+
689
+ domains = domains.concat(alternativeDomains);
690
+
691
+ _.each(domains, function(d) { console.log(d); });
692
+
655
693
  var query = this.find({ $or: [ {'website': { $in : domains }}, {'websiteAliases': { $in : domains }} ], 'deleted': {$ne: true} });
656
694
  query.exec(cb);
695
+
657
696
  };
658
697
 
659
698
  Organization.statics.findByFunds = function findByFunds(fundids, cb) {
@@ -833,7 +872,7 @@ module.exports = function(mongoose, config) {
833
872
  if (config.CUSTOMER_ID != 'GLOBAL_PROCESS') lpPopulateOptions.match = { customer: config.CUSTOMER_ID };
834
873
 
835
874
  var query = self.findById(id);
836
- query.populate('people.person', 'name avatarUrl title doNotDisplay');
875
+ query.populate('people.person', 'name avatarUrl title contact doNotDisplay');
837
876
  query.populate('related', 'name logoUrl');
838
877
  query.populate('chairs.first', 'name avatarUrl title');
839
878
  query.populate('chairs.second', 'name avatarUrl title');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "3.9.0",
3
+ "version": "3.11.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",
package/test/config.js CHANGED
@@ -13,7 +13,7 @@ module.exports = {
13
13
  suppressDebugLog: true,
14
14
 
15
15
  db: {
16
- uri: 'mongodb://ffvc:ytnn5m7A9snIJSOLRqwo7Bpo2QkyYx6q@ds043952.mongolab.com:43952/ff-platform-test'
16
+ uri: 'mongodb://gZvwpF5aLFvdc7KFa7qLLiZYv6CTLdfs:TKfdi3LD4583f8EL11k5Y0uukZ151d9n@test-shard-00-00-gv0f3.mongodb.net:27017,test-shard-00-01-gv0f3.mongodb.net:27017,test-shard-00-02-gv0f3.mongodb.net:27017/test?ssl=true&replicaSet=Test-shard-0&authSource=admin'
17
17
  },
18
18
 
19
19
  crypto: {