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
setRemoting(DataAccessObject.exists, {
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'},
http: {verb: 'get', path: '/:id/exists'}
});
@ -328,7 +329,8 @@ DataAccessObject.findById = function find(id, cb) {
// find ~ remoting attributes
setRemoting(DataAccessObject.findById, {
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},
http: {verb: 'get', path: '/:id'},
rest: {after: convertNullToNotFoundError}
@ -674,7 +676,8 @@ DataAccessObject.removeById =
// deleteById ~ remoting attributes
setRemoting(DataAccessObject.deleteById, {
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'}
});