PleatherStarfish / bom-squad

An inventory and search tool for DIY Eurorack synthesizer modules and components
GNU General Public License v3.0
21 stars 3 forks source link

Build versioning logic for a user's personal inventory #6

Open PleatherStarfish opened 2 years ago

PleatherStarfish commented 2 years ago

The idea is that the user's component inventory should keep the last 500 changes as personal history, so if a user makes a mistake, it's easy to see what they changed and correct it. I think the best approach might be to build this with the Django JSONField model field. The main inventory could still be maintained with the relational tables. But every change to the user's component inventory could be logged with a timestamp in a JSONfield (inventory_history or whatever).

The tricky part of course is writing the logic allowing a user to "restore" the inventory to a previous state or diff a previous state with the current state.