Responsible: Kostis Pristouris
Background
As part of the deck model we define a model for storing the changes applied to the deck after each save or other action on the UI that results to a deck change, with or without creating a new revision.
The change log is defined as an array of change log records that include at least the timestamp and the user performing the deck change. This array is stored in the changeLog
attribute inside a deck revision subdocument in mongo db.
As we support nested decks, a user is essentially editing a deck tree at any given point, so a change set for a deck tree should also be provided by the deck service API. In this document we describe how all the relevant change log records are stored in the mongo db on the deck level. Providing a change log for a deck tree will be analogous to the model described here and is the object of - SWIK-945Getting issue details... STATUS .
Model
We extend the deck revision model to additionally hold a changeLog
attribute which is an array of Deck Change elements.
Deck Change=
property | type | required | format | description |
---|---|---|---|---|
operation | string | yes | one of 'update', 'remove', 'insert' | |
timestamp | date string | yes | iso date string | |
user | integer | yes | ||
index | integer | if operation is 'remove' or 'insert' | ||
before | PropertiesPatch | if operation is 'update' and index is not set | provides the patch to be performed to the deck properties to undo the change | |
after | PropertiesPatch | if operation is 'update' and index is not set | provides the patch to be performed to the deck properties to apply the change | |
insert | ContentItem | if operation is 'insert' | provides the deck/slide reference of the item inserted | |
remove | ContentItem | if operation is 'remove' | provides the deck/slide reference of the item removed | |
update | ContentItemUpdate | if operation is 'update' and index is set | provides the undo/redo patches for the update to the contentItem |
The following object includes a subset of deck properties definitions, which includes all the deck properties that are user-defined and editable. Any of the properties are optional in this model but at least one should be defined.
PropertiesPatch=
property | type | required | format | description |
---|---|---|---|---|
title | no | same definition as "title" on the deck revision model | ||
language | no | same definition as "language" on the deck revision model | ||
theme | no | same definition as "theme" on the deck revision model | ||
license | no | same definition as "license" on the deck model | ||
description | no | same definition as "description" on the deck model |
ContentItemUpdate=
property | type | required | description |
---|---|---|---|
before | ContentItemPatch | yes | provides the patch to undo the content item change in parent deck change object |
after | ContentItemPatch | yes | provides the patch to apply the content item change in parent deck change object |
ContentItemPatch=
property | type | required | format | description |
---|---|---|---|---|
kind | same definition as "kind" on the ContentItem model | |||
ref | same definition as "ref" on the ContentItem model, but only "revision" can be set (no "id") |