Welcome to the Pinecone Advocate GraphQL Challenge! 🌟
In this challenge, you will:
- 🛠️ Learn how to write GraphQL queries and mutations
- 🧪 Test your code using Jest for unit tests
This guide will walk you through:
- ⚙️ Setting up your project
- 🖋️ Implementing GraphQL operations
- 🏃♂️ Running commands to test your solution
Let's dive in and make learning GraphQL fun and exciting! 😎
Here’s how to get started with the project:
-
Install Dependencies:
If you're using Yarn:
yarn install
Or, if you prefer npm:
npm install
-
Add your MongoDB Connection URL to .env File:
MONGODB_URL=YOUR_MONGODB_URL
- Once you've added your MongoDB connection string, start the project. If the connection is successful, you’ll see connection successful in the console. If there’s an issue, it will show connection Failed.
In this challenge, you'll need to implement the following GraphQL operations:
-
addTask
:-
This mutation creates a new todo task.
-
Required fields:
taskName
(String) => requireddescription
(String) => required ( must be at least 10 characters long )isDone
(Boolean) => default tofalse
priority
(Int) => required (values 1-5)tags
(Array of Strings) => optional, allows categorizationcreatedAt
(Date)updatedAt
(Date)_id
(MongoDB Object Id)
-
-
updateTask
:- This mutation updates an existing task's details using its
taskId
. - Fields to update:
taskName
(String)description
(String)priority
(Int) => validate within range 1-5isDone
(Boolean)tags
(Array of Strings) => append or remove tags
- This mutation updates an existing task's details using its
-
getDoneTasksLists
:- This query retrieves all tasks that have been marked as done.
-
searchTasks
:- Accepts searchTerm (String): performs a case-insensitive match.
- Supports advanced filtering options: - priority (Int) - isDone (Boolean) - createdBefore (Date) - createdAfter (Date)
-
getAllTasks
:
Here’s how to run the project after implementing the GraphQL operations:
Start the Project:
To start the development server, run:
yarn dev
- Then open Apollo Studio Sandbox and add your local GraphQL endpoint (e.g.,
http://localhost:3000/api/graphql
) to start testing your queries and mutations.
Run Tests:
To run your Jest tests and ensure everything works as expected, use:
yarn test
Good luck on the challenge! 🍀
Don't forget to read the PDF file for instructions on how to submit your challenge.
We hope you do great, and we look forward to seeing you in the final interview! 🎉