What's the best way to intercept a response before sending it back in nestjs/graphql?
I'm trying to intercept a response of a query result, extracting some of the data into the context.extensions before sending it back. I've tried applying a middleware using graphql-middleware but it does not work.
this is what i've tried doing
export const Pagination: MiddlewareFn = async ({ info }, next) => {
// here i'm trying to extract the data
};
and this is where i'm trying to put it (resolver.ts)
@UseMiddleware(Pagination)
findAll(options: PaginationInput): Promise<PaginatedReport> {
return applyPagination(this.reportRepository, options);
}