File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,19 @@ var _ = require('lodash')
2
2
module . exports = function ( backend ) {
3
3
backend . hook = hook . bind ( backend ) ;
4
4
backend . onQuery = onQuery . bind ( backend ) ;
5
+
6
+ backend . use ( 'apply' , function ( shareRequest , done ) {
7
+ console . log ( 'apply' , shareRequest . snapshot )
8
+ const opData = shareRequest . op
9
+ const snapshot = shareRequest . snapshot
10
+
11
+ if ( ! opData . create && ! shareRequest . originalSnapshot ) {
12
+ shareRequest . originalSnapshot = _ . cloneDeep ( snapshot )
13
+ }
14
+
15
+ done ( )
16
+ } )
17
+
5
18
} ;
6
19
7
20
function onQuery ( collectionName , cb ) {
@@ -20,16 +33,7 @@ function onQuery(collectionName, cb) {
20
33
cb ( shareRequest . query , session , next ) ;
21
34
22
35
} ) ;
23
- backend . use ( 'apply' , function ( shareRequest , done ) {
24
- const opData = shareRequest . op
25
- const snapshot = shareRequest . snapshot
26
-
27
- if ( ! opData . create && ! shareRequest . originalSnapshot ) {
28
- shareRequest . originalSnapshot = _ . cloneDeep ( snapshot )
29
- }
30
36
31
- done ( )
32
- } )
33
37
}
34
38
35
39
You can’t perform that action at this time.
0 commit comments