@dhyasama/totem-models 7.25.0 → 7.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 +1 -0
- package/lib/SheetSync.js +44 -0
- package/lib/Webhook.js +1 -1
- package/package.json +1 -1
- package/.npmignore +0 -14
- package/package-lock.json +0 -1927
package/index.js
CHANGED
|
@@ -63,6 +63,7 @@ var bootstrap = function(mongoose, config) {
|
|
|
63
63
|
require('./lib/List.js')(mongoose, config);
|
|
64
64
|
require('./lib/Message.js')(mongoose, config);
|
|
65
65
|
require('./lib/News.js')(mongoose, config);
|
|
66
|
+
require('./lib/SheetSync.js')(mongoose, config);
|
|
66
67
|
require('./lib/Snapshot.js')(mongoose, config);
|
|
67
68
|
require('./lib/Webhook.js')(mongoose, config);
|
|
68
69
|
|
package/lib/SheetSync.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
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 SheetSync = new Schema({
|
|
12
|
+
customer: { type: String, required: true },
|
|
13
|
+
uuid: { type: String, required: true },
|
|
14
|
+
syncedOn: { type: Date, required: true },
|
|
15
|
+
syncedBy: { type: String, trim: true },
|
|
16
|
+
errors: [{
|
|
17
|
+
step: { type: String },
|
|
18
|
+
message: { type: String }
|
|
19
|
+
}]
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
SheetSync.statics.getByUUID = function getByUUID(customerId, uuid, cb) {
|
|
23
|
+
|
|
24
|
+
var self = this;
|
|
25
|
+
|
|
26
|
+
var query = self.findOne({
|
|
27
|
+
'customer': customerId,
|
|
28
|
+
'uuid': uuid
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
query.exec(cb);
|
|
32
|
+
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
SheetSync.statics.upsert = function(sheetsync, cb) {
|
|
36
|
+
sheetsync.createdOn = new Date();
|
|
37
|
+
sheetsync.save(cb);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
SheetSync.set('autoIndex', false);
|
|
41
|
+
|
|
42
|
+
mongoose.model('SheetSync', SheetSync);
|
|
43
|
+
|
|
44
|
+
};
|
package/lib/Webhook.js
CHANGED
package/package.json
CHANGED