Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- exports.fillApps= function(req, res){
- async.each(MockApps, function( app, callback) {
- App.findOne({name: app.name}, function (err, app) {
- if (err) {
- return callback(err);
- logger.error('error funding app', err);
- }
- //logger.debug(app);
- if (app) {
- app.stripeID = app.stripeID || null;
- app.imageUrl = app.imageUrl || null;
- app.monthlyPrice = app.monthlyPrice || null;
- app.status = app.status || null;
- app.category = app.category || null;
- app.learnMore = app.learnMore || null;
- app.visibleBy = app.visibleBy || null;
- app.descriptions = app.descriptions || null;
- app.tag = app.tag || null;
- app.features =app.features || null;
- app.save(function (err, app) {
- if (err) logger.error('error chargin app', err);
- logger.debug('fill with ' + app.name);
- callback();
- });
- } else {
- var newApp = new App(app);
- //logger.debug(tmpIndex);
- newApp.save(function (err, app) {
- if (err) logger.error('error chargin app', err);
- callback();
- });
- }
- });
- }, function(err){
- if( err ) {
- res.send(...)
- } else {
- res.send(...)
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement