@dhyasama/totem-models 6.26.1 → 6.28.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.
@@ -135,6 +135,13 @@ module.exports = function(mongoose, config) {
135
135
  customer: { type: Schema.ObjectId, ref: 'Organization' }
136
136
  }],
137
137
 
138
+ valuations: [{
139
+ amount: { type: Number, default: 0 },
140
+ description: { type: String, trim: true },
141
+ date: { type: Date, default: null },
142
+ customer: { type: Schema.ObjectId, ref: 'Organization' },
143
+ }],
144
+
138
145
  clearbit: {
139
146
  uuid: { type: String, unique: true, partialFilterExpression : { type : "string" }, trim: true },
140
147
  lastEnrichmentRequestedOn: { type: Date, default: null }
@@ -1430,10 +1437,10 @@ module.exports = function(mongoose, config) {
1430
1437
  self
1431
1438
  .find({ $or:
1432
1439
  [
1433
- { 'social.facebook': new RegExp('facebook.com/' + username + '$', 'i') },
1434
- { 'social.linkedin': new RegExp('linkedin.com/company/' + username + '$', 'i') },
1435
- { 'social.twitter': new RegExp('twitter.com/' + username + '$', 'i') },
1436
- { 'crunchbase.url': new RegExp('crunchbase.com/organization/' + username + '$', 'i') }
1440
+ { 'social.facebook': new RegExp('facebook.com/' + username + '\/?$', 'i') },
1441
+ { 'social.linkedin': new RegExp('linkedin.com/company/' + username + '\/?$', 'i') },
1442
+ { 'social.twitter': new RegExp('twitter.com/' + username + '\/?$', 'i') },
1443
+ { 'crunchbase.url': new RegExp('crunchbase.com/organization/' + username + '\/?$', 'i') }
1437
1444
  ],
1438
1445
  'deleted': { $ne: true }
1439
1446
  })
@@ -2121,6 +2128,7 @@ module.exports = function(mongoose, config) {
2121
2128
 
2122
2129
  doc.lps = _.reject(doc.lps, function(item) { return !item.customer || item.customer.toString() != CUSTOMER_ID; });
2123
2130
  doc.filters = _.reject(doc.filters, function(item) { return !item.customer || item.customer.toString() != CUSTOMER_ID; });
2131
+ doc.valuations = _.reject(doc.valuations, function(item) { return !item.customer || item.customer.toString() != CUSTOMER_ID; });
2124
2132
  doc.iLevel = _.reject(doc.iLevel, function(item) { return !item.customer || item.customer.toString() != CUSTOMER_ID; });
2125
2133
  doc.chairs = _.reject(doc.chairs, function(item) { return !item.customer || item.customer.toString() != CUSTOMER_ID; });
2126
2134
  doc.operating.acquired.private = _.find(doc.operating.acquired.private, function(item) { return !item.customer || item.customer.toString() == CUSTOMER_ID; });
package/lib/Person.js CHANGED
@@ -721,9 +721,9 @@ module.exports = function(mongoose, config) {
721
721
  self
722
722
  .find({ $or:
723
723
  [
724
- { 'social.facebook': new RegExp('facebook.com/' + username + '$', 'i') },
725
- { 'social.linkedin': new RegExp('linkedin.com/in/' + username + '$', 'i') },
726
- { 'social.twitter': new RegExp('twitter.com/' + username + '$', 'i') }
724
+ { 'social.facebook': new RegExp('facebook.com/' + username + '$/?', 'i') },
725
+ { 'social.linkedin': new RegExp('linkedin.com/in/' + username + '\/?$', 'i') },
726
+ { 'social.twitter': new RegExp('twitter.com/' + username + '/?$', 'i') }
727
727
  ],
728
728
  'deleted': { $ne: true }
729
729
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "6.26.1",
3
+ "version": "6.28.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",
@@ -76,8 +76,8 @@ describe('Organization', function() {
76
76
  org2.crunchbase.uuid = 'abc';
77
77
  org2.crunchbase.url = 'abc';
78
78
  org2.social.facebook = 'https://facebook.com/abc';
79
- org2.social.linkedin = 'http://www.linkedin.com/in/abc';
80
- org2.social.twitter = 'twitter.com/abc';
79
+ org2.social.linkedin = 'http://www.linkedin.com/in/abc/';
80
+ org2.social.twitter = 'twitter.com/abc/';
81
81
  org2.iLevel.push({
82
82
  customer: new mongoose.Types.ObjectId(),
83
83
  url: 'https://ilevel.com/test'
package/test/Person.js CHANGED
@@ -141,7 +141,7 @@ describe('Person', function() {
141
141
  person3.aliases.push('Slippery Pete');
142
142
  person3.social = {
143
143
  facebook: 'facebook.com/slipperypete',
144
- linkedin: 'http://www.linkedin.com/in/slipperypete',
144
+ linkedin: 'http://www.linkedin.com/in/slipperypete/',
145
145
  twitter: 'https://twitter.com/slipperypete'
146
146
  };
147
147
  person3.contact.email.push({
@@ -750,7 +750,7 @@ describe('Person', function() {
750
750
  });
751
751
 
752
752
  it('finds person by linkedin with http and no www', function (done) {
753
- Person.findBySocial('http://linkedin.com/in/slipperypete', function (err, result) {
753
+ Person.findBySocial('http://linkedin.com/in/slipperypete?hello=world', function (err, result) {
754
754
  should.not.exist(err);
755
755
  should.exist(result);
756
756
  result.length.should.equal(1);