Allow installation get (#1980)

This commit is contained in:
Drew
2016-06-04 09:37:15 -07:00
committed by Florent Vilmart
parent bea655e61b
commit aeb6880b85
3 changed files with 51 additions and 15 deletions

View File

@@ -77,7 +77,7 @@ export class ClassesRouter extends PromiseRouter {
options.include = String(body.include);
}
return rest.find(req.config, req.auth, req.params.className, {objectId: req.params.objectId}, options)
return rest.get(req.config, req.auth, req.params.className, req.params.objectId, options)
.then((response) => {
if (!response.results || response.results.length == 0) {
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Object not found.');

View File

@@ -17,8 +17,14 @@ var triggers = require('./triggers');
// Returns a promise for an object with optional keys 'results' and 'count'.
function find(config, auth, className, restWhere, restOptions) {
enforceRoleSecurity('find', className, auth);
var query = new RestQuery(config, auth, className,
restWhere, restOptions);
let query = new RestQuery(config, auth, className, restWhere, restOptions);
return query.execute();
}
// get is just like find but only queries an objectId.
const get = (config, auth, className, objectId, restOptions) => {
enforceRoleSecurity('get', className, auth);
let query = new RestQuery(config, auth, className, { objectId }, restOptions);
return query.execute();
}
@@ -128,8 +134,9 @@ function enforceRoleSecurity(method, className, auth) {
}
module.exports = {
create: create,
del: del,
find: find,
update: update
create,
del,
find,
get,
update
};