Merge pull request #1066 from ParsePlatform/flovilmart.returnsFullModificationsForREST
Improvements in REST calls
This commit is contained in:
@@ -712,6 +712,12 @@ RestWrite.prototype.runDatabaseOperation = function() {
|
||||
return this.config.database.update(
|
||||
this.className, this.query, this.data, this.runOptions).then((resp) => {
|
||||
resp.updatedAt = this.updatedAt;
|
||||
if (this.storage['changedByTrigger']) {
|
||||
resp = Object.keys(this.data).reduce((memo, key) => {
|
||||
memo[key] = resp[key] || this.data[key];
|
||||
return memo;
|
||||
}, resp);
|
||||
}
|
||||
this.response = {
|
||||
response: resp
|
||||
};
|
||||
@@ -726,13 +732,16 @@ RestWrite.prototype.runDatabaseOperation = function() {
|
||||
}
|
||||
// Run a create
|
||||
return this.config.database.create(this.className, this.data, this.runOptions)
|
||||
.then(() => {
|
||||
var resp = {
|
||||
.then((resp) => {
|
||||
Object.assign(resp, {
|
||||
objectId: this.data.objectId,
|
||||
createdAt: this.data.createdAt
|
||||
};
|
||||
});
|
||||
if (this.storage['changedByTrigger']) {
|
||||
Object.assign(resp, this.data);
|
||||
resp = Object.keys(this.data).reduce((memo, key) => {
|
||||
memo[key] = resp[key] || this.data[key];
|
||||
return memo;
|
||||
}, resp);
|
||||
}
|
||||
if (this.storage['token']) {
|
||||
resp.sessionToken = this.storage['token'];
|
||||
|
||||
Reference in New Issue
Block a user