@@ -12,6 +12,9 @@ const FEATURE_NAME = 'compliance_hub';
12
12
plugins . register ( "/permissions/features" , function ( ob ) {
13
13
ob . features . push ( FEATURE_NAME ) ;
14
14
} ) ;
15
+
16
+ plugins . internalDrillEvents . push ( "[CLY]_consent" ) ;
17
+
15
18
//write api call
16
19
plugins . register ( "/sdk/user_properties" , function ( ob ) {
17
20
var params = ob . params ;
@@ -93,6 +96,13 @@ const FEATURE_NAME = 'compliance_hub';
93
96
sc : params . app_user . sc || 0
94
97
} ) ;
95
98
99
+ var events = [ {
100
+ key : "[CLY]_consent" ,
101
+ count : 1 ,
102
+ segmentation : params . qstring . consent
103
+ } ] ;
104
+ plugins . dispatch ( "/plugins/drill" , { params : params , dbAppUser : params . app_user , events : events } ) ;
105
+
96
106
plugins . dispatch ( "/consent/change" , { params : params , changes : changes } ) ;
97
107
}
98
108
}
@@ -361,23 +371,35 @@ const FEATURE_NAME = 'compliance_hub';
361
371
var appId = ob . appId ;
362
372
common . db . collection ( 'consents' ) . remove ( { '_id' : { $regex : appId + ".*" } } , function ( ) { } ) ;
363
373
common . db . collection ( 'consent_history' + appId ) . drop ( function ( ) { } ) ;
374
+ if ( common . drillDb ) {
375
+ common . drillDb . collection ( "drill_events" + crypto . createHash ( 'sha1' ) . update ( "[CLY]_consent" + appId ) . digest ( 'hex' ) ) . drop ( function ( ) { } ) ;
376
+ }
364
377
} ) ;
365
378
366
379
plugins . register ( "/i/apps/reset" , function ( ob ) {
367
380
var appId = ob . appId ;
368
381
common . db . collection ( 'consents' ) . remove ( { '_id' : { $regex : appId + ".*" } } , function ( ) { } ) ;
369
382
common . db . collection ( 'consent_history' + appId ) . drop ( function ( ) { } ) ;
383
+ if ( common . drillDb ) {
384
+ common . drillDb . collection ( "drill_events" + crypto . createHash ( 'sha1' ) . update ( "[CLY]_consent" + appId ) . digest ( 'hex' ) ) . drop ( function ( ) { } ) ;
385
+ }
370
386
} ) ;
371
387
372
388
plugins . register ( "/i/apps/clear_all" , function ( ob ) {
373
389
var appId = ob . appId ;
374
390
common . db . collection ( 'consents' ) . remove ( { '_id' : { $regex : appId + ".*" } } , function ( ) { } ) ;
391
+ if ( common . drillDb ) {
392
+ common . drillDb . collection ( "drill_events" + crypto . createHash ( 'sha1' ) . update ( "[CLY]_consent" + appId ) . digest ( 'hex' ) ) . drop ( function ( ) { } ) ;
393
+ }
375
394
} ) ;
376
395
377
396
plugins . register ( "/i/apps/clear" , function ( ob ) {
378
397
var appId = ob . appId ;
379
398
var ids = ob . ids ;
380
399
common . db . collection ( 'consents' ) . remove ( { $and : [ { '_id' : { $regex : appId + ".*" } } , { '_id' : { $nin : ids } } ] } , function ( ) { } ) ;
400
+ if ( common . drillDb ) {
401
+ common . drillDb . collection ( "drill_events" + crypto . createHash ( 'sha1' ) . update ( "[CLY]_consent" + appId ) . digest ( 'hex' ) ) . remove ( { ts : { $lt : ob . moment . valueOf ( ) } } , function ( ) { } ) ;
402
+ }
381
403
} ) ;
382
404
} ( plugin ) ) ;
383
405
0 commit comments