For our final project we will be creating a REST API backend for our dosa restaurant. Your project will need to use an SQLite database and FastAPI to provide access to three objects: customers, items, and orders. example_orders.json file from the midterm project.
You will be making an API that supports CRUD (create, read, update, delete) for your three objects. Your must write a script named init_db.py that will initialize an empty database using relational constraints (primary keys and foreign keys) from the example_orders.json file we used in the midterm project. Your SQLite database should be in a file named db.sqlite. Your FastAPI backend must read and write from db.sqlite and should be called main.py.
You will need to create the following endpoints:
Method | Path | Description |
---|---|---|
POST |
/customers |
creates a customer in the DB given a JSON representation |
GET |
/customers/{id} |
retrieves a JSON representation of a customer in the DB |
DELETE |
/customers/{id} |
deletes a customer in the DB |
PUT |
/customers/{id} |
updates a customer in the DB given a JSON representation |
POST |
/items |
creates an item in the DB given a JSON representation |
GET |
/items/{id} |
retrieves a JSON representation of an item in the DB |
DELETE |
/items/{id} |
deletes an item in the DB |
PUT |
/items/{id} |
updates an item in the DB given a JSON representation |
POST |
/orders |
creates an order in the DB given a JSON representation |
GET |
/orders/{id} |
retrieves a JSON representation of an order in the DB |
DELETE |
/orders/{id} |
deletes an order in the DB |
PUT |
/orders/{id} |
updates an order in the DB given a JSON representation |
The following rubric will be used to grade your project:
Category | Points Available | Description |
---|---|---|
Version Control |
5 |
Your project should be hosted in a git repository on GitHub. Private repositories are fine, just make sure that rxt1077 is invited as a collaborator. Your repository should have a commit log with at least three commits demonstrating your progress in working on this project. |
Python Conventions |
5 |
Your project should follow Python conventions for programming style and use idiomatic Python approaches to solving problems. |
Documentation |
5 |
Your project should include a README.md file in the root of the project explaining what it does, how it is designed, and how to use it. |
Functionality |
10 |
Your project should implement the core functionality as described in the above. |