lib/middleware/formProjects.js
function getTheme(req, res, next) {
  var params = {
    appId: req.params.projectid || req.params.id
  };
  forms.getAppTheme(_.extend(req.connectionOptions, params), function(err, theme) {
    if (err) {
      return next(err);
    }

    req.appformsResultPayload = req.appformsResultPayload || {};

    if (_.isObject(req.appformsResultPayload.data) && theme && !req.getFullTheme) {
      req.appformsResultPayload.data.theme = theme._id;
    } else {
      //Want the full theme definition
      req.appformsResultPayload = {
        data: theme
      };
    }

    next();
  });
}
function getTheme(req, res, next) {
  var params = {
    appId: req.params.projectid || req.params.id
  };
  forms.getAppTheme(_.extend(req.connectionOptions, params), function(err, theme) {
    if (err) {
      return next(err);
    }

    req.appformsResultPayload = req.appformsResultPayload || {};

    if (_.isObject(req.appformsResultPayload.data) && theme && !req.getFullTheme) {
      req.appformsResultPayload.data.theme = theme._id;
    } else {
      //Want the full theme definition
      req.appformsResultPayload = {
        data: theme
      };
    }

    next();
  });
}
function getTheme ( req , res , next ) { var params = { appId : req . params . projectid || req . params . id } ; forms . getAppTheme ( _ . extend ( req . connectionOptions , params ) , function ( err , theme ) { if ( err ) { return next ( err ) ; } req . appformsResultPayload = req . appformsResultPayload || { } ; if ( _ . isObject ( req . appformsResultPayload . data ) && theme && ! req . getFullTheme ) { req . appformsResultPayload . data . theme = theme . _id ; } else { //Want the full theme definition req . appformsResultPayload = { data : theme } ; } next ( ) ; } ) ; }
Middleware To Get A Theme Assocaited With A Project
@param req
@param res
@param next
Middleware To Get A Theme Assocaited With A Project