mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 16:29:34 +00:00
Fix find relation list for compo
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
This commit is contained in:
parent
3ff5f645c8
commit
1b460c76ff
@ -286,6 +286,8 @@ module.exports = {
|
|||||||
const { model, targetField } = ctx.params;
|
const { model, targetField } = ctx.params;
|
||||||
const { _component, ...query } = ctx.request.query;
|
const { _component, ...query } = ctx.request.query;
|
||||||
|
|
||||||
|
const contentManagerServices = strapi.plugins['content-manager'].services;
|
||||||
|
|
||||||
if (!targetField) {
|
if (!targetField) {
|
||||||
return ctx.badRequest();
|
return ctx.badRequest();
|
||||||
}
|
}
|
||||||
@ -307,7 +309,7 @@ module.exports = {
|
|||||||
return ctx.notFound('target.notFound');
|
return ctx.notFound('target.notFound');
|
||||||
}
|
}
|
||||||
|
|
||||||
const contentManagerService = strapi.plugins['content-manager'].services.contentmanager;
|
const contentManagerService = contentManagerServices.contentmanager;
|
||||||
|
|
||||||
let entities = [];
|
let entities = [];
|
||||||
|
|
||||||
@ -321,9 +323,9 @@ module.exports = {
|
|||||||
return ctx.notFound();
|
return ctx.notFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
const modelConfig = await strapi.plugins[
|
const modelConfig = _component
|
||||||
'content-manager'
|
? await contentManagerServices.components.getConfiguration(modelDef.uid)
|
||||||
].services.contenttypes.getConfiguration(model);
|
: await contentManagerServices.contenttypes.getConfiguration(modelDef.uid);
|
||||||
|
|
||||||
const field = _.get(modelConfig, `metadatas.${targetField}.edit.mainField`, 'id');
|
const field = _.get(modelConfig, `metadatas.${targetField}.edit.mainField`, 'id');
|
||||||
const pickFields = [field, 'id', target.primaryKey];
|
const pickFields = [field, 'id', target.primaryKey];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user