Closed Em-Ant closed 8 years ago
I will try to tackle this. I think this can be done by trying to figure out how the mongoose-id-validator plugin works.
fixed via e30cb8e5fc9ee58dbc643e19ddefc06fc07f094c.
I added a pre validate schema middleware to invalidate the vehicle if consumers couldn't fit in the new vehicle configuration
Example: If you have 5 consumers on Van 1, and you edit that van properties setting
maxSeats
to 3, you get an incorrect state. Before editing we should check for state coherence, and if an incorrect situation is requested, we should abort the update maybe asking to remove the surplus consumers first.