Merge pull request #106 from strongloop/fix/id-urls-remoting

Fix remoting for IDs in URLs
This commit is contained in:
Ritchie Martori 2014-05-01 14:25:31 -07:00
commit 977c5d1572
1 changed files with 6 additions and 3 deletions

View File

@ -298,7 +298,8 @@ DataAccessObject.exists = function exists(id, cb) {
// exists ~ remoting attributes // exists ~ remoting attributes
setRemoting(DataAccessObject.exists, { setRemoting(DataAccessObject.exists, {
description: 'Check whether a model instance exists in the data source', description: 'Check whether a model instance exists in the data source',
accepts: {arg: 'id', type: 'any', description: 'Model id', required: true}, accepts: {arg: 'id', type: 'any', description: 'Model id', required: true,
http: {source: 'path'}},
returns: {arg: 'exists', type: 'any'}, returns: {arg: 'exists', type: 'any'},
http: {verb: 'get', path: '/:id/exists'} http: {verb: 'get', path: '/:id/exists'}
}); });
@ -328,7 +329,8 @@ DataAccessObject.findById = function find(id, cb) {
// find ~ remoting attributes // find ~ remoting attributes
setRemoting(DataAccessObject.findById, { setRemoting(DataAccessObject.findById, {
description: 'Find a model instance by id from the data source', description: 'Find a model instance by id from the data source',
accepts: {arg: 'id', type: 'any', description: 'Model id', required: true}, accepts: {arg: 'id', type: 'any', description: 'Model id', required: true,
http: {source: 'path'}},
returns: {arg: 'data', type: 'any', root: true}, returns: {arg: 'data', type: 'any', root: true},
http: {verb: 'get', path: '/:id'}, http: {verb: 'get', path: '/:id'},
rest: {after: convertNullToNotFoundError} rest: {after: convertNullToNotFoundError}
@ -674,7 +676,8 @@ DataAccessObject.removeById =
// deleteById ~ remoting attributes // deleteById ~ remoting attributes
setRemoting(DataAccessObject.deleteById, { setRemoting(DataAccessObject.deleteById, {
description: 'Delete a model instance by id from the data source', description: 'Delete a model instance by id from the data source',
accepts: {arg: 'id', type: 'any', description: 'Model id', required: true}, accepts: {arg: 'id', type: 'any', description: 'Model id', required: true,
http: {source: 'path'}},
http: {verb: 'del', path: '/:id'} http: {verb: 'del', path: '/:id'}
}); });