@dhyasama/totem-models 1.26.3 → 1.27.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/index.js CHANGED
@@ -54,6 +54,7 @@ var bootstrap = function(mongoose, config) {
54
54
  require('./lib/List.js')(mongoose, config);
55
55
  require('./lib/News.js')(mongoose, config);
56
56
  require('./lib/Person.js')(mongoose, config);
57
+ require('./lib/Webhook.js')(mongoose, config);
57
58
 
58
59
  };
59
60
 
package/lib/Person.js CHANGED
@@ -42,7 +42,7 @@ module.exports = function(mongoose, config) {
42
42
 
43
43
  email: [{
44
44
  type: { type: String, enum: ['personal', 'work', 'assistant', 'other'] },
45
- email: { type: String, default: '', es_type: 'text' },
45
+ email: { type: String, default: '' },
46
46
  primary: { type: Boolean, default: false }
47
47
  }],
48
48
 
package/lib/Webhook.js ADDED
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ module.exports = function(mongoose, config) {
4
+
5
+ var
6
+
7
+ Schema = mongoose.Schema,
8
+ env = process.env.NODE_ENV || 'development',
9
+ _ = require('underscore');
10
+
11
+ var Webhook = new Schema({
12
+
13
+ createdOn: { type: Date, required: true },
14
+ provider: { type: String, required: true },
15
+ service: { type: String, required: true },
16
+ headers: { type: Schema.Types.Mixed, required: true },
17
+ body: { type: Schema.Types.Mixed, required: true }
18
+
19
+ });
20
+
21
+ Webhook.statics.upsert = function(webhook, cb) {
22
+ webhook.createdOn = new Date();
23
+ webhook.save(cb);
24
+ };
25
+
26
+ Webhook.set('autoIndex', false);
27
+
28
+ mongoose.model('Webhook', Webhook);
29
+
30
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "1.26.3",
3
+ "version": "1.27.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",