Skip to content

Instantly share code, notes, and snippets.

@qcom
Last active August 29, 2015 14:01

Revisions

  1. qcom revised this gist May 29, 2014. 1 changed file with 11 additions and 13 deletions.
    24 changes: 11 additions & 13 deletions app.js
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,11 @@
    .post(function(req, res) {
    function cb() {
    app.get('db')[config.dbProperty].add(req.body, options.getAddObj(req.body)).then(function(id) {
    res.redirect('/' + config.routeName + '/' + id);
    });
    }
    if (~['job','service'].indexOf(config.itemName)) {
    return util.updateCompany(req.body, req.session.user, app).then(function() {
    cb();
    });
    }
    cb();
    });
    function cb() {
    app.get('db')[config.dbProperty].add(req.body, options.getAddObj(req.body)).then(function(id) {
    res.redirect('/' + config.routeName + '/' + id);
    });
    }
    if (itemHasCompany(config.itemName)) {
    return util.updateCompany(req.body, req.session.user, app).then(function() {
    cb();
    });
    }
    cb();
  2. qcom created this gist May 29, 2014.
    13 changes: 13 additions & 0 deletions app.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    .post(function(req, res) {
    function cb() {
    app.get('db')[config.dbProperty].add(req.body, options.getAddObj(req.body)).then(function(id) {
    res.redirect('/' + config.routeName + '/' + id);
    });
    }
    if (~['job','service'].indexOf(config.itemName)) {
    return util.updateCompany(req.body, req.session.user, app).then(function() {
    cb();
    });
    }
    cb();
    });