diff --git a/lib/sql.js b/lib/sql.js index 20790ed..46e71c3 100644 --- a/lib/sql.js +++ b/lib/sql.js @@ -167,7 +167,7 @@ SQLConnector.prototype.addPropertyToActual = function(model, propName) { var sqlCommand = self.columnEscaped(model, propName) + ' ' + self.columnDataType(model, propName) + (self.isNullable(self.getPropertyDefinition(model, propName)) ? - '' : ' NOT NULL'); + '' : ' NOT NULL'); return sqlCommand; }; @@ -631,17 +631,17 @@ SQLConnector.prototype.execute = function(sql, params, options, callback) { }; this.notifyObserversAround('execute', context, function(context, done) { self.executeSQL(context.req.sql, context.req.params, context.options, - function(err, info) { - if (err) { - debug('Error: %j %j %j', err, context.req.sql, context.req.params); - } + function(err, info) { + if (err) { + debug('Error: %j %j %j', err, context.req.sql, context.req.params); + } - if (!err && info != null) { - context.res = info; - } - // Don't pass more than one args as it will confuse async.waterfall - done(err, info); - }); + if (!err && info != null) { + context.res = info; + } + // Don't pass more than one args as it will confuse async.waterfall + done(err, info); + }); }, callback); }; @@ -816,7 +816,7 @@ SQLConnector.prototype.updateAttributes = function(model, id, data, options, cb) function errorIdNotFoundForUpdate(idValue) { var msg = g.f( - 'Could not update attributes. {{Object}} with {{id}} %s does not exist!', idValue); + 'Could not update attributes. {{Object}} with {{id}} %s does not exist!', idValue); var error = new Error(msg); error.statusCode = error.status = 404; return error; @@ -1784,8 +1784,8 @@ SQLConnector.prototype.discoverDatabaseSchemas = function(options, cb) { * @param options {all: for all owners, owner: for a given owner} * @returns {string} The sql statement */ - // Due to the different implementation structure of information_schema across - // connectors, each connector will have to generate its own query +// Due to the different implementation structure of information_schema across +// connectors, each connector will have to generate its own query SQLConnector.prototype.buildQueryTables = function(options) { throw new Error(g.f('{{buildQueryTables}} must be implemented by the connector')); }; @@ -1795,8 +1795,8 @@ SQLConnector.prototype.buildQueryTables = function(options) { * @param options {all: for all owners, owner: for a given owner} * @returns {string} The sql statement */ - // Due to the different implementation structure of information_schema across - // connectors, each connector will have to generate its own query +// Due to the different implementation structure of information_schema across +// connectors, each connector will have to generate its own query SQLConnector.prototype.buildQueryViews = function(options) { throw new Error(g.f('{{buildQueryViews}} must be implemented by the connector')); }; @@ -1946,8 +1946,8 @@ SQLConnector.prototype.discoverPrimaryKeys = function(table, options, cb) { * @param table * @returns {string} */ - // Due to the different implementation structure of information_schema across - // connectors, each connector will have to generate its own query +// Due to the different implementation structure of information_schema across +// connectors, each connector will have to generate its own query SQLConnector.prototype.buildQueryForeignKeys = function(schema, table) { throw new Error(g.f('{{buildQueryForeignKeys}} must be implemented by the connector')); }; @@ -1982,8 +1982,8 @@ SQLConnector.prototype.discoverForeignKeys = function(table, options, cb) { * @param table * @returns {string} */ - // Due to the different implementation structure of information_schema across - // connectors, each connector will have to generate its own query +// Due to the different implementation structure of information_schema across +// connectors, each connector will have to generate its own query SQLConnector.prototype.buildQueryExportedForeignKeys = function(schema, table) { throw new Error(g.f('{{buildQueryExportedForeignKeys}} must be implemented by' + 'the connector')); diff --git a/package.json b/package.json index 9f8d475..18d4e98 100644 --- a/package.json +++ b/package.json @@ -31,8 +31,8 @@ }, "devDependencies": { "chai": "~3.5.0", - "eslint": "^3.17.1", - "eslint-config-loopback": "^8.0.0", + "eslint": "^4.19.1", + "eslint-config-loopback": "^10.0.0", "loopback-datasource-juggler": "^3.12.0", "mocha": "^3.2.0" } diff --git a/test/transaction.test.js b/test/transaction.test.js index 3e254dc..4fdc069 100644 --- a/test/transaction.test.js +++ b/test/transaction.test.js @@ -41,42 +41,42 @@ describe('transactions', function() { isolationLevel: Transaction.READ_COMMITTED, timeout: timeout, }, - function(err, tx) { - if (err) return done(err); - expect(typeof tx.id).to.eql('string'); - hooks = []; - tx.observe('before commit', function(context, next) { - hooks.push('before commit'); - next(); - }); - tx.observe('after commit', function(context, next) { - hooks.push('after commit'); - next(); - }); - tx.observe('before rollback', function(context, next) { - hooks.push('before rollback'); - next(); - }); - tx.observe('after rollback', function(context, next) { - hooks.push('after rollback'); - next(); - }); - currentTx = tx; - Post.create(post, {transaction: tx, model: 'Post'}, - function(err, p) { - if (err) { - done(err); - } else { - p.reviews.create({ - author: 'John', - content: 'Review for ' + p.title, - }, {transaction: tx, model: 'Review'}, - function(err, c) { - done(err); - }); - } - }); + function(err, tx) { + if (err) return done(err); + expect(typeof tx.id).to.eql('string'); + hooks = []; + tx.observe('before commit', function(context, next) { + hooks.push('before commit'); + next(); }); + tx.observe('after commit', function(context, next) { + hooks.push('after commit'); + next(); + }); + tx.observe('before rollback', function(context, next) { + hooks.push('before rollback'); + next(); + }); + tx.observe('after rollback', function(context, next) { + hooks.push('after rollback'); + next(); + }); + currentTx = tx; + Post.create(post, {transaction: tx, model: 'Post'}, + function(err, p) { + if (err) { + done(err); + } else { + p.reviews.create({ + author: 'John', + content: 'Review for ' + p.title, + }, {transaction: tx, model: 'Review'}, + function(err, c) { + done(err); + }); + } + }); + }); }; }