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

Pagination Support with Querydsl and Query By Example #597

Closed
3 tasks done
Tracked by #103
rstoyanchev opened this issue Jan 12, 2023 · 1 comment
Closed
3 tasks done
Tracked by #103

Pagination Support with Querydsl and Query By Example #597

rstoyanchev opened this issue Jan 12, 2023 · 1 comment
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@rstoyanchev
Copy link
Contributor

rstoyanchev commented Jan 12, 2023

A specific task under Pagination and Sorting #103 is to enable such support for the Querydsl and Query By Example data integrations. This involves the following tasks:

  • Update QuerydslDataFetcher and QueryByExampleDataFetcher to support pagination.
  • Facilitate adapting Spring Data types to GraphQL schema types for pagination (e.g. relay spec). We need the same for @SchemaMapping methods too, so this could be some shared.
  • Update auto-registration.
@rstoyanchev rstoyanchev added the type: enhancement A general enhancement label Jan 12, 2023
@rstoyanchev rstoyanchev added this to the 1.2 Backlog milestone Jan 12, 2023
@rstoyanchev rstoyanchev modified the milestones: 1.2 Backlog, 1.2.0-RC1 Mar 22, 2023
@rstoyanchev rstoyanchev self-assigned this Mar 23, 2023
rstoyanchev added a commit that referenced this issue Apr 12, 2023
rstoyanchev added a commit that referenced this issue Apr 12, 2023
This makes it possible to customize these settings individually,
optionally, and via QuerydslBuilderCustomizer.

See gh-597
rstoyanchev added a commit that referenced this issue Apr 13, 2023
rstoyanchev added a commit that referenced this issue Apr 13, 2023
@dja557
Copy link

dja557 commented Oct 23, 2024

@rstoyanchev Hi! This framework is great. I'm having trouble setting up sorting via the QueryDSL support here. Can you provide an example of how this is supposed to work? I followed the documentation here but was unsuccessful. Here is my example:

Repository

@GraphQlRepository
public interface CustWebTranRepository extends PagingAndSortingRepository<CustWebTran,CustWebTranPK>,
        QuerydslPredicateExecutor<CustWebTran> {
}

Schema

type Query {
    transaction(customerId: String
        ...
        first:Int
        after:String
        last:Int
        before:String,
        sort: [String],
        direction: Direction
    ): CustWebTranConnection
}
type CustWebTranConnection {
    edges: [CustWebTranEdge]!
    pageInfo: PageInfo!
}
type CustWebTranEdge {
    node: CustWebTran!
    cursor: String!
}

SortStrategy Bean

@Bean
public SortStrategy sortStrategy() {
    return new AbstractSortStrategy() {
        @Override
        protected List<String> getProperties(DataFetchingEnvironment environment) {
            return environment.getArgument("sort");
        }

        @Override
        protected Sort.Direction getDirection(DataFetchingEnvironment environment) {
            return Sort.Direction.fromOptionalString(environment.getArgument("direction")).orElse(null);
        }
    };
}

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

No branches or pull requests

2 participants