Merge pull request #157 from strongloop/fix-eslint
Fix eslint violations
This commit is contained in:
commit
12de266e5b
|
@ -138,7 +138,7 @@ Connector.prototype.getPropertyDefinition = function(modelName, propName) {
|
||||||
const model = this.getModelDefinition(modelName);
|
const model = this.getModelDefinition(modelName);
|
||||||
return Connector.getNestedPropertyDefinition(
|
return Connector.getNestedPropertyDefinition(
|
||||||
model.model.definition,
|
model.model.definition,
|
||||||
propName.split('.')
|
propName.split('.'),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ Connector.getNestedPropertyDefinition = function(definition, propPath) {
|
||||||
} else {
|
} else {
|
||||||
return Connector.getNestedPropertyDefinition(
|
return Connector.getNestedPropertyDefinition(
|
||||||
nextDefinition,
|
nextDefinition,
|
||||||
propPath.slice(1)
|
propPath.slice(1),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -66,7 +66,7 @@ exports.parse = function(composed, cb) {
|
||||||
debug('Invalid key - missing model-name prefix: %s', composed);
|
debug('Invalid key - missing model-name prefix: %s', composed);
|
||||||
const err = new Error(g.f(
|
const err = new Error(g.f(
|
||||||
'Invalid key %j - missing model-name prefix',
|
'Invalid key %j - missing model-name prefix',
|
||||||
composed
|
composed,
|
||||||
));
|
));
|
||||||
err.code = 'NO_MODEL_PREFIX';
|
err.code = 'NO_MODEL_PREFIX';
|
||||||
setImmediate(function() {
|
setImmediate(function() {
|
||||||
|
|
|
@ -729,7 +729,7 @@ SQLConnector.prototype.exists = function(model, id, options, cb) {
|
||||||
where[idName] = id;
|
where[idName] = id;
|
||||||
let selectStmt = new ParameterizedSQL(
|
let selectStmt = new ParameterizedSQL(
|
||||||
'SELECT 1 FROM ' + this.tableEscaped(model) +
|
'SELECT 1 FROM ' + this.tableEscaped(model) +
|
||||||
' WHERE ' + this.idColumnEscaped(model)
|
' WHERE ' + this.idColumnEscaped(model),
|
||||||
);
|
);
|
||||||
selectStmt.merge(this.buildWhere(model, where));
|
selectStmt.merge(this.buildWhere(model, where));
|
||||||
selectStmt = this.applyPagination(model, selectStmt, {
|
selectStmt = this.applyPagination(model, selectStmt, {
|
||||||
|
@ -834,7 +834,7 @@ SQLConnector.prototype.updateAttributes = function(model, id, data, options, cb)
|
||||||
|
|
||||||
function errorIdNotFoundForUpdate(idValue) {
|
function errorIdNotFoundForUpdate(idValue) {
|
||||||
const msg = g.f(
|
const 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,
|
||||||
);
|
);
|
||||||
const error = new Error(msg);
|
const error = new Error(msg);
|
||||||
error.statusCode = error.status = 404;
|
error.statusCode = error.status = 404;
|
||||||
|
@ -1408,7 +1408,7 @@ SQLConnector.prototype.buildSelect = function(model, filter, options) {
|
||||||
|
|
||||||
if (filter.limit || filter.skip || filter.offset) {
|
if (filter.limit || filter.skip || filter.offset) {
|
||||||
selectStmt = this.applyPagination(
|
selectStmt = this.applyPagination(
|
||||||
model, selectStmt, filter
|
model, selectStmt, filter,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1467,7 +1467,7 @@ SQLConnector.prototype.all = function find(model, filter, options, cb) {
|
||||||
});
|
});
|
||||||
if (filter && filter.include) {
|
if (filter && filter.include) {
|
||||||
self.getModelDefinition(model).model.include(
|
self.getModelDefinition(model).model.include(
|
||||||
objs, filter.include, options, cb
|
objs, filter.include, options, cb,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
cb(null, objs);
|
cb(null, objs);
|
||||||
|
|
|
@ -47,14 +47,14 @@ describe('Connector', () => {
|
||||||
it('supports retrieving first level properties definitions', () => {
|
it('supports retrieving first level properties definitions', () => {
|
||||||
const propDefinition1 = connector.getPropertyDefinition(
|
const propDefinition1 = connector.getPropertyDefinition(
|
||||||
'MyModel',
|
'MyModel',
|
||||||
'phoneList'
|
'phoneList',
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(propDefinition1.type).to.be.an('array');
|
expect(propDefinition1.type).to.be.an('array');
|
||||||
|
|
||||||
const propDefinition2 = connector.getPropertyDefinition(
|
const propDefinition2 = connector.getPropertyDefinition(
|
||||||
'MyModel',
|
'MyModel',
|
||||||
'firstname'
|
'firstname',
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(propDefinition2.type).to.be.equal(String);
|
expect(propDefinition2.type).to.be.equal(String);
|
||||||
|
@ -63,7 +63,7 @@ describe('Connector', () => {
|
||||||
it('supports first level nested array property definitions', () => {
|
it('supports first level nested array property definitions', () => {
|
||||||
const propDefinition = connector.getPropertyDefinition(
|
const propDefinition = connector.getPropertyDefinition(
|
||||||
'MyModel',
|
'MyModel',
|
||||||
'phoneList.number'
|
'phoneList.number',
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(propDefinition.type).to.equal(Number);
|
expect(propDefinition.type).to.equal(Number);
|
||||||
|
@ -72,7 +72,7 @@ describe('Connector', () => {
|
||||||
it('supports second level nested array property definitions', () => {
|
it('supports second level nested array property definitions', () => {
|
||||||
const propDefinition = connector.getPropertyDefinition(
|
const propDefinition = connector.getPropertyDefinition(
|
||||||
'MyModel',
|
'MyModel',
|
||||||
'phoneList.label.title'
|
'phoneList.label.title',
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(propDefinition.type).to.equal(String);
|
expect(propDefinition.type).to.equal(String);
|
||||||
|
@ -81,7 +81,7 @@ describe('Connector', () => {
|
||||||
it('supports nested property definitions on objects', () => {
|
it('supports nested property definitions on objects', () => {
|
||||||
const propDefinition = connector.getPropertyDefinition(
|
const propDefinition = connector.getPropertyDefinition(
|
||||||
'MyModel',
|
'MyModel',
|
||||||
'address.line1'
|
'address.line1',
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(propDefinition.type).to.equal(String);
|
expect(propDefinition.type).to.equal(String);
|
||||||
|
@ -90,7 +90,7 @@ describe('Connector', () => {
|
||||||
it('supports nested property definitions on array within object', () => {
|
it('supports nested property definitions on array within object', () => {
|
||||||
const propDefinition = connector.getPropertyDefinition(
|
const propDefinition = connector.getPropertyDefinition(
|
||||||
'MyModel',
|
'MyModel',
|
||||||
'someProp.innerArray.date'
|
'someProp.innerArray.date',
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(propDefinition.type).to.equal(Date);
|
expect(propDefinition.type).to.equal(Date);
|
||||||
|
|
|
@ -66,7 +66,7 @@ describe('ModelKeyComposer', function() {
|
||||||
},
|
},
|
||||||
function onError(err) {
|
function onError(err) {
|
||||||
expect(err).to.have.property('code', 'NO_MODEL_PREFIX');
|
expect(err).to.have.property('code', 'NO_MODEL_PREFIX');
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -275,10 +275,10 @@ describe('sql connector', function() {
|
||||||
{name: 'John', vip: true, unknown: 'Random'});
|
{name: 'John', vip: true, unknown: 'Random'});
|
||||||
expect(fields.names).to.eql(['`NAME`', '`VIP`']);
|
expect(fields.names).to.eql(['`NAME`', '`VIP`']);
|
||||||
expect(fields.columnValues[0].toJSON()).to.eql(
|
expect(fields.columnValues[0].toJSON()).to.eql(
|
||||||
{sql: '?', params: ['John']}
|
{sql: '?', params: ['John']},
|
||||||
);
|
);
|
||||||
expect(fields.columnValues[1].toJSON()).to.eql(
|
expect(fields.columnValues[1].toJSON()).to.eql(
|
||||||
{sql: '?', params: [true]}
|
{sql: '?', params: [true]},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@ describe('sql connector', function() {
|
||||||
const where = {sql: 'WHERE `NAME`=?', params: ['John']};
|
const where = {sql: 'WHERE `NAME`=?', params: ['John']};
|
||||||
stmt1 = ParameterizedSQL.append(stmt1, where);
|
stmt1 = ParameterizedSQL.append(stmt1, where);
|
||||||
expect(stmt1.toJSON()).to.eql(
|
expect(stmt1.toJSON()).to.eql(
|
||||||
{sql: 'SELECT * from `CUSTOMER` WHERE `NAME`=?', params: ['John']}
|
{sql: 'SELECT * from `CUSTOMER` WHERE `NAME`=?', params: ['John']},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -403,7 +403,7 @@ describe('sql connector', function() {
|
||||||
const where = {sql: 'WHERE `NAME`=?', params: ['John']};
|
const where = {sql: 'WHERE `NAME`=?', params: ['John']};
|
||||||
stmt1 = ParameterizedSQL.append(stmt1, where);
|
stmt1 = ParameterizedSQL.append(stmt1, where);
|
||||||
expect(stmt1.toJSON()).to.eql(
|
expect(stmt1.toJSON()).to.eql(
|
||||||
{sql: 'SELECT * from `CUSTOMER` WHERE `NAME`=?', params: ['John']}
|
{sql: 'SELECT * from `CUSTOMER` WHERE `NAME`=?', params: ['John']},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue