Skip to content

Uniqueness on account update #33

@AHBruns

Description

@AHBruns

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions