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
| mutation createTask { | |
| createTask(input: {name: "New task", taskPriority: "10"}) { | |
| id | |
| taskPriority | |
| progress | |
| completed | |
| } | |
| } |
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
| { | |
| "data": { | |
| "tasks": [ | |
| { | |
| "id": "6", | |
| "progress": 55.5, | |
| "name": "Test task", | |
| "completed": false, | |
| "taskPriority": 1 | |
| } |
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
| { | |
| "data": { | |
| "tasks": [ | |
| { | |
| "id": "6", | |
| "progress": 55.5, | |
| "name": "Test task", | |
| "completed": false, | |
| "taskPriority": 1 | |
| } |
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
| input CreateTaskInput { | |
| name: String! | |
| completed: Boolean = false | |
| state: TaskStateEnum | |
| taskPriority: Int = 1 | |
| progress: Float = 0 | |
| dueDate: DateTime | |
| } | |
| """CreateTaskPayload type definition""" | |
| type CreateTaskPayload { |
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
| { | |
| "data": { | |
| "tasks": [ | |
| { | |
| "id": "7e68efd1", | |
| "name": "Test task", | |
| "completed": false, | |
| "state": "IN_PROGRESS", | |
| "progress": 55.5, | |
| "taskPriority": 1 |
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
| import { | |
| GraphQLList, | |
| GraphQLNonNull, | |
| } from 'graphql'; | |
| import { getTasks } from '../../operations/tasks-operations'; | |
| import Task from './TaskType'; | |
| const TaskQueries = { | |
| tasks: { | |
| type: new GraphQLNonNull(new GraphQLList(Task)), | |
| resolve: () => getTasks(), |
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
| import genId from "../lib/gen-id"; | |
| import tasks from "../db/tasks-db"; | |
| export const createTask = (input) => { | |
| const newTask = { | |
| id: genId(), | |
| ...input, | |
| createdAt: new Date().toISOString(), | |
| updatedAt: new Date().toISOString(), | |
| }; | |
| tasks.unshift(newTask); |
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
| query introspectTaskStateEnumType { | |
| __type(name: "TaskStateEnum") { | |
| enumValues { | |
| name | |
| } | |
| } | |
| } |
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
| mutation createTask($input: CreateTaskInput!) { | |
| createTask(input: $input) { | |
| task { | |
| id | |
| name | |
| } | |
| } | |
| } |
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
| let tasks = [ | |
| { | |
| id: '7e68efd1', | |
| name: 'Test task', | |
| completed: 0.0, | |
| createdAt: '2017-10-06T14:54:54+00:00', | |
| updatedAt: '2017-10-06T14:54:54+00:00', | |
| taskPriority: 1, | |
| progress: 55.5, | |
| state: "badstate", |