Skip to content
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

Uniqueness on account update #33

Open
AHBruns opened this issue Jan 9, 2023 · 0 comments
Open

Uniqueness on account update #33

AHBruns opened this issue Jan 9, 2023 · 0 comments

Comments

@AHBruns
Copy link

AHBruns commented Jan 9, 2023

I may be wrong, but I believe this accounts implementation allows for multiple accounts to claim the same email/username by first creating accounts separately, then changing the emails/usernames of the different accounts to be the same. This is an issue I've faced in my own work, and found I had to solve it via a separate aggregate + a process manager.

My solution uses a map aggregate where each instance is a different map. All account emails are tracked in an account_emails map aggregate instance where the keys are emails, and values are account ids. The process manager starts in response to an account email change requested event, then reserves the email it plans to use in the account_emails map aggregate instance, then updates the account in the account aggregate, then releases the old email in the account_emails map aggregate instance. If the account aggregate update fails, it releases the new email in the account_emails map aggregate instance then fails.

Do you have a simpler solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant