Skip to content

Your Online Shopping List Part 1 Backend

Kaisinel edited this page Apr 25, 2021 · 1 revision

Intro

We all go shopping from time to time. However, we sometimes forget what actually needs buying. This results in buying not enough or too much stuff, sometimes not even necessary stuff. There are many different ways of creating shopping lists and a ton of apps that do it for you, but this time, we will create one ourselves. It is a good exercise because it helps us understand the following:

  • How to save data?
  • How to have data accessible throughout different devices?
  • What is HTTP and how does that help work with data?
  • How to securely save our work (code)?

This is a two-part problem, where we first get the backend part (web service) figured and then move on to the frontend (react).

Requirements

Functional

1. Shopping List model

Create models for: a shopping item and a shopping list:

  • Item should have price (total), name, amount.
  • Shopping list should have many items, shop name and address, total money spent, id.

2. New Shopping List

Create an endpoint that accepts a new shopping list and saves it.

3. Update Shopping List

Create an endpoint that accepts a shopping item with a reference to a shopping list and adds it to that list. Make sure duplicate items are not added.

4. Get a shopping list

Create an endpoint to get a shopping list by id

5. Delete a shopping list

Create an endpoint to get a shopping list by id.

6. Wipe shopping lists

Create an endpoint that deletes all shopping lists.

7. Get all shopping lists

Create an endpoint to get all the existing shopping lists.

8. Merge shopping items

In case a shopping item is a duplicate, merge the amounts with the existing item.

9. All possible operations with a shopping list should be listed on a website

Non-Functional

1. Sending malformed shopping list

If an invalid body of a shopping list is sent- return bad request status code.

2. Globally accessible

A shopping list must be accessible from outside of your machine.

3. Prevent duplicate shopping lists

You should not be able to save duplicate shopping lists. If a shopping list of the same id is being saved- prevent that by returning a conflict status code.

4. Getting a non-existing shopping list

If a shopping list does not exist, a not found status code should be returned.

Clone this wiki locally