GraphQL bugfix + query samples
This commit is contained in:
96
Events.GraphQL/graphql-cheat-sheet.md
Normal file
96
Events.GraphQL/graphql-cheat-sheet.md
Normal file
@@ -0,0 +1,96 @@
|
||||
# GraphQL Cheat Sheet
|
||||
|
||||
Use endpoint: `/graphql`
|
||||
|
||||
## Available queries
|
||||
|
||||
- `countries`
|
||||
- `sports`
|
||||
- `people`
|
||||
- `peoplePage(pageNumber, pageSize)`
|
||||
- `events`
|
||||
- `eventsForDate(date)`
|
||||
- `registrations`
|
||||
|
||||
## Common arguments
|
||||
|
||||
- paging: `first`, `after`, `last`, `before`
|
||||
- filtering: `where`
|
||||
- sorting: `order`
|
||||
|
||||
## Quick examples
|
||||
|
||||
### Get events
|
||||
|
||||
```graphql
|
||||
query {
|
||||
events(first: 5) {
|
||||
nodes {
|
||||
id
|
||||
name
|
||||
eventDate
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Filter people by country
|
||||
|
||||
```graphql
|
||||
query {
|
||||
people(where: { countryCode: { eq: "HR" } }, first: 10) {
|
||||
nodes {
|
||||
id
|
||||
firstName
|
||||
lastName
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Sort sports by name
|
||||
|
||||
```graphql
|
||||
query {
|
||||
sports(order: [{ name: ASC }], first: 10) {
|
||||
nodes {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Events for a specific date
|
||||
|
||||
```graphql
|
||||
query {
|
||||
eventsForDate(date: "2026-06-15", first: 10) {
|
||||
nodes {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Classic paging with `peoplePage`
|
||||
|
||||
```graphql
|
||||
query {
|
||||
peoplePage(pageNumber: 1, pageSize: 5) {
|
||||
totalCount
|
||||
items {
|
||||
id
|
||||
firstName
|
||||
lastName
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Mutations
|
||||
|
||||
- `addEvent(input)`
|
||||
- `updateEvent(id, input)`
|
||||
- `deleteEvent(id)`
|
||||
Reference in New Issue
Block a user