HugoKlepsch / HugoKlepsch/inventoryBackend
Add "state transition" table to store an items history
- Dominant language
- Python
- Stars
- 4
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
One use case involves the user looking at the timestamped history of an item:
- 2019/07/13 Created (this would be derived from the create_date field of the item, not from the history)
- 2019/08/01 Changed location from Storage to Miseners
- 2019/09/01 Changed listed price from $50 to $40
- 2019/09/02 Sold at $38
This should be possible to accomplish with a transition table with the following fields:
- item_id: foreign key to the item table's item id.
- datetime: datetime of the transition.
- field_changed: The name of the field that changed.
- field_type: A string representation of the type of the field that changed. This would be used in the python code to get the serialization and deserialization functions for the value.
Ex for the Python map:
```
{
'datetime': lambda val: datetime.datetime.strptime(val, FORMAT_STRING),
'numeric': lambda val: float(val),
'string': lambda val: val
[...]
}
```
- old_value: String representation of the old value. This should be human readable
- new_value: String like old_value
This ticket does not include making a page to view history, or automatically adding to the history table .
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.