mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 02:44:55 +00:00
Fix media relation update
This commit is contained in:
parent
6b2e1f2bde
commit
5175ee6336
@ -21,7 +21,8 @@ module.exports = {
|
||||
.findOne({
|
||||
[this.primaryKey]: params[this.primaryKey] || params.id
|
||||
})
|
||||
.populate(this.associations.map(x => x.alias).join(' '));
|
||||
.populate(this.associations.map(x => x.alias).join(' '))
|
||||
.lean();
|
||||
|
||||
// Only update fields which are on this document.
|
||||
const values = params.parseRelationships === false ? params.values : Object.keys(JSON.parse(JSON.stringify(params.values))).reduce((acc, current) => {
|
||||
@ -270,13 +271,17 @@ module.exports = {
|
||||
However the upload doesn't need this method. It only uses the `removeRelationMorph`.
|
||||
*/
|
||||
|
||||
const entry = (
|
||||
let entry = (
|
||||
await this
|
||||
.findOne({
|
||||
[this.primaryKey]: getValuePrimaryKey(params, this.primaryKey)
|
||||
})
|
||||
.toJSON()
|
||||
);
|
||||
|
||||
if (entry) {
|
||||
entry = entry.toJSON();
|
||||
}
|
||||
|
||||
const value = [];
|
||||
|
||||
// Retrieve association.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user