@dhyasama/totem-models 6.8.10 → 6.10.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/index.js +1 -0
- package/lib/Account.js +6 -2
- package/lib/Snapshot.js +33 -0
- package/package-lock.json +1829 -0
- package/package.json +1 -1
- package/test/Snapshot.js +149 -0
package/.npmignore
ADDED
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/Snapshot.js')(mongoose, config);
|
|
66
67
|
require('./lib/Webhook.js')(mongoose, config);
|
|
67
68
|
|
|
68
69
|
};
|
package/lib/Account.js
CHANGED
|
@@ -44,7 +44,9 @@ module.exports = function(mongoose, config) {
|
|
|
44
44
|
params: { type: Schema.Types.Mixed },
|
|
45
45
|
profile: { type: Schema.Types.Mixed },
|
|
46
46
|
watch: { type: Schema.Types.Mixed },
|
|
47
|
-
nextSyncToken: { type: String, default: null }
|
|
47
|
+
nextSyncToken: { type: String, default: null },
|
|
48
|
+
requestTokenRefresh: { type: Boolean, default: false },
|
|
49
|
+
requestTokenRefreshEmailSent: { type: Boolean, default: false }
|
|
48
50
|
},
|
|
49
51
|
|
|
50
52
|
microsoft: {
|
|
@@ -53,7 +55,9 @@ module.exports = function(mongoose, config) {
|
|
|
53
55
|
params: { type: Schema.Types.Mixed },
|
|
54
56
|
profile: { type: Schema.Types.Mixed },
|
|
55
57
|
watch: { type: Schema.Types.Mixed },
|
|
56
|
-
deltaLink: { type: String, default: null }
|
|
58
|
+
deltaLink: { type: String, default: null },
|
|
59
|
+
requestTokenRefresh: { type: Boolean, default: false },
|
|
60
|
+
requestTokenRefreshEmailSent: { type: Boolean, default: false }
|
|
57
61
|
}
|
|
58
62
|
|
|
59
63
|
},
|
package/lib/Snapshot.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
module.exports = function(mongoose, config) {
|
|
4
|
+
|
|
5
|
+
var Schema = mongoose.Schema;
|
|
6
|
+
|
|
7
|
+
var Snapshot = new Schema({
|
|
8
|
+
|
|
9
|
+
createdOn: { type: Date, default: Date.now },
|
|
10
|
+
createdBy: { type: String, required: true, trim: true },
|
|
11
|
+
collectionName: { type: String, required: true, trim: true },
|
|
12
|
+
doc: { type: mongoose.Schema.Types.Mixed, required: true }
|
|
13
|
+
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
Snapshot.statics.getByDocId = function getByDocId(docId, cb) {
|
|
17
|
+
|
|
18
|
+
var self = this;
|
|
19
|
+
|
|
20
|
+
self
|
|
21
|
+
.find({ 'doc._id': docId })
|
|
22
|
+
.sort({ changedOn: -1 })
|
|
23
|
+
.exec(cb);
|
|
24
|
+
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
Snapshot.statics.upsert = function(snapshot, cb) {
|
|
28
|
+
snapshot.save(cb);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
mongoose.model('Snapshot', Snapshot, '_Snapshots');
|
|
32
|
+
|
|
33
|
+
};
|