mirror of
https://github.com/strapi/strapi.git
synced 2025-11-09 06:40:42 +00:00
some cleanup
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
This commit is contained in:
parent
c7f10bfede
commit
be24f640d9
@ -440,47 +440,13 @@ const buildRelation = ({ definition, model, instance, attribute, name }) => {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'morphOne': {
|
case 'morphOne': {
|
||||||
// const FK = _.find(definition.associations, {
|
|
||||||
// alias: name,
|
|
||||||
// });
|
|
||||||
|
|
||||||
// const ref = getRef(attribute.model, attribute.plugin);
|
|
||||||
|
|
||||||
// setField(name, {
|
|
||||||
// type: 'virtual',
|
|
||||||
// ref,
|
|
||||||
// via: `${FK.via}.ref`,
|
|
||||||
// justOne: true,
|
|
||||||
// });
|
|
||||||
|
|
||||||
// // Set this info to be able to see if this field is a real database's field.
|
|
||||||
// attribute.isVirtual = true;
|
|
||||||
|
|
||||||
const ref = getRef(attribute.model, attribute.plugin);
|
const ref = getRef(attribute.model, attribute.plugin);
|
||||||
|
|
||||||
setField(name, { type: ObjectId, ref });
|
setField(name, { type: ObjectId, ref });
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'morphMany': {
|
case 'morphMany': {
|
||||||
// const FK = _.find(definition.associations, {
|
|
||||||
// alias: name,
|
|
||||||
// });
|
|
||||||
// const ref = getRef(attribute.collection, attribute.plugin);
|
|
||||||
|
|
||||||
// setField(name, {
|
|
||||||
// type: 'virtual',
|
|
||||||
// ref,
|
|
||||||
// via: `${FK.via}.ref`,
|
|
||||||
// });
|
|
||||||
|
|
||||||
// // Set this info to be able to see if this field is a real database's field.
|
|
||||||
// attribute.isVirtual = true;
|
|
||||||
|
|
||||||
const ref = getRef(attribute.collection, attribute.plugin);
|
const ref = getRef(attribute.collection, attribute.plugin);
|
||||||
|
|
||||||
setField(name, [{ type: ObjectId, ref }]);
|
setField(name, [{ type: ObjectId, ref }]);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -463,10 +463,8 @@ module.exports = {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'oneMorphToOne':
|
case 'oneMorphToOne':
|
||||||
case 'oneMorphToMany': {
|
case 'oneMorphToMany': {
|
||||||
// TODO: to implement
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user