mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 10:23:34 +00:00
Fix relation create one to one object
This commit is contained in:
parent
c479480d34
commit
14b2676524
@ -509,7 +509,7 @@ module.exports = function(strapi) {
|
||||
if (response[current] !== params.values[current]) {
|
||||
const value = _.isNull(params.values[current]) ? response[current] : params.values;
|
||||
|
||||
const recordId = _.isNull(params.values[current]) ? value[Model.primaryKey] || value.id || value._id : value[current];
|
||||
const recordId = _.isNull(params.values[current]) ? value[Model.primaryKey] || value.id || value._id : typeof value[current] === 'object' ? value[current].id : value[current];
|
||||
|
||||
if (response[current] && _.isObject(response[current]) && response[current][Model.primaryKey] !== value[current]) {
|
||||
virtualFields.push(
|
||||
@ -557,7 +557,7 @@ module.exports = function(strapi) {
|
||||
parseRelationships: false
|
||||
}));
|
||||
|
||||
acc[current] = _.isNull(params.values[current]) ? null : value[current];
|
||||
acc[current] = _.isNull(params.values[current]) ? null : typeof value[current] === 'object' ? value[current][Model.primaryKey] : value[current];
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user