parse-dashboard 5.2.0-alpha.21 → 5.2.0-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -393,6 +393,20 @@ Parse.Cloud.define('deleteAccount', async (req) => {
|
|
|
393
393
|
});
|
|
394
394
|
```
|
|
395
395
|
|
|
396
|
+
The field which the script was invoked on can be accessed by `selectedField`:
|
|
397
|
+
|
|
398
|
+
```js
|
|
399
|
+
Parse.Cloud.define('deleteAccount', async (req) => {
|
|
400
|
+
if (req.params.selectedField !== 'objectId') {
|
|
401
|
+
throw new Parse.Error(Parse.Error.SCRIPT_FAILED, 'Deleting accounts is only available on the objectId field.');
|
|
402
|
+
}
|
|
403
|
+
req.params.object.set('deleted', true);
|
|
404
|
+
await req.params.object.save(null, {useMasterKey: true});
|
|
405
|
+
}, {
|
|
406
|
+
requireMaster: true
|
|
407
|
+
});
|
|
408
|
+
```
|
|
409
|
+
|
|
396
410
|
⚠️ Depending on your Parse Server version you may need to set the Parse Server option `encodeParseObjectInCloudFunction` to `true` so that the selected object in the data browser is made available in the Cloud Function as an instance of `Parse.Object`. If the option is not set, is set to `false`, or you are using an older version of Parse Server, the object is made available as a plain JavaScript object and needs to be converted from a JSON object to a `Parse.Object` instance with `req.params.object = Parse.Object.fromJSON(req.params.object);`, before you can call any `Parse.Object` properties and methods on it.
|
|
397
411
|
|
|
398
412
|
For older versions of Parse Server:
|