Constructor
new VisualizationDatabase()
- Source:
- Implements:
- DatabaseInterface
Methods
(async, static) checkPermissions(id, permission_names, user) → {Promise.<void>}
- Source:
Override the default permission checking on the visualization object and defer to the network instead
Parameters:
Name | Type | Description |
---|---|---|
id |
string | the database id of the object to check permissions for |
permission_names |
Array.<string> | An array of permission names to look for |
user |
Object | the user to check permissions for |
Returns:
- Type
- Promise.<void>
(async, static) create(visualizationData, device_id, user)
- Source:
Creates a visualization data object in the database.
Parameters:
Name | Type | Description |
---|---|---|
visualizationData |
Object | The visualization object. |
device_id |
string | The device id the visualization belongs to. |
user |
Object | The user creating the visualization. |
(async, static) del(visualization_id, user)
- Source:
Deletes a visualization object.
Parameters:
Name | Type | Description |
---|---|---|
visualization_id |
The id of the object. | |
user |
The user requesting deletion. |
(async, static) get(visualization_id) → {Object}
- Source:
Retrieves a visualization by id.
Parameters:
Name | Type | Description |
---|---|---|
visualization_id |
string |
Returns:
- Type
- Object
(async, static) getByDevice(device_id, user) → {Array}
- Source:
Retrieves all visualizations associated with a device.
Parameters:
Name | Type | Description |
---|---|---|
device_id |
string | The id of the device. |
user |
Object | The user requesting the visualizations. |
Throws:
If the user doesn't own the device
Returns:
An array of visualization objects.
- Type
- Array
(async, static) getCollection() → {Object}
- Source:
Helper function to get the collection of visualizations.
Returns:
The MongoDB collection object for visualizations.
- Type
- Object
(async, static) owns(visualization_id, user) → {boolean}
- Source:
Determines if user owns the visualization data with the specified visualization_id.
Parameters:
Name | Type | Description |
---|---|---|
visualization_id |
string | The id of the visualization to check for ownership. |
user |
Object | The user to check for ownership. |
Returns:
True if the user does own the visualization, false otherwise.
- Type
- boolean
(async, static) update(visualization_id, update, user) → {boolean}
- Source:
Updates an existing visualization object.
Parameters:
Name | Type | Description |
---|---|---|
visualization_id |
string | The id of the |
update |
Object | The update to apply (written with the mongodb syntax) |
user |
Object | The user asking for the update. |
Returns:
- Type
- boolean