mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 10:23:34 +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;
|
||||
}, {});
|
||||
|
||||
if (!_.isEmpty(values)) {
|
||||
relationUpdates.push(
|
||||
this
|
||||
.forge({
|
||||
[this.primaryKey]: getValuePrimaryKey(params, this.primaryKey)
|
||||
})
|
||||
.save(values, {
|
||||
patch: true
|
||||
})
|
||||
);
|
||||
} else {
|
||||
relationUpdates.push(Promise.resolve(_.assign(response, params.values)));
|
||||
}
|
||||
|
||||
// Update virtuals fields.
|
||||
// Update fields in other collections.
|
||||
await Promise.all(relationUpdates);
|
||||
|
||||
if (!_.isEmpty(values)) {
|
||||
await this
|
||||
.forge({
|
||||
[this.primaryKey]: getValuePrimaryKey(params, this.primaryKey)
|
||||
})
|
||||
.save(values, {
|
||||
patch: true
|
||||
});
|
||||
}
|
||||
|
||||
return await this
|
||||
.forge({
|
||||
[this.primaryKey]: getValuePrimaryKey(params, this.primaryKey)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user