Is this for the end-user (aka REST/GraphQL) or Admin that you are trying to make modifications.
also the syntax you are using is a bit outdated, beforeFetch and afterFetch aren’t lifecycle functions. I think you mean beforeFind and afterFind based on our documentation: Backend customization - Strapi Developer Documentation