Fetching contributors…
Cannot retrieve contributors at this time
39 lines (29 sloc) 1.05 KB

0.2.0

  • features
    • [1] created module that returns an object containing all of the available validation rules available for content.
      • required
      • alpha (val, {min, max})
      • alpha_numeric (val, {min, max})
      • number (val, {min, max)
      • email (val)
      • url (val)
      • datetime (val)
      • date (val)
      • time (val)
      • regex (val, {pattern}
      • unique (val, {contentTypes: []})
    • [2] created a validation middleware that can be used when saving content via the 'runner'

usage [1]:

var contentValidators = require('./contentValidators'),
    validator = contentValidators.get(rule),
    isValid = validator(str, options);

implementation [2]:

coordinator.batch(
        middleware.content,
        ['insert', 'update'],[
            middleware.identity,
            middleware.nodes.setNodeIdFromArgument,
            middleware.nodes.requireNodePermissions(security.roles.AUTHOR),
            middleware.content.validate
        ]
    );