Support.Middleware.Uniqueness module works fine if the only thing that you need to validate is if the command hasn't been dispatched before with a common field name.
But what happens if you dispatch a command to remove something and later you try to create it again with the same value in the unique field? You would get an error, even if the record doesn't exist anymore.
To avoid that it would be great to add a timestamp comparing the dispatched commands in order to avoid comparing commands in long periods of time. At the end of the day, we just need this uniqueness feature to avoid duplicated event creation.
I'm going to try to make the changes and submit a pull request.
Support.Middleware.Uniqueness
module works fine if the only thing that you need to validate is if the command hasn't been dispatched before with a common field name.But what happens if you dispatch a command to remove something and later you try to create it again with the same value in the unique field? You would get an error, even if the record doesn't exist anymore.
To avoid that it would be great to add a timestamp comparing the dispatched commands in order to avoid comparing commands in long periods of time. At the end of the day, we just need this uniqueness feature to avoid duplicated event creation.
I'm going to try to make the changes and submit a pull request.