Skip to content

Conversation

@PatrickMunsey
Copy link

Hi,
I've implemented the features discussed in #3 . I'm opening this pull request as a further point of discussion so hopefully it can be merged and shared with everyone else.

  • Added select field to query param dto, filter.builder and filter.parser. This is an array of field names in the form of ['firstName','lastName','roles.id','roles.name'].
  • Added optional defaultIncludes parameter to the filterPipes in the form of ['organisations','roles','userGroups'] for a user record for example (the names of -to-many relations). This adds an include statement for the relations to the generated query by default which is removed if a select field is specified.
  • Added sort alias for order query parameters in filter.builder and filter.parser. sort and orderBy query params are just concatincated in filter.parser and the orderBy Prisma query generated as before.
  • Added page query param in filter builder and a function called calculateSkip in filterParser to handle more ways to specify and use offset pagination
  • Added new file called filter-classes.ts which includes the example nestjs dto classes mentioned in the readme which can then be optionally extended and overridden for each nestjs modules dto without having to have another general util folder.
  • Added new tests to cover new pagination aliases and select query params. All tests passing when I import the updated local version of filterBuilder which includes the new sort, select and page alias functionality.
  • There should be no breaking changes that i've identified. All new features are optional.

I'll be looking into cursor based pagination next and will continue that discussion and development separately in #3 .

@PatrickMunsey
Copy link
Author

Hi,

I've made another commit to this pull request with the changes I made a couple of weeks ago. I've included the cursor-based functionality discussed in #5. I've been testing it out since and seems to be running smoothly and as expected.

If you have any questions or want to have a more detailed discussion while reviewing, feel free to reach out.

Thanks,

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

Successfully merging this pull request may close these issues.

1 participant