lib/impl/deleteTheme.js
function validateThemeNotInUseByApps(cb) {
    var appThemeModel = models.get(connections.mongooseConnection, models.MODELNAMES.APP_THEMES);

    appThemeModel.count({"theme" : options._id}, function(err, countAppsUsingTheme) {
      if (err) {
        return cb(err);
      }

      if (countAppsUsingTheme > 0) {
        return cb(new Error("Cannot delete theme in use by apps. Apps Using this theme" + countAppsUsingTheme));
      }

      return cb();
    });
  }
function validateThemeNotInUseByApps(cb) {
    var appThemeModel = models.get(connections.mongooseConnection, models.MODELNAMES.APP_THEMES);

    appThemeModel.count({"theme" : options._id}, function(err, countAppsUsingTheme) {
      if (err) {
        return cb(err);
      }

      if (countAppsUsingTheme > 0) {
        return cb(new Error("Cannot delete theme in use by apps. Apps Using this theme" + countAppsUsingTheme));
      }

      return cb();
    });
  }
function validateThemeNotInUseByApps ( cb ) { var appThemeModel = models . get ( connections . mongooseConnection , models . MODELNAMES . APP_THEMES ) ; appThemeModel . count ( { "theme" : options . _id } , function ( err , countAppsUsingTheme ) { if ( err ) { return cb ( err ) ; } if ( countAppsUsingTheme > 0 ) { return cb ( new Error ( "Cannot delete theme in use by apps. Apps Using this theme" + countAppsUsingTheme ) ) ; } return cb ( ) ; } ) ; }
Themes associated with app should not be deleted.
Themes associated with app should not be deleted .