This assignment involves creating the backend for a Todo list application. The provided repository serves as a starting point, and your task is to add several new features. It includes a Vapor server and a small GraphQL API for managing todo list items, all supported by a PostgreSQL database.
You will be invited to a private fork of this repo. Please create a branch, complete the objectives below, and add a document at the repo root explaining what you've done. Feel free to list any assumptions, reasoning, or architecture in that document. When you're finished, create a pull request.
If you would like to avoid showing this work publicly, disable "Include private contributions on my profile" under "Contributions" in your profile settings.
It is recommended that you complete this using a Linux or MacOS environment. While you can use any development environment you like, XCode (MacOS only) or VSCode using the Swift extension generally have the best Swift support.
If you only have access to a Windows environment, you can use a VSCode Dev Container to complete the assignment. To get set up, install the Dev Containers VSCode Extension, go to the
Remote Explorer
menu, and clickStart in Dev Container
. This will start up a Docker image with the Swift toolchain and a running database.
- Ensure you have Docker installed
- Clone this repository
- Install a Swift toolchain (skip if using VSCode Dev Container)
- Start the database (skip if using VSCode Dev Container):
docker compose up db -d
- Build the package:
swift build
- Set up the database:
swift run App migrate
- Run the server:
swift run App serve --hostname 0.0.0.0 --port 8080
- Visit the GraphiQL page: http://localhost:8080/graphql
- Allow Todo items to be completed
- Completion and uncompletion state should be controlled by separate mutations (not
updateTodo
) - Newly created items should always be uncompleted
- The
todos
query should allow filtering for completed or uncompleted items
- Completion and uncompletion state should be controlled by separate mutations (not
- Add pagination to the
todos
query- Include a "page number" and a "number of items per page" arguments
- Add a query that returns the total number of todo items
- Add a
TodoList
type that collects multiple Todo items- Todo lists should be able to be created, queried, updated, and deleted
- All Todo items should belong to a list
- Todo items should only belong to one list at a time, but may be moved from list to list
- Add the ability to get all todo items for a given list through a GraphQL object traversal