mirror of
https://github.com/strapi/strapi.git
synced 2025-11-03 11:25:17 +00:00
Force relationnal updates to be done before main model update
This commit is contained in:
parent
7e45ef91fc
commit
83d762bb53
@ -240,23 +240,19 @@ module.exports = {
|
|||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
|
// Update fields in other collections.
|
||||||
|
await Promise.all(relationUpdates);
|
||||||
|
|
||||||
if (!_.isEmpty(values)) {
|
if (!_.isEmpty(values)) {
|
||||||
relationUpdates.push(
|
await this
|
||||||
this
|
|
||||||
.forge({
|
.forge({
|
||||||
[this.primaryKey]: getValuePrimaryKey(params, this.primaryKey)
|
[this.primaryKey]: getValuePrimaryKey(params, this.primaryKey)
|
||||||
})
|
})
|
||||||
.save(values, {
|
.save(values, {
|
||||||
patch: true
|
patch: true
|
||||||
})
|
});
|
||||||
);
|
|
||||||
} else {
|
|
||||||
relationUpdates.push(Promise.resolve(_.assign(response, params.values)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update virtuals fields.
|
|
||||||
await Promise.all(relationUpdates);
|
|
||||||
|
|
||||||
return await this
|
return await this
|
||||||
.forge({
|
.forge({
|
||||||
[this.primaryKey]: getValuePrimaryKey(params, this.primaryKey)
|
[this.primaryKey]: getValuePrimaryKey(params, this.primaryKey)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user