Skip to content

Commit

Permalink
Added README for kumuluzee-rest integration
Browse files Browse the repository at this point in the history
  • Loading branch information
urbim committed Feb 9, 2021
1 parent 37606fe commit 7fe4267
Showing 1 changed file with 46 additions and 1 deletion.
47 changes: 46 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ kumuluzee:
enabled: true
```

This will add a counter and a timer to every query and mutation in the application. For a more fine grained control
This will add a counter and a timer to every query and mutation in the application. For a more fine-grained control
over metrics you can always use metrics annotations on your query/mutation methods. For example:

```java
Expand Down Expand Up @@ -442,6 +442,51 @@ public class Customer {
}
```

## Integration with kumuluzee-rest

You can use the standard [kumuluzee-rest](https://github.com/kumuluz/kumuluzee-rest) parameters (pagination/sort/filter)
in GraphQL queries by using the `GraphQLUtils.queryParametersBuilder()` to construct `QueryParameters`
which can then be used by _kumuluzee-rest_.

For example:

```java
@Query
public StudentConnection getStudentsConnection(Long limit, Long offset, String sort, String filter) {
QueryParameters qp = GraphQLUtils.queryParametersBuilder()
.withQueryStringDefaults(qsd)
.withLimit(limit)
.withOffset(offset)
.withOrder(sort)
.withFilter(filter)
.build();
return new StudentConnection(JPAUtils.queryEntities(em, Student.class, qp),
JPAUtils.queryEntitiesCount(em, Student.class, qp));
}
```

Query:

```graphql
query StudentsStartingWithJ {
studentsConnection(
offset: "0"
limit: "10"
sort: "studentNumber"
filter: "name:LIKE:J%"
) {
totalCount
edges {
studentNumber
name
surname
}
}
}
```

## Changelog

Recent changes can be viewed on Github on the [Releases Page](https://github.com/kumuluz/kumuluzee-graphql/releases).
Expand Down

0 comments on commit 7fe4267

Please sign in to comment.