nestjs-typeorm-paginate
nestjs-typeorm-paginate copied to clipboard
GraphQL Support
Is there any way to use this with GraphQL? Currently, i am not able to select the correct Query Return Object
I've honestly not looked at graphQL much. Could you provide an example of how you would create a paginated result with typeORM please? :) I'm guessing the query would look something like this
const query = repository.queryBuilder()
.select(requiredProperties)
.where(matching)
.limit(limitFromQL)
.from()// last index?
const [count, results] = Partial<MyEntity> query.getManyAndCount();
I think it should be a relay connection not a pagination.
After working with GraphQL for a bit, I think it would be possible to set this up and @rifatdover you're right, it would be a relay connection. I'll see what I can do!
yes i tried but so basically, ı turn this "https://relay.dev/graphql/connections.htm" later. maybe that gives an idea https://github.com/tamert/nest-typeorm-graphql-jest/blob/0fe1e7bfb22f50e3f45bf4631179f12f620f1282/src/recipes/recipes.resolver.ts#L34
It's works. I have many queries with return
paginate<Entity>(this.repository, optionLimit, queryOptions)
All queries have option IPaginationOption, filters ( custom field ) and sort by any field from Entity