nestjs-paginate
nestjs-paginate copied to clipboard
Factor out `Paginate` function (for testing)
Currently the Paginate
decorator does (_data: unknown, ctx: ExecutionContext) => PaginateQuery
, but is encapsulated as a parameter decorator factory. However, when I'm unit testing, I haven't figured out how to leverage NestJS to resolve these parameters for me, in lieu of that, it would be nice if I could call something like getPaginateQueryFromContext
directly :)
We just have to:
export const getPaginateQueryFromContext = (ctx: ExecutionContext) => {...}
export const Paginate = createParamDecorator((_data: unknown, ctx: ExecutionContext) => getPaginateQueryFromContext(ctx))
I will PR this when I have time for it in a few weeks (together with finishing up the JSON:API stuff!)