Beginnings of this code is in there already, but GraphQL isn't playing nicely with the count endpoint in Strapi if you use variables.