Created
April 19, 2019 22:19
-
-
Save jjn1056/bcfafb29efab95acea44a9c36db3cce1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
CREATE TABLE employees ( | |
emp_no INTEGER PRIMARY KEY NOT NULL, | |
record_no integer NOT NULL, | |
birth_date date NOT NULL, | |
first_name varchar(14) NOT NULL, | |
last_name varchar(16) NOT NULL, | |
hire_date date NOT NULL | |
); | |
"""All input for the create `Employee` mutation.""" | |
input CreateEmployeeInput { | |
""" | |
An arbitrary string value with no semantic meaning. Will be included in the | |
payload verbatim. May be used to track mutations by the client. | |
""" | |
clientMutationId: String | |
"""The `Employee` to be created by this mutation.""" | |
employee: EmployeeInput! | |
} | |
"""The output of our create `Employee` mutation.""" | |
type CreateEmployeePayload { | |
""" | |
The exact same `clientMutationId` that was provided in the mutation input, | |
unchanged and unused. May be used by a client to track mutations. | |
""" | |
clientMutationId: String | |
"""The `Employee` that was created by this mutation.""" | |
employee: Employee | |
""" | |
Our root query field type. Allows us to run any query from our mutation payload. | |
""" | |
query: Query | |
"""An edge for our `Employee`. May be used by Relay 1.""" | |
employeeEdge( | |
"""The method to use when ordering `Employee`.""" | |
orderBy: [EmployeesOrderBy!] = PRIMARY_KEY_ASC | |
): EmployeesEdge | |
} | |
"""A location in a connection that can be used for resuming pagination.""" | |
scalar Cursor | |
"""The day, does not include a time.""" | |
scalar Date | |
"""All input for the `deleteEmployeeByEmpNo` mutation.""" | |
input DeleteEmployeeByEmpNoInput { | |
""" | |
An arbitrary string value with no semantic meaning. Will be included in the | |
payload verbatim. May be used to track mutations by the client. | |
""" | |
clientMutationId: String | |
empNo: Int! | |
} | |
"""All input for the `deleteEmployee` mutation.""" | |
input DeleteEmployeeInput { | |
""" | |
An arbitrary string value with no semantic meaning. Will be included in the | |
payload verbatim. May be used to track mutations by the client. | |
""" | |
clientMutationId: String | |
""" | |
The globally unique `ID` which will identify a single `Employee` to be deleted. | |
""" | |
nodeId: ID! | |
} | |
"""The output of our delete `Employee` mutation.""" | |
type DeleteEmployeePayload { | |
""" | |
The exact same `clientMutationId` that was provided in the mutation input, | |
unchanged and unused. May be used by a client to track mutations. | |
""" | |
clientMutationId: String | |
"""The `Employee` that was deleted by this mutation.""" | |
employee: Employee | |
deletedEmployeeId: ID | |
""" | |
Our root query field type. Allows us to run any query from our mutation payload. | |
""" | |
query: Query | |
"""An edge for our `Employee`. May be used by Relay 1.""" | |
employeeEdge( | |
"""The method to use when ordering `Employee`.""" | |
orderBy: [EmployeesOrderBy!] = PRIMARY_KEY_ASC | |
): EmployeesEdge | |
} | |
type Employee implements Node { | |
""" | |
A globally unique identifier. Can be used in various places throughout the system to identify this single value. | |
""" | |
nodeId: ID! | |
empNo: Int! | |
recordNo: Int! | |
birthDate: Date! | |
firstName: String! | |
lastName: String! | |
hireDate: Date! | |
} | |
""" | |
A condition to be used against `Employee` object types. All fields are tested | |
for equality and combined with a logical ‘and.’ | |
""" | |
input EmployeeCondition { | |
"""Checks for equality with the object’s `empNo` field.""" | |
empNo: Int | |
"""Checks for equality with the object’s `recordNo` field.""" | |
recordNo: Int | |
"""Checks for equality with the object’s `birthDate` field.""" | |
birthDate: Date | |
"""Checks for equality with the object’s `firstName` field.""" | |
firstName: String | |
"""Checks for equality with the object’s `lastName` field.""" | |
lastName: String | |
"""Checks for equality with the object’s `hireDate` field.""" | |
hireDate: Date | |
} | |
"""An input for mutations affecting `Employee`""" | |
input EmployeeInput { | |
empNo: Int! | |
recordNo: Int! | |
birthDate: Date! | |
firstName: String! | |
lastName: String! | |
hireDate: Date! | |
} | |
""" | |
Represents an update to a `Employee`. Fields that are set will be updated. | |
""" | |
input EmployeePatch { | |
empNo: Int | |
recordNo: Int | |
birthDate: Date | |
firstName: String | |
lastName: String | |
hireDate: Date | |
} | |
"""A connection to a list of `Employee` values.""" | |
type EmployeesConnection { | |
"""A list of `Employee` objects.""" | |
nodes: [Employee]! | |
""" | |
A list of edges which contains the `Employee` and cursor to aid in pagination. | |
""" | |
edges: [EmployeesEdge!]! | |
"""Information to aid in pagination.""" | |
pageInfo: PageInfo! | |
"""The count of *all* `Employee` you could get from the connection.""" | |
totalCount: Int | |
} | |
"""A `Employee` edge in the connection.""" | |
type EmployeesEdge { | |
"""A cursor for use in pagination.""" | |
cursor: Cursor | |
"""The `Employee` at the end of the edge.""" | |
node: Employee | |
} | |
"""Methods to use when ordering `Employee`.""" | |
enum EmployeesOrderBy { | |
NATURAL | |
EMP_NO_ASC | |
EMP_NO_DESC | |
RECORD_NO_ASC | |
RECORD_NO_DESC | |
BIRTH_DATE_ASC | |
BIRTH_DATE_DESC | |
FIRST_NAME_ASC | |
FIRST_NAME_DESC | |
LAST_NAME_ASC | |
LAST_NAME_DESC | |
HIRE_DATE_ASC | |
HIRE_DATE_DESC | |
PRIMARY_KEY_ASC | |
PRIMARY_KEY_DESC | |
} | |
""" | |
The root mutation type which contains root level fields which mutate data. | |
""" | |
type Mutation { | |
"""Creates a single `Employee`.""" | |
createEmployee( | |
""" | |
The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. | |
""" | |
input: CreateEmployeeInput! | |
): CreateEmployeePayload | |
"""Updates a single `Employee` using its globally unique id and a patch.""" | |
updateEmployee( | |
""" | |
The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. | |
""" | |
input: UpdateEmployeeInput! | |
): UpdateEmployeePayload | |
"""Updates a single `Employee` using a unique key and a patch.""" | |
updateEmployeeByEmpNo( | |
""" | |
The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. | |
""" | |
input: UpdateEmployeeByEmpNoInput! | |
): UpdateEmployeePayload | |
"""Deletes a single `Employee` using its globally unique id.""" | |
deleteEmployee( | |
""" | |
The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. | |
""" | |
input: DeleteEmployeeInput! | |
): DeleteEmployeePayload | |
"""Deletes a single `Employee` using a unique key.""" | |
deleteEmployeeByEmpNo( | |
""" | |
The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. | |
""" | |
input: DeleteEmployeeByEmpNoInput! | |
): DeleteEmployeePayload | |
} | |
"""An object with a globally unique `ID`.""" | |
interface Node { | |
""" | |
A globally unique identifier. Can be used in various places throughout the system to identify this single value. | |
""" | |
nodeId: ID! | |
} | |
"""Information about pagination in a connection.""" | |
type PageInfo { | |
"""When paginating forwards, are there more items?""" | |
hasNextPage: Boolean! | |
"""When paginating backwards, are there more items?""" | |
hasPreviousPage: Boolean! | |
"""When paginating backwards, the cursor to continue.""" | |
startCursor: Cursor | |
"""When paginating forwards, the cursor to continue.""" | |
endCursor: Cursor | |
} | |
"""The root query type which gives access points into the data universe.""" | |
type Query implements Node { | |
""" | |
Exposes the root query type nested one level down. This is helpful for Relay 1 | |
which can only query top level fields if they are in a particular form. | |
""" | |
query: Query! | |
""" | |
The root query type must be a `Node` to work well with Relay 1 mutations. This just resolves to `query`. | |
""" | |
nodeId: ID! | |
"""Fetches an object given its globally unique `ID`.""" | |
node( | |
"""The globally unique `ID`.""" | |
nodeId: ID! | |
): Node | |
"""Reads and enables pagination through a set of `Employee`.""" | |
allEmployees( | |
"""Only read the first `n` values of the set.""" | |
first: Int | |
"""Only read the last `n` values of the set.""" | |
last: Int | |
""" | |
Skip the first `n` values from our `after` cursor, an alternative to cursor | |
based pagination. May not be used with `last`. | |
""" | |
offset: Int | |
"""Read all values in the set before (above) this cursor.""" | |
before: Cursor | |
"""Read all values in the set after (below) this cursor.""" | |
after: Cursor | |
"""The method to use when ordering `Employee`.""" | |
orderBy: [EmployeesOrderBy!] = [PRIMARY_KEY_ASC] | |
""" | |
A condition to be used in determining which values should be returned by the collection. | |
""" | |
condition: EmployeeCondition | |
): EmployeesConnection | |
employeeByEmpNo(empNo: Int!): Employee | |
"""Reads a single `Employee` using its globally unique `ID`.""" | |
employee( | |
"""The globally unique `ID` to be used in selecting a single `Employee`.""" | |
nodeId: ID! | |
): Employee | |
} | |
"""All input for the `updateEmployeeByEmpNo` mutation.""" | |
input UpdateEmployeeByEmpNoInput { | |
""" | |
An arbitrary string value with no semantic meaning. Will be included in the | |
payload verbatim. May be used to track mutations by the client. | |
""" | |
clientMutationId: String | |
""" | |
An object where the defined keys will be set on the `Employee` being updated. | |
""" | |
employeePatch: EmployeePatch! | |
empNo: Int! | |
} | |
"""All input for the `updateEmployee` mutation.""" | |
input UpdateEmployeeInput { | |
""" | |
An arbitrary string value with no semantic meaning. Will be included in the | |
payload verbatim. May be used to track mutations by the client. | |
""" | |
clientMutationId: String | |
""" | |
The globally unique `ID` which will identify a single `Employee` to be updated. | |
""" | |
nodeId: ID! | |
""" | |
An object where the defined keys will be set on the `Employee` being updated. | |
""" | |
employeePatch: EmployeePatch! | |
} | |
"""The output of our update `Employee` mutation.""" | |
type UpdateEmployeePayload { | |
""" | |
The exact same `clientMutationId` that was provided in the mutation input, | |
unchanged and unused. May be used by a client to track mutations. | |
""" | |
clientMutationId: String | |
"""The `Employee` that was updated by this mutation.""" | |
employee: Employee | |
""" | |
Our root query field type. Allows us to run any query from our mutation payload. | |
""" | |
query: Query | |
"""An edge for our `Employee`. May be used by Relay 1.""" | |
employeeEdge( | |
"""The method to use when ordering `Employee`.""" | |
orderBy: [EmployeesOrderBy!] = PRIMARY_KEY_ASC | |
): EmployeesEdge | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment