Skip to content

history.js

kod11 edited this page May 24, 2016 · 1 revision

The history.js file is used for everything regarding the history for a specific artwork.

The eventType variable can have the values {0,1,2,3} where each number represents the new event for a specific artwork.
0 - corrected
1 - reported
2 - added
3 - changed

getHistory(id, callback)
Used to retrieve the history of reports for an artwork.
@parameter id - id of the artwork.
@parameter callback - a function that will be called when the request has been performed.
@return - the provided callback will be called, history is associated to the callback as an array of events in JSON.

addEvent(artwork, eventType, callback)
Adds a new history entry for an artwork if something is changed.
@parameter artwork - the artwork that had something changed. @parameter eventType - the eventype specifying what has changed. @parameter callback - function that will be called when it is done.

setReported(artwork, callback)
Adds an event to the database stating the artwork as having wrong location information.
@parameter artwork - the specific artwork.
@parameter callback - a function that will be called when the request has been performed.

setCorrected(artwork, callback)
Adds an event to the database saying that an artwork has been corrected.
@parameter artwork - the artwork in question.
@parameter callback - function that will be called when the information has been added.

setAdded(artwork, callback)
Adds an event to the database saying that an artwork has been added.
@parameter artwork - the artwork in question.
@parameter callback - function that will be called when the information has been added.

setChanged(artwork, callback)
Adds an event to the database saying that an artwork has been changed.
@parameter artwork - the artwork in question.
@parameter callback - function that will be called when the artwork has been changed.

Clone this wiki locally