I’m trying to define a custom graphql query like this:
module.exports = {
query: `
getAvailabilityForDate(spaceId: String!, date: String!): GetAvailabilityForDate!
`,
resolver: {
Query: {
getAvailabilityForDate: {
description: "Returns availability of space",
resolverOf: "application::spaces.spaces.getAvailabilityForDate",
resolver: "application::spaces.spaces.getAvailabilityForDate",
},
},
},
};
in my controller the query args are prepended with an _
so I’m assuming that I’m doing something wrong:
async getAvailabilityForDate(ctx) {
// for graphql
const {_spaceId, _date} = ctx.query
// for rest
const {spaceId, date} = ctx.query
}
ideally I would like to remove the underscores so I can just have const {spaceId, date} = ctx.query
. What is the correct way to do this?
Thanks
System Information
- Strapi Version: 3.5.1
- Operating System: WSL2
- Database: Postgres