Deck change log
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. See also - SWIK-946Getting issue details... STATUS .
The change log is considered to be a list of change log records that include a timestamp and the id of the user performing the deck change. They include the full path of the deck tree were the edit was performed, and are stored in a separate collection, deckchanges
in mongodb. Each record may be returned via the deck service changes API as part of the change log for any of the decks that are part of the deck tree.
In this document we describe how all the relevant change log records are stored in the mongodb. The API that handles querying the underlying data in order to provide the change log for a deck tree is the object of - SWIK-945Getting issue details... STATUS .
Model
Each deckchange record includes a representation for the path of the deck tree were the change was performed. For constructing this path, we use references to decks and indexes for positioning the deck in its parent deck. We also keep the title as optional data in those references, to be used primarily in the UI.
ChangePathPart=
property | type | required | description |
---|---|---|---|
id | integer | yes if no index | the id of the deck can be omitted only for the last part of the path for specific change types |
revision | integer | yes if id present | the revision of the deck |
title | string | no | the title of the deck revision at the time the change took place |
index | integer | yes if no id | the (zero-based) index of the deck in the content items array of its parent can be omitted only for the first part of the path (the path root) |
To reference nodes in the deck tree we use a simple construct to denote the type of node and its id and revision:
NodeRefValue=
property | type | required | description |
---|---|---|---|
id | integer | yes | the id of the deck or slide |
revision | integer | yes | the revision of the deck or slide |
title | string | no | the tile of the deck or slide at the time the change took place |
NodeValue=
property | type | required | description |
---|---|---|---|
kind | string | yes | either deck or slide |
ref | NodeRefValue | yes | the reference to the deck or slide |
In order to describe the specific changes to the deck metadata we maintain a set of specific keys and value types:
UpdateValues=
property | type | required | format | description |
---|---|---|---|---|
title | string | no | same definition as "title" on the deck revision model | |
language | string | no | same definition as "language" on the deck revision model | |
theme | string | no | same definition as "theme" on the deck revision model | |
license | string | no | same definition as "license" on the deck model | |
description | string | no | same definition as "description" on the deck model | |
tags | array | no | same definition as "tags" on the deck revision model |
DeckChange=
property | type | required | description |
---|---|---|---|
op | string | yes | one of 'add', 'remove', 'replace', 'move', or 'update' |
timestamp | date string | yes | iso date string |
user | integer | yes | |
path | array of ChangePathPart | yes | can be empty for the root deck 'update' change |
from | array of ChangePathPart | if operation is 'move' | provides the previous path of the node moved in the tree |
value | NodeValue | yes if op is 'add', 'remove', 'replace' or 'move' | provides the node value referenced by the change |
oldValue | NodeValue | yes if op is 'replace' | provides the node value replaced when creating a revision for a deck child |
values | UpdateValues | yes if op is 'update' | provides the new values for the deck data updated |
oldValues | UpdateValues | yes if op is 'update' | provides the old values for the deck data updated |