endpoints-model
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -126,5 +126,5 @@ const _ = require('lodash'); | ||
if(_.isNumber(parent)) { | ||
query = DB.knex(table).column('id').where(relation.key, parent); | ||
query = Bookshelf.knex(table).column('id').where(relation.key, parent); | ||
} else { | ||
query = DB.knex(table).column('id').whereRaw(relation.key+' IN ('+parent.toString()+')'); | ||
query = Bookshelf.knex(table).column('id').whereRaw(relation.key+' IN ('+parent.toString()+')'); | ||
} | ||
@@ -131,0 +131,0 @@ queries.push(query); |
{ | ||
"name": "endpoints-model", | ||
"description": "model layer for the endpoints framework.", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"homepage": "https://github.com/endpoints/model", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -7,1 +7,20 @@ # endpoints-model [![Build Status](https://secure.travis-ci.org/endpoints/model.png)](http://travis-ci.org/endpoints/model) | ||
a quick and dirty extraction of some tools i use all the time for building rest apis. | ||
## Example | ||
```js | ||
const Model = require('endpoints-model'); | ||
const Knex = require('knex')({ | ||
client: "pg", | ||
connection: { | ||
host: "localhost", | ||
user: "user", | ||
database: "db", | ||
password: "pass" | ||
}, | ||
}); | ||
const BaseModel = Model({ | ||
Bookshelf: require('bookshelf')(Knex), | ||
Validator: require('checkit'), | ||
linkPrefix: '/api/v1' // when a model is serialized, the automatically generated `links` key may need a prefix to produce the correct endpoint URL. | ||
}); | ||
``` |
Sorry, the diff of this file is not supported yet
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
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
7363
26