Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Repository files navigation

Smart Cart Server

Server application created for the Smart Cart TUM project during the Introduction to CPS course.

Requirements

Server Structure

Component Diagram

Functionality

Everything is stored in the corresponding collection/document in the database.
Every request is done with the use of query parameters: cartId and itemId.

  • Store the items in the cart.
  • Update the items quantity in the cart. Increase the quantity for the POST request and decrease the quantity for the DELETE request, only if the item already exists.
  • Delete the item from the cart if the quantity of the item is one.
  • Retrieve the list of all items in the cart.

Database Setup

You should perform the following steps in your Firebase instance:

  • Create an items collection, it will store the available items, this collection won't be changed by the server. Must be filled in manually or create a new class/method to do it automatically.
  • Create a registered-items collection, it will store IDs of the existing carts, this collection won't be changed by the server. Must be filled in manually or create a new class/method to do it automatically.
  • Create a carts collection, it will store the cart document, this document will include the collections of the carts items that actually contains the items documents. Updated by the server.

Server Setup

To run the server perform the following steps:

  • Create a file named serviceAccount.json in the /src/main/resources/ folder that will contain Firebase admin credentials, see Admin SDK. It is required to access the database.
  • Connect to your ngrok account, follow the official setup.
  • Simply run the deploy.sh script, read the comments to understand what it does.
  • To clean up run the cleanup.sh script, read the comments to understand what it does.

About

Smart Cart Server Application

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages