accounts app has ability to have multiple e-mail addresses for UserModels.
When there are multiple servers doing transactions there might be times that records get duplicated.
Solution
This cannot be fixed automatically because it might be really hard to determine which one to
keep and which one to delete. Any wrong behavior will result with bad user experience.
As first step is to create a celery task that will search through user accounts and find duplicate email.
Flow
Query all User records that have more than 1 UserEmail records.
If there are records returned go to step 3. If there are no records go to step 4
If there are records, alert them in #alerts-p2-danger listing out email addresses and user IDs. Goto step 5
a. It might be useful to also include a link for admin tools
Alert in #alerts-p4-info that there are no problematic tools.
End Task
Important variables to be determined
Task schedule time
Should it have an enabled setting?
Slack alert channel names should be in settings?
Record item string should be a setting to change project specific?
We should probably decompose this into smaller components that can be used piece-meal. For example, instead of making it a Celery task, could we just make it a util function that can be invoked from multiple various entry points (Celery task being one of them; but also an Admin Tools webpage / triggered by an event; a cronjob; etc)
Separate schedule vs work performed vs data vs UI
Some principles:
Provide an opinionated approach/solution with "default combination of setup/settings" for things that are standalone / do not have a major impact on infrastructure/architectural decisions (e.g. microwavable Mac-n-Cheese, just add cheese sauce mix and water and heat)
For things that do require additional architecture/infrastructure, provide call sites or hooks to easily invoke, but not not pre-mix, do not prescribe a specific solution.
Problem
accounts
app has ability to have multiple e-mail addresses forUserModel
s. When there are multiple servers doing transactions there might be times that records get duplicated.Solution
This cannot be fixed automatically because it might be really hard to determine which one to keep and which one to delete. Any wrong behavior will result with bad user experience.
As first step is to create a celery task that will search through user accounts and find duplicate email.
Flow
User
records that have more than 1UserEmail
records.3
. If there are no records go to step4
#alerts-p2-danger
listing out email addresses and user IDs. Goto step5
a. It might be useful to also include a link for admin tools#alerts-p4-info
that there are no problematic tools.Important variables to be determined