Skip to content

Select fields and pagination aliases #3

@PatrickMunsey

Description

@PatrickMunsey

Hi,

This looks like a great library. I've been experimenting with it and I'm wondering if there are any plans on adding a select field feature and eventaually something to accomodate cursor pagination. I'm looking at exploring this myself and was wondering if you could give me some guidance as I continue to wrap my head around things.

Some notes:

  • I'm already able to add a field to the DTO called select of type string[] which generates an array of all field names passed through the query string
  • The field names in select: string[] that are also within the keys array should be added to a select query field in findOptions
  • Field names specified within the select query field that are also within the compound keys array should added to an include query field in findOptions
  • Generated prisma select and include statements returned from findOptions are optional and can be equal to null but must not be not-null at the same time
  • I've noted that <prismamodel>WhereInput type is used to initialise the DirectFilterPipe instead of something like <prismamodel>FindManyArgs which is making it hard for me to figure out how to add select and include fields with non-null type to generateQueryFindOptions and GeneratedFindOptions.
  • I've tried adding and/or subsbtituting the <prismamodel>FindManyArgs type into the IGeneratedFilter interface and dependant types to get these extra select, include and cursor types from prisma to play with but with no success so far.
  • Using the <prismamodel>FindManyArgs type may also make it easier to add cursor handling functionality in the future?

If I can figure it out in the meantime I'll make a pull request if you like. I'm also happy to pair with someone on your team if that appeals to you.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions