jeudi 13 février 2020

Commands or Audit collection used to determin actions taken on an object

Given a client application that consumes a rest API, is there an existing pattern or approach for delivering a collection of 'actions, events, commands' along with a data payload that represents the actions that were taken to mutate the payload to the state it is in?

So, if page is loaded with a (pseudo code - also assume GUIDs are on the object...not listing them here for brevity.

GET house/76 => {house: {frontDoor: { open: false, locked: true } } }

And the client has a form that allows you to mutate that object where the following is the POST

POST: {house: {frontDoor: { open: true, locked: false } } }

and the associated action log would be something like

[{ OpenedDoor: id }, {UnlockedDoor: id }]

Given the collection of actions you could then rebuild the state of the original object to its mutated state, or audit the actions to take other actions.

Aucun commentaire:

Enregistrer un commentaire