How to return pagination in a custom graphQL resolver

System Information
  • Strapi Version: 4.6.1
  • Operating System: docker alpine
  • Database: Postgres
  • Node Version: 16.19.0
  • NPM Version:
  • Yarn Version: 1.22.19

Hi everybody,

I have this resolver in my project.

meProductsCustomer: {
  resolve: async (parent, args, ctx) => {
    const authUser = ctx.state.user;

    if (!authUser) {
      return ctx.unauthorized();
    }

    const { toEntityResponseCollection } = strapi.service(
      "plugin::graphql.format"
    ).returnTypes;

    const data = await strapi.services["api::product.product"].find({
      filters: { prev_owner: authUser.wallet },
      sort: { id: 'desc' }
    })
    const response = toEntityResponseCollection(data.results);

    return response;
  }
},

And I want to get the default meta pagination response too, like this

{
  data: {...}
  meta: {
    pagination {
      total
      page
      pageSize
      pageCount
    }
  }
}

I checked this topic but honestly I don’t understand what he did to resolve the problem.

Thanks for your help