Allow installation get (#1980)
This commit is contained in:
@@ -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.');
|
||||
|
||||
19
src/rest.js
19
src/rest.js
@@ -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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user