@dhyasama/totem-models 6.11.13 → 6.14.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.
- package/.npmignore +14 -0
- package/lib/Organization.js +23 -2
- package/lib/Person.js +2 -1
- package/package-lock.json +1829 -0
- package/package.json +1 -1
package/.npmignore
ADDED
package/lib/Organization.js
CHANGED
|
@@ -136,7 +136,8 @@ module.exports = function(mongoose, config) {
|
|
|
136
136
|
}],
|
|
137
137
|
|
|
138
138
|
clearbit: {
|
|
139
|
-
uuid: { type: String, unique: true, partialFilterExpression : { type : "string" }, trim: true }
|
|
139
|
+
uuid: { type: String, unique: true, partialFilterExpression : { type : "string" }, trim: true },
|
|
140
|
+
lastEnrichmentRequestedOn: { type: Date, default: null }
|
|
140
141
|
},
|
|
141
142
|
|
|
142
143
|
crunchbase: {
|
|
@@ -1829,7 +1830,7 @@ module.exports = function(mongoose, config) {
|
|
|
1829
1830
|
Organization.statics.modify = function(filter, update, cb) {
|
|
1830
1831
|
|
|
1831
1832
|
// VERY IMPORTANT NOTE
|
|
1832
|
-
// findOneAndUpdate
|
|
1833
|
+
// findByIdAndUpdate and findOneAndUpdate do not trigger pre-save hook so that code will not run here
|
|
1833
1834
|
// at this time, the only known and approved use of this method is for adding and removing roles in totem web
|
|
1834
1835
|
|
|
1835
1836
|
if (!cb) throw new Error('cb is required');
|
|
@@ -1846,6 +1847,26 @@ module.exports = function(mongoose, config) {
|
|
|
1846
1847
|
|
|
1847
1848
|
};
|
|
1848
1849
|
|
|
1850
|
+
Organization.statics.modifyById = function(id, update, cb) {
|
|
1851
|
+
|
|
1852
|
+
// VERY IMPORTANT NOTE
|
|
1853
|
+
// findByIdAndUpdate and findOneAndUpdate do not trigger pre-save hook so that code will not run here
|
|
1854
|
+
// at this time, the only known and approved use of this method is for the org edit form in totem web
|
|
1855
|
+
|
|
1856
|
+
if (!cb) throw new Error('cb is required');
|
|
1857
|
+
if (!id) { return cb(new Error('id is required'), null); }
|
|
1858
|
+
if (!update) { return cb(new Error('update is required'), null); }
|
|
1859
|
+
|
|
1860
|
+
var self = this;
|
|
1861
|
+
|
|
1862
|
+
// https://mongoosejs.com/docs/api.html#model_Model.findOneAndUpdate
|
|
1863
|
+
// options runValidators defaults false which is ok since we have upsert false
|
|
1864
|
+
// new returns the updated document
|
|
1865
|
+
|
|
1866
|
+
self.findByIdAndUpdate(id, update, { upsert: false, new: true }, cb);
|
|
1867
|
+
|
|
1868
|
+
};
|
|
1869
|
+
|
|
1849
1870
|
|
|
1850
1871
|
|
|
1851
1872
|
///////////////////////////////////////////////////////////////////////////////////////
|
package/lib/Person.js
CHANGED
|
@@ -71,7 +71,8 @@ module.exports = function(mongoose, config) {
|
|
|
71
71
|
website: { type: String, default: null, required: false, trim: true, lowercase: true },
|
|
72
72
|
|
|
73
73
|
clearbit: {
|
|
74
|
-
uuid: { type: String, unique: true, partialFilterExpression : { type : "string" }, trim: true }
|
|
74
|
+
uuid: { type: String, unique: true, partialFilterExpression : { type : "string" }, trim: true },
|
|
75
|
+
lastEnrichmentRequestedOn: { type: Date, default: null }
|
|
75
76
|
},
|
|
76
77
|
|
|
77
78
|
crunchbase: {
|