lib/impl/deleteAppRefrences.js
function deleteAppForms(cb) {
        var appId = params.appId;

        async.series([
          function(cb) { // first remove the form itself
            var appFormsModel = models.get(connections.mongooseConnection, models.MODELNAMES.APP_FORMS);
            appFormsModel.find({appId: appId}).remove().exec(cb);
          },
          function(cb) { // remove deleted from from any groups
            groups.removeAppFromAllGroups(connections, appId, cb);
          },
          function deleteThemeRefrences(cb) {
            var appThemeModel  = models.get(connections.mongooseConnection, models.MODELNAMES.APP_THEMES);
            appThemeModel.find({"appId":appId}).remove().exec(cb);
          },
          function deleteAppConfigReferences(cb) {
            var appConfigModel = models.get(connections.mongooseConnection, models.MODELNAMES.APP_CONFIG);
            appConfigModel.find({"appId":appId}).remove().exec(cb);
          }
        ], function(err) {
          if (err) {
            return cb(err);
          }
          return cb(null);
        });
      }
function deleteAppForms(cb) {
        var appId = params.appId;

        async.series([
          function(cb) { // first remove the form itself
            var appFormsModel = models.get(connections.mongooseConnection, models.MODELNAMES.APP_FORMS);
            appFormsModel.find({appId: appId}).remove().exec(cb);
          },
          function(cb) { // remove deleted from from any groups
            groups.removeAppFromAllGroups(connections, appId, cb);
          },
          function deleteThemeRefrences(cb) {
            var appThemeModel  = models.get(connections.mongooseConnection, models.MODELNAMES.APP_THEMES);
            appThemeModel.find({"appId":appId}).remove().exec(cb);
          },
          function deleteAppConfigReferences(cb) {
            var appConfigModel = models.get(connections.mongooseConnection, models.MODELNAMES.APP_CONFIG);
            appConfigModel.find({"appId":appId}).remove().exec(cb);
          }
        ], function(err) {
          if (err) {
            return cb(err);
          }
          return cb(null);
        });
      }
function deleteAppForms ( cb ) { var appId = params . appId ; async . series ( [ function ( cb ) { // first remove the form itself var appFormsModel = models . get ( connections . mongooseConnection , models . MODELNAMES . APP_FORMS ) ; appFormsModel . find ( { appId : appId } ) . remove ( ) . exec ( cb ) ; } , function ( cb ) { // remove deleted from from any groups groups . removeAppFromAllGroups ( connections , appId , cb ) ; } , function deleteThemeRefrences ( cb ) { var appThemeModel = models . get ( connections . mongooseConnection , models . MODELNAMES . APP_THEMES ) ; appThemeModel . find ( { "appId" : appId } ) . remove ( ) . exec ( cb ) ; } , function deleteAppConfigReferences ( cb ) { var appConfigModel = models . get ( connections . mongooseConnection , models . MODELNAMES . APP_CONFIG ) ; appConfigModel . find ( { "appId" : appId } ) . remove ( ) . exec ( cb ) ; } ] , function ( err ) { if ( err ) { return cb ( err ) ; } return cb ( null ) ; } ) ; }
updates to AppForms sub collection
updates to AppForms sub collection