47 Capstone 7 – The Quiz Application: Part 1
In this capstone, you will:
- Read and write the quiz data from a PostgreSQL database asynchronously.
- Define SQL queries to create, retrieve, update, and delete its records.
- Chain multiple asynchronous computations to safely store a question and its answers
In this capstone, you’ll define an application’s data access layer to create and answer quizzes: you’ll implement its business logic and HTTP API at the end of the next unit. Your quiz application has the following requirements:
- It should read and write categories and a set of questions and answers assigned to them.
- Its users should pick a category, answer randomly selected questions about it, and receive a final score based on their performance.
Your application has access to a PostgreSQL database containing three tables called category, question, and answers: figure 47.1 shows their table structure.
Figure 47.1: Visualization of your database schema: primary keys are in bold, while foreign keys are linked to their reference. The entity-relationship diagram has been drawn using dbdiagram.io.

47.1 Download the base project
First, let’s speed things up by downloading a base project for you to use. In an empty directory of your choice, run the following git commands to download the remote branch:
$ git init $ git remote add daniela https://github.com/DanielaSfregola/get-programming-with-scala.git $ git fetch daniela $ git checkout -b my_lesson47 daniela/baseline_unit7_lesson47