mirror of
https://github.com/strapi/strapi.git
synced 2025-11-08 06:07:41 +00:00
Merge branch 'master' of github.com:strapi/strapi into upload/bookshelf
This commit is contained in:
commit
2fe530e334
@ -92,11 +92,16 @@ module.exports = {
|
|||||||
|
|
||||||
const entry = request.toJSON ? request.toJSON() : request;
|
const entry = request.toJSON ? request.toJSON() : request;
|
||||||
|
|
||||||
|
const relations = this.associations.reduce((acc, association) => {
|
||||||
|
acc[association.alias] = params.values[association.alias];
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
|
||||||
return module.exports.update.call(this, {
|
return module.exports.update.call(this, {
|
||||||
[this.primaryKey]: entry[this.primaryKey],
|
[this.primaryKey]: entry[this.primaryKey],
|
||||||
values: _.assign({
|
values: _.assign({
|
||||||
id: entry[this.primaryKey]
|
id: entry[this.primaryKey]
|
||||||
}, params.values, entry)
|
}, relations)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -46,11 +46,19 @@ module.exports = {
|
|||||||
|
|
||||||
const entry = request.toJSON ? request.toJSON() : request;
|
const entry = request.toJSON ? request.toJSON() : request;
|
||||||
|
|
||||||
|
const relations = this.associations.reduce((acc, association) => {
|
||||||
|
if (params.values[association.alias]) {
|
||||||
|
acc[association.alias] = params.values[association.alias];
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
|
||||||
return module.exports.update.call(this, {
|
return module.exports.update.call(this, {
|
||||||
[this.primaryKey]: entry[this.primaryKey],
|
[this.primaryKey]: entry[this.primaryKey],
|
||||||
values: _.assign({
|
values: _.assign({
|
||||||
id: entry[this.primaryKey]
|
id: entry[this.primaryKey]
|
||||||
}, params.values, entry)
|
}, relations)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user