2021-08-24 12:10:47 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
module.exports = ({ strapi }) => ({
|
|
|
|
buildComponentResolver: ({ contentTypeUID, attributeName }) => {
|
2021-08-24 17:56:44 +02:00
|
|
|
const { transformArgs } = strapi.plugin('graphql').service('builders').utils;
|
|
|
|
|
2021-09-01 12:06:51 +02:00
|
|
|
return async (parent, args = {}) => {
|
2021-08-24 17:56:44 +02:00
|
|
|
const contentType = strapi.contentTypes[contentTypeUID];
|
2021-08-24 12:10:47 +02:00
|
|
|
const transformedArgs = transformArgs(args, { contentType, usePagination: true });
|
|
|
|
|
2021-09-10 10:24:33 +02:00
|
|
|
return strapi.entityService.load(contentTypeUID, parent, attributeName, transformedArgs);
|
2021-08-24 12:10:47 +02:00
|
|
|
};
|
|
|
|
},
|
|
|
|
});
|