ContentModule

content. ContentModule

Module which handles course content

Constructor

new ContentModule()

Source:

Extends

  • AbstractApiModule

Methods

(async) clone(userId, _id, _parentId, customData) → {Promise}

Description:
  • Recursively clones a content item
Source:
Parameters:
Name Type Description
userId String The user performing the action
_id String ID of the object to clone
_parentId String The intended parent object (if this is not passed, no parent will be set)
customData Object Data to be applied to the content item
Returns:
Type
Promise

(async) delete()

Source:

(async) getDescendants(rootItem) → {Array.<Object>}

Description:
  • Finds all descendant content items for a given root
Source:
Parameters:
Name Type Description
rootItem Object The root item document
Returns:
Array of content items
Type
Array.<Object>

(async) getSchema()

Source:

(async) getSchemaName()

Source:

(async) handleClone(req, res, next) → {Promise}

Description:
  • Request handler for cloning content items
Source:
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
next function
Returns:
Resolves with the cloned data
Type
Promise

(async) handleInsertRecursive(req, res, next)

Description:
  • Special request handler for bootstrapping a new content object with dummy content
Source:
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
next function

(async) init()

Source:

(async) insert()

Source:

(async) insertRecursive(req)

Description:
  • Creates a new parent content type, along with any necessary children
Source:
Parameters:
Name Type Description
req external:ExpressRequest

(async) setValues()

Source:

(async) update()

Source:

(async) updateEnabledPlugins(item, options) → {Promise}

Description:
  • Maintains the list of plugins used in the current course
Source:
Parameters:
Name Type Description
item Object The updated item
options Object
Properties
Name Type Description
forceUpdate Boolean Forces an update of defaults regardless of whether the _enabledPlugins list has changed
Returns:
Type
Promise

(async) updateSortOrder(item, updateData) → {Promise}

Description:
  • Recalculates the _sortOrder values for all content items affected by an update
Source:
Parameters:
Name Type Description
item Object The existing item data
updateData Object The update data
Returns:
Type
Promise