api
api copied to clipboard
Store document diffs
Overview
On Top of the existing history collection, which is useful for auditing at DB level, introduce a diff collection to handle unpublished changes.
Features
- Store diff document in a separate collection
- Flag published state on each diff document
- Apply unpublished diffs based on
?includeDiffs=trueflag on GET query - Apply all diffs and save to original document with a single call to the document endpoint
Benefits
- Introduces a draft state to all documents
- Can be used in web for a preview instance
- Introduces a reliable changelog view
- Removes the need to retain all history
Questions for the floor
- How do we handle hooks? Do compile the diffs before handing to a hook if
includeDiffsis present onPOSTandPUT? - Can a
PUTrequest be made to a document that has outstanding diffs
@abovebored @jimlambie and @josephdenne as discussed yesterday.
@eduardoboucas hooks question for you :)