downstairs
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -6,3 +6,3 @@ { | ||
"port": "5432", | ||
"user": "damien", | ||
"user": "nicholas", | ||
"password": null, | ||
@@ -16,16 +16,7 @@ "name": "downstairs_development" | ||
"port": "5432", | ||
"user": "damien", | ||
"user": "nicholas", | ||
"password": null, | ||
"name": "downstairs_test" | ||
} | ||
}, | ||
"production": { | ||
"database": { | ||
"host": "localhost", | ||
"port": "5432", | ||
"user": "damien", | ||
"password": null, | ||
"name": "downstairs_production" | ||
} | ||
} | ||
} |
@@ -49,2 +49,3 @@ var Table = {} | ||
} | ||
return sqlBaseQuery; | ||
@@ -80,2 +81,17 @@ } | ||
if (conditions && conditions.queryParameters){ | ||
if (conditions.queryParameters.limit){ | ||
sqlStr.text = sqlStr.text + " LIMIT " + conditions.queryParameters['limit']; | ||
} | ||
// if (conditions.queryParameters.offset){ | ||
// sqlStr.text = sqlStr.text + " OFFSET " + conditions.queryParameters['offset']; | ||
// } | ||
// if (conditions.queryParameters.orderBy){ | ||
// sqlStr.text = sqlStr.text + " ORDER BY " + conditions.queryParameters['orderBy']; | ||
// } | ||
} | ||
var _self = this; | ||
@@ -82,0 +98,0 @@ var _cb = cb; |
{ | ||
"name": "downstairs", | ||
"description": "A light ORM wrapped about brianc's node-sql and node-pg", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"homepage": "https://github.com/moneytribeaustralia/downstairs.js", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -14,3 +14,3 @@ var pg = require('pg') | ||
var blueprint = | ||
var userBlueprint = | ||
{User: { | ||
@@ -24,3 +24,3 @@ email: function(){ return faker2.Internet.email()} | ||
ctx.add(blueprint); | ||
ctx.add(userBlueprint); | ||
@@ -64,9 +64,11 @@ exports.ectypes = ctx; | ||
exports.repeatableSQL = "CREATE TABLE repeatables\ | ||
(\ | ||
id serial NOT NULL,\ | ||
name character varying(100)\ | ||
);" | ||
var defaultConnection = new Connection.PostgreSQL(env.connectionString); | ||
exports.defaultConnection = defaultConnection; | ||
// exports.resetConnection = function(){ | ||
// Downstairs.connections = {}; | ||
// Downstairs.add(defaultConnection); | ||
// } | ||
@@ -256,3 +256,55 @@ var Downstairs = require('../lib/downstairs') | ||
}); | ||
}); | ||
var repeatableSchema = sql.Table.define({ | ||
name: 'repeatables' | ||
, quote: true | ||
, schema: 'public' | ||
, columns: ['id' | ||
, 'name'] | ||
}); | ||
var Repeatable = Table.model('Repeatable', repeatableSchema); | ||
describe('node-sql augmentations', function(done){ | ||
beforeEach(function(done){ | ||
helper.resetDb(helper.repeatableSQL, done); | ||
}) | ||
var firstRepeatable, secondRepeatable, thirdRepeatable; | ||
beforeEach(function(done){ | ||
Repeatable.create({name: 'blue'}, function(err, repeatable){ | ||
firstRepeatable = repeatable; | ||
Repeatable.create({name: 'blue'}, function(err, repeatable){ | ||
secondRepeatable = repeatable; | ||
Repeatable.create({name: 'blue'}, function(err, repeatable){ | ||
thirdRepeatable = repeatable; | ||
// Repeatable.findAll({}, function(err, repeatables){ | ||
// console.log(repeatables.length, " <<<<<"); | ||
// }) | ||
done(); | ||
}) | ||
}) | ||
}) | ||
}) | ||
it('parses limit in queryParameters of conditions', function(done) { | ||
var data = {queryParameters: { limit: 2 } }; | ||
Repeatable.findAll(data, function(err, repeatables){ | ||
repeatables.length.should.equal(2); //if it's 3, we have an error with limit | ||
done(); | ||
}); | ||
}); | ||
// it('parses offset in queryParameters of conditions', function(done) { | ||
// var data = { queryParameters: { offset: 2 } }; | ||
// Repeatable.findAll(data, function(err, repeatables){ | ||
// repeatables.length.should.equal(1); //if it's 3, we have an error with limit | ||
// repeatables[0].id.should.equal(thirdRepeatable.id); | ||
// done(); | ||
// }); | ||
// }); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51813
29
1194
1