System Information
- Strapi Version: 3.6.8
- Operating System:
- Database:
- Node Version:
- NPM Version:
- Yarn Version:
I have created a custom resolver in order to handle a search request. I have declared the resolver in api/my-endpoint/config/schema.graphql.js
. This resolver is declaring the 3 content types possible in array results, and is calling find()
function declared in api/my-enpoint/controllers/my-endpoint.js
.
Here is the resolver :
module.exports = {
definition: `
union Content = ShortContent | Webinar | Report
`,
query: `search(
start: Int!
limit: Int!
q: String!
): [Content!]!`,
resolver: {
Content: {
__resolveType: (obj, ctx, info) => {
if (obj.contentType === 'short-contents') {
return 'ShortContent';
}
if (obj.contentType === 'webinars') {
return 'Webinar';
}
if (obj.contentType === 'reports') {
return 'Report';
}
return null;
},
},
Query: {
search: {
resolverOf: 'application::helper-search.helper-search.search',
resolver: (obj, options, { context }) => {
return strapi.controllers['helper-search'].find(context);
},
},
},
},
};
When i’m call the graphql query search()
, I have a 403 FORBIDDEN
response. I already check permissions in http://localhost:1337/admin/settings/users-permissions/roles/1
and my-endpoint.find()
is authorized.
Do you have any idea to solve this ? Thank’s a lot