Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Factor out Paginate function (for testing) #825

Open
Helveg opened this issue Dec 3, 2023 · 0 comments
Open

Factor out Paginate function (for testing) #825

Helveg opened this issue Dec 3, 2023 · 0 comments

Comments

@Helveg
Copy link
Collaborator

Helveg commented Dec 3, 2023

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!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant