bedstuystrong / automation_prime

0 stars 5 forks source link

Model serialization improvements #52

Closed maybejustmaybe closed 3 years ago

maybejustmaybe commented 3 years ago

We shouldn't serialize derived fields (like ticket ID) and we should only serialize changed fields when syncing updates to airtable.

Firstly, we need to set const=True for all derived fields, to prevent automation from updating them. We should also store a snapshot of the initial unmodified model in a _snapshot field, and use that to generate a delta when serializing to airtable. Once the save is successful we can update the snapshot to reflect the current state of the model.