This is a Next.js project bootstrapped with create-next-app
.
First, run the development server:
npm install
npm run dev
Node version: 14.15.1 NPM version: 8.14.0
No need for database this project stores data in-memory
Open http://localhost:3000/api/graphql with your browser to see the result. or Open https://studio.apollographql.com/sandbox/explorer add http://localhost:3000/api/graphql
-
Create a phase and get its ID
id:1
-
Create a task with phase ID & title example :
{phaseId: 1, title: "task 1"}
-
Query tasks and check the result:
{id:1, phaseId:1, done:false, title: "task 1"}
-
Query Phase to check it:
{id:1, title:"Phase 1", done: false, tasks:[{id:1, phaseId:1, done:false, title: task 1}]}
-
Confirm Task
id:1
=>done: true
if no previous task, if there are previous tasks, it checks if its confirmed -
Undo Task
id:5
checks if there is next tasks and undo them if they are done -
Phases are marked as done when all the tasks under that phase are marked as done
mutation CreatePhase($title: String!) {
createPhase(title: $title) {
id
title
done
tasks {
id
phaseId
done
title
}
}
}
query Phases {
phases {
id
title
done
tasks {
id
title
phaseId
done
}
}
}
mutation CreateTask($phaseId: Int!, $createTaskTitle: String!) {
createTask(phaseId: $phaseId, title: $createTaskTitle) {
id
title
done
phaseId
}
}
query Tasks {
tasks {
id
title
done
phaseId
}
}
mutation ConfirmTask($confirmTasksId: Int!) {
confirmTask(id: $confirmTasksId) {
id
title
done
phaseId
}
}
mutation UndoTask($undoTaskId: Int!) {
undoTask(id: $undoTaskId) {
id
title
done
phaseId
}
}