Skip to content

Instantly share code, notes, and snippets.

View a7v8x's full-sized avatar
🎮
maximizing reward function in the game of life

David Mraz a7v8x

🎮
maximizing reward function in the game of life
View GitHub Profile
mutation createTask {
createTask(input: {name: "New task", taskPriority: "10"}) {
id
taskPriority
progress
completed
}
}
{
"data": {
"tasks": [
{
"id": "6",
"progress": 55.5,
"name": "Test task",
"completed": false,
"taskPriority": 1
}
{
"data": {
"tasks": [
{
"id": "6",
"progress": 55.5,
"name": "Test task",
"completed": false,
"taskPriority": 1
}
input CreateTaskInput {
name: String!
completed: Boolean = false
state: TaskStateEnum
taskPriority: Int = 1
progress: Float = 0
dueDate: DateTime
}
"""CreateTaskPayload type definition"""
type CreateTaskPayload {
{
"data": {
"tasks": [
{
"id": "7e68efd1",
"name": "Test task",
"completed": false,
"state": "IN_PROGRESS",
"progress": 55.5,
"taskPriority": 1
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(),
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);
query introspectTaskStateEnumType {
__type(name: "TaskStateEnum") {
enumValues {
name
}
}
}
mutation createTask($input: CreateTaskInput!) {
createTask(input: $input) {
task {
id
name
}
}
}
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",