Skip to content

Commit

Permalink
Merge pull request #38 from imesh94/fix/metrics-customer-count-issue
Browse files Browse the repository at this point in the history
Fix customerCount metrics not updating on consent revoke
  • Loading branch information
Akila94 authored Nov 8, 2024
2 parents bd05c91 + c768ba3 commit 1a74c69
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ define stream CountableConsentAuthStream(CONSENT_ID string, CLIENT_ID string, US

define stream ExpiredConsentStream(CONSENT_ID string, CLIENT_ID string, USER_ID string);

define stream RevokedConsentStream(CONSENT_ID string, CLIENT_ID string, USER_ID string);
define stream RevokedConsentStream(CONSENT_ID string, CLIENT_ID string, USER_ID string, CURRENT_STATUS string);

define stream ActiveAuthCountStream(CLIENT_ID string, USER_ID string, ACTIVE_AUTH_COUNT long, LAST_UPDATED long);

Expand Down Expand Up @@ -93,10 +93,10 @@ select CDR_ARRANGEMENT_ID as CONSENT_ID, CLIENT_ID, USER_ID
insert into CountableConsentAuthStream;

-- Filter revoked authorizations that should be counted
from ConsentInputStream[STATUS == "revoked"]#window.unique:first(CDR_ARRANGEMENT_ID) as I join CONSENT_RAW_DATA as T
from ConsentInputStream[STATUS == "Revoked"]#window.unique:first(CDR_ARRANGEMENT_ID) as I join CONSENT_RAW_DATA as T
on I.CDR_ARRANGEMENT_ID == T.CONSENT_ID
select I.CDR_ARRANGEMENT_ID as CONSENT_ID, T.CLIENT_ID as CLIENT_ID, T.USER_ID as USER_ID
having T.STATUS == "authorized"
select I.CDR_ARRANGEMENT_ID as CONSENT_ID, T.CLIENT_ID as CLIENT_ID, T.USER_ID as USER_ID, T.STATUS as CURRENT_STATUS
having CURRENT_STATUS == "authorized"
insert into RevokedConsentStream;

-- Trigger expired authorizations
Expand Down

0 comments on commit 1a74c69

Please sign in to comment.