GraphQL middleware issue

Hi all, I got around this issue using the same structure when we use it directly in middlware array, example:

/**
 * `add-client-into-barbershop` middleware
 */

import { errors } from "@strapi/utils";
import { Context } from "koa";
import * as _ from "lodash";

export default async (next, parent, args, context: Context, info) => {
  // If you want to do something before reaching DB
  const resp = await next(parent, args, context, info);
 // If you want to do something after reaching DB

  const { hasAlreadyThisClient, barbershop, clientId, barbershopId } =
    parent || {};

  if (resp && barbershop && !hasAlreadyThisClient) {
    await strapi.entityService.update(
      "api::barbershop.barbershop",
      barbershopId,
      {
        data: { clients: [...barbershop.clients, clientId] },
        populate: "clients",
      }
    );
  }

  return resp;
};

OBS: strapi variable is available everywhere!