-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #391 from goldcaddy77/390-relay-connection-example
feat(relay): adds relay example
- Loading branch information
Showing
19 changed files
with
4,915 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
NODE_ENV=development | ||
PGUSER=postgres | ||
WARTHOG_APP_HOST=localhost | ||
WARTHOG_APP_PORT=4100 | ||
WARTHOG_DB_DATABASE=warthog-12-relay-example | ||
WARTHOG_DB_USERNAME=postgres | ||
WARTHOG_DB_PASSWORD= | ||
WARTHOG_DB_SYNCHRONIZE=true | ||
WARTHOG_SUBSCRIPTIONS=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
## Example 12 | ||
|
||
## Setup | ||
|
||
Run `yarn bootstrap && yarn start` | ||
|
||
## Bootstrapping the App | ||
|
||
Running `DEBUG=* yarn bootstrap` will do the following: | ||
|
||
- Install packages | ||
- Create the example DB | ||
- Seed the database with test data | ||
|
||
## Running the App | ||
|
||
To run the project, run `yarn start`. This will: | ||
|
||
- Run the API server | ||
- Open GraphQL Playground |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
query { | ||
UserConnection(where: { firstName_contains: "a" }, orderBy: createdAt_DESC) { | ||
nodes { | ||
id | ||
firstName | ||
lastName | ||
} | ||
pageInfo { | ||
limit | ||
offset | ||
totalCount | ||
hasNextPage | ||
hasPreviousPage | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,222 @@ | ||
import 'graphql-import-node'; // Needed so you can import *.graphql files | ||
|
||
import { makeBindingClass, Options } from 'graphql-binding' | ||
import { GraphQLResolveInfo, GraphQLSchema } from 'graphql' | ||
import { IResolvers } from 'graphql-tools/dist/Interfaces' | ||
import * as schema from './schema.graphql' | ||
|
||
export interface Query { | ||
UserConnection: <T = UserConnection>(args: { offset?: Int | null, limit?: Int | null, where?: UserWhereInput | null, orderBy?: UserOrderByInput | null }, info?: GraphQLResolveInfo | string, options?: Options) => Promise<T> | ||
} | ||
|
||
export interface Mutation {} | ||
|
||
export interface Subscription {} | ||
|
||
export interface Binding { | ||
query: Query | ||
mutation: Mutation | ||
subscription: Subscription | ||
request: <T = any>(query: string, variables?: {[key: string]: any}) => Promise<T> | ||
delegate(operation: 'query' | 'mutation', fieldName: string, args: { | ||
[key: string]: any; | ||
}, infoOrQuery?: GraphQLResolveInfo | string, options?: Options): Promise<any>; | ||
delegateSubscription(fieldName: string, args?: { | ||
[key: string]: any; | ||
}, infoOrQuery?: GraphQLResolveInfo | string, options?: Options): Promise<AsyncIterator<any>>; | ||
getAbstractResolvers(filterSchema?: GraphQLSchema | string): IResolvers; | ||
} | ||
|
||
export interface BindingConstructor<T> { | ||
new(...args: any[]): T | ||
} | ||
|
||
export const Binding = makeBindingClass<BindingConstructor<Binding>>({ schema: schema as any }) | ||
|
||
/** | ||
* Types | ||
*/ | ||
|
||
export type UserOrderByInput = 'createdAt_ASC' | | ||
'createdAt_DESC' | | ||
'updatedAt_ASC' | | ||
'updatedAt_DESC' | | ||
'deletedAt_ASC' | | ||
'deletedAt_DESC' | | ||
'firstName_ASC' | | ||
'firstName_DESC' | | ||
'lastName_ASC' | | ||
'lastName_DESC' | ||
|
||
export interface BaseWhereInput { | ||
id_eq?: String | null | ||
id_in?: String[] | String | null | ||
createdAt_eq?: String | null | ||
createdAt_lt?: String | null | ||
createdAt_lte?: String | null | ||
createdAt_gt?: String | null | ||
createdAt_gte?: String | null | ||
createdById_eq?: String | null | ||
updatedAt_eq?: String | null | ||
updatedAt_lt?: String | null | ||
updatedAt_lte?: String | null | ||
updatedAt_gt?: String | null | ||
updatedAt_gte?: String | null | ||
updatedById_eq?: String | null | ||
deletedAt_all?: Boolean | null | ||
deletedAt_eq?: String | null | ||
deletedAt_lt?: String | null | ||
deletedAt_lte?: String | null | ||
deletedAt_gt?: String | null | ||
deletedAt_gte?: String | null | ||
deletedById_eq?: String | null | ||
} | ||
|
||
export interface UserCreateInput { | ||
firstName: String | ||
lastName: String | ||
} | ||
|
||
export interface UserUpdateInput { | ||
firstName?: String | null | ||
lastName?: String | null | ||
} | ||
|
||
export interface UserWhereInput { | ||
id_eq?: ID_Input | null | ||
id_in?: ID_Output[] | ID_Output | null | ||
createdAt_eq?: DateTime | null | ||
createdAt_lt?: DateTime | null | ||
createdAt_lte?: DateTime | null | ||
createdAt_gt?: DateTime | null | ||
createdAt_gte?: DateTime | null | ||
createdById_eq?: ID_Input | null | ||
createdById_in?: ID_Output[] | ID_Output | null | ||
updatedAt_eq?: DateTime | null | ||
updatedAt_lt?: DateTime | null | ||
updatedAt_lte?: DateTime | null | ||
updatedAt_gt?: DateTime | null | ||
updatedAt_gte?: DateTime | null | ||
updatedById_eq?: ID_Input | null | ||
updatedById_in?: ID_Output[] | ID_Output | null | ||
deletedAt_all?: Boolean | null | ||
deletedAt_eq?: DateTime | null | ||
deletedAt_lt?: DateTime | null | ||
deletedAt_lte?: DateTime | null | ||
deletedAt_gt?: DateTime | null | ||
deletedAt_gte?: DateTime | null | ||
deletedById_eq?: ID_Input | null | ||
deletedById_in?: ID_Output[] | ID_Output | null | ||
firstName_eq?: String | null | ||
firstName_contains?: String | null | ||
firstName_startsWith?: String | null | ||
firstName_endsWith?: String | null | ||
firstName_in?: String[] | String | null | ||
lastName_eq?: String | null | ||
lastName_contains?: String | null | ||
lastName_startsWith?: String | null | ||
lastName_endsWith?: String | null | ||
lastName_in?: String[] | String | null | ||
} | ||
|
||
export interface UserWhereUniqueInput { | ||
id: ID_Output | ||
} | ||
|
||
export interface BaseGraphQLObject { | ||
id: ID_Output | ||
createdAt: DateTime | ||
createdById: String | ||
updatedAt?: DateTime | null | ||
updatedById?: String | null | ||
deletedAt?: DateTime | null | ||
deletedById?: String | null | ||
version: Int | ||
} | ||
|
||
export interface DeleteResponse { | ||
id: ID_Output | ||
} | ||
|
||
export interface BaseModel extends BaseGraphQLObject { | ||
id: ID_Output | ||
createdAt: DateTime | ||
createdById: String | ||
updatedAt?: DateTime | null | ||
updatedById?: String | null | ||
deletedAt?: DateTime | null | ||
deletedById?: String | null | ||
version: Int | ||
} | ||
|
||
export interface BaseModelUUID extends BaseGraphQLObject { | ||
id: ID_Output | ||
createdAt: DateTime | ||
createdById: String | ||
updatedAt?: DateTime | null | ||
updatedById?: String | null | ||
deletedAt?: DateTime | null | ||
deletedById?: String | null | ||
version: Int | ||
} | ||
|
||
export interface PageInfo { | ||
limit: Float | ||
offset: Float | ||
totalCount: Float | ||
hasNextPage: Boolean | ||
hasPreviousPage: Boolean | ||
} | ||
|
||
export interface StandardDeleteResponse { | ||
id: ID_Output | ||
} | ||
|
||
export interface User extends BaseGraphQLObject { | ||
id: ID_Output | ||
createdAt: DateTime | ||
createdById: String | ||
updatedAt?: DateTime | null | ||
updatedById?: String | null | ||
deletedAt?: DateTime | null | ||
deletedById?: String | null | ||
version: Int | ||
firstName: String | ||
lastName: String | ||
} | ||
|
||
export interface UserConnection { | ||
nodes: Array<User> | ||
pageInfo: PageInfo | ||
} | ||
|
||
/* | ||
The `Boolean` scalar type represents `true` or `false`. | ||
*/ | ||
export type Boolean = boolean | ||
|
||
/* | ||
The javascript `Date` as string. Type represents date and time as the ISO Date string. | ||
*/ | ||
export type DateTime = Date | string | ||
|
||
/* | ||
The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point). | ||
*/ | ||
export type Float = number | ||
|
||
/* | ||
The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID. | ||
*/ | ||
export type ID_Input = string | number | ||
export type ID_Output = string | ||
|
||
/* | ||
The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1. | ||
*/ | ||
export type Int = number | ||
|
||
/* | ||
The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text. | ||
*/ | ||
export type String = string |
Oops, something went wrong.