Adapted to your needs it will look like this:
module.exports = {
query: `
createProduct(input: JSON): JSON
`,
resolver: {
Mutation: { // Depends on your needs, you should use Query(for fetching data) or Mutation (for data modifications)
createProduct: {
description: 'Custom create product with validation',
resolverOf: 'application::product.product.create', // Will apply the same policy on the custom resolver as the controller's action `find`.
resolver: async (obj, options, ctx) => {
let { product: requested_product, amount: requested_amount, client, deliverytime, type } = ctx.request.body;
const product = await strapi.services.product.findOne({id: requested_product});
//Will return an error custom message the amount differs
if (requested_amount !== product.price) {
return { status: '404', message: 'The order request is invalid.'};
}
//(other custom code)
},
},
},
},
};