Golang API server » History » Version 2
Peter Amstutz, 08/09/2018 06:05 PM
h1. Golang API server
Currently thinking about how to structure the callbacks that happen when updating and saving a record.
Types of callbacks:
* Fix-ups: modifying a column value, for example, stripping signatures from manifest_text
* Fill-ins: setting certain columns implies filling in another value (for example, setting portable_data_hash from manifest_text)
* Transitions: check that it semantically valid to go to record state Y from record state X (eg X and Y may both be valid, but going (X → Y) may not be valid)
* Permissions: check that the user making the request is allowed to make that modification
* Validations: check that a given record value is valid
Callbacks are very sensitive to ordering. For example, a record may not pass Validation until a Fix-up has been applied. Transition checks may occur before or after Fill-ins or Fix-ups.
Callback types have different contracts:
Fix-up and Fill-in operations potentially modify the update operation. Transition and Permission validations rely on both the before and after state. Plain Validation checks only look at the current state, but may apply to both create and update requests.