@dhyasama/totem-models 3.10.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.
@@ -665,9 +665,34 @@ module.exports = function(mongoose, config) {
665
665
  };
666
666
 
667
667
  Organization.statics.findByDomains = function findByDomains(domains, cb) {
668
- 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
+
669
693
  var query = this.find({ $or: [ {'website': { $in : domains }}, {'websiteAliases': { $in : domains }} ], 'deleted': {$ne: true} });
670
694
  query.exec(cb);
695
+
671
696
  };
672
697
 
673
698
  Organization.statics.findByFunds = function findByFunds(fundids, cb) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "3.10.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: {