-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#175497433] Add Profile unsubscription on feed #86
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -107,6 +107,9 @@ export function GetSubscriptionsFeedHandler( | |||||
const profileSubscriptionsQuery: PagedQuery = pagedQuery( | ||||||
queryFilterForKey(`P-${subscriptionsDateUTC}-S`) | ||||||
); | ||||||
const profileUnsubscriptionsQuery: PagedQuery = pagedQuery( | ||||||
queryFilterForKey(`P-${subscriptionsDateUTC}-U`) | ||||||
); | ||||||
const serviceSubscriptionsQuery: PagedQuery = pagedQuery( | ||||||
queryFilterForKey(`S-${subscriptionsDateUTC}-${serviceId}-S`) | ||||||
); | ||||||
|
@@ -117,6 +120,11 @@ export function GetSubscriptionsFeedHandler( | |||||
// users that created their account on date | ||||||
const profileSubscriptionsSet = await queryUsers(profileSubscriptionsQuery); | ||||||
|
||||||
// users that deleted their account on date | ||||||
const profileUnsubscriptionsSet = await queryUsers( | ||||||
profileUnsubscriptionsQuery | ||||||
); | ||||||
|
||||||
// users that subscribed to the client service on date | ||||||
const serviceSubscriptionsSet = await queryUsers(serviceSubscriptionsQuery); | ||||||
|
||||||
|
@@ -127,14 +135,20 @@ export function GetSubscriptionsFeedHandler( | |||||
|
||||||
const subscriptions = new Array<FiscalCodeHash>(); | ||||||
profileSubscriptionsSet.forEach(ps => { | ||||||
if (!serviceUnsubscriptionsSet.has(ps)) { | ||||||
if ( | ||||||
!serviceUnsubscriptionsSet.has(ps) && | ||||||
!profileUnsubscriptionsSet.has(ps) | ||||||
) { | ||||||
// add new users to the new subscriptions, skipping those that | ||||||
// unsubscribed from this service | ||||||
// unsubscribed from this service or deleted its account | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 8857930 |
||||||
subscriptions.push(ps); | ||||||
} | ||||||
}); | ||||||
serviceSubscriptionsSet.forEach(ss => { | ||||||
if (!profileSubscriptionsSet.has(ss)) { | ||||||
if ( | ||||||
!profileSubscriptionsSet.has(ss) && | ||||||
!profileUnsubscriptionsSet.has(ss) | ||||||
) { | ||||||
// add all users that subscribed to this service, skipping those that | ||||||
// are new users as they're yet counted in as new subscribers in the | ||||||
// previous step | ||||||
|
@@ -143,11 +157,20 @@ export function GetSubscriptionsFeedHandler( | |||||
}); | ||||||
|
||||||
const unsubscriptions = new Array<FiscalCodeHash>(); | ||||||
|
||||||
profileUnsubscriptionsSet.forEach(pu => | ||||||
// add all users that deleted its own account | ||||||
unsubscriptions.push(pu) | ||||||
); | ||||||
|
||||||
serviceUnsubscriptionsSet.forEach(su => { | ||||||
if (!profileSubscriptionsSet.has(su)) { | ||||||
if ( | ||||||
!profileSubscriptionsSet.has(su) && | ||||||
!profileUnsubscriptionsSet.has(su) | ||||||
) { | ||||||
// add all users that unsubscribed from this service, skipping those | ||||||
// that created the profile on the same day as the service will not | ||||||
// yet know they exist | ||||||
// yet know they exist or deleted its account | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 8857930 |
||||||
unsubscriptions.push(su); | ||||||
} | ||||||
}); | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this check is useless since you either have a profile subscription OR a profile unsubscription but never both in the same day
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is true if we mantain 7 delay days between request and effectiveness account's deletion. If we enable instant delete of personal data, it should be possible. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's true in any scenario since when you create the (un)subscription record in the same day, you delete any previous (un)subscription here: https://github.com/pagopa/io-functions-app/blob/master/UpdateSubscriptionsFeedActivity/index.ts#L102
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 8857930