Skip to content

MRmarioruci/inventoryService

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inventory Service

An inventory service use case with some basic endpoints and logic. Read UseCase.pdf for more details

Goal

Understanding and translating product needs. Considering performance and scalability.

Deliverables

1. /server
Inside this directory you fill find the project main code and logic.

2. /db
Inside this directory you will find the init.sql file which is the database schema of the project

Setup

Clone the repo

git clone https://github.com/MRmarioruci/inventoryService.git

Navigate inside the project directory

cd inventoryService

Build

docker-compose up

The server will restart a few times until the database has completed all operations and it connects succesfully

Endpoints / Testing

These steps follow the test case specified in the pdf file.

For testing ease I have added a phpmyadmin container so you can access the database quickly and easily

- Go to http://localhost:8080
- Username: user , Password: 1234567890

Table User

I have already added 3 users so that you can test quickly.
admin, counter 1 and counter 2.

Table ProductCategories

I have already added 2 categories, Food and Furniture
  • Endpoint to add Products.

    • Url: http://localhost:5000/addProduct

    • Payload:

       // Replace values accordingly
       {
       	"username": "admin",
       	"name": "AABB",
       	"price": 1,
       	"categories": [
       		2
       	],
       	"subproducts": [
       		{
       			"title": "A",
       			"quantity": 2
       		},
       		{
       			"title": "B",
       			"quantity": 1
       		}
       	]
       }
       {
       	"username": "admin",
       	"name": "CC",
       	"price": 2,
       	"categories": [
       		2
       	],
       	"subproducts": [
       		{
       			"title": "C",
       			"quantity": 1
       		}
       	]
       }
       {
       	"username": "admin",
       	"name": "DD",
       	"price": 3,
       	"categories": [
       		1
       	],
       	"subproducts": [
       		{
       			"title": "D",
       			"quantity": 1
       		}
       	]
       }
  • Endpoint to build a CountPlan with a weekly schedule.

    • Url: http://localhost:5000/addCountPlan
    • Payload:
       // Replace values accordingly
       /* Weekly Plan */
       {
       	"username": "admin",
       	"name": "Weekly Plan",
       	"repetition_type": "weekly",
       	"repetition_interval": null,
       	"day_of_week": 2,
       	"start_time": "16:00:00",
       	"start_date": "2023-05-27"
       }
  • Endpoint to build a CountPlan with a schedule of every 2nd Monday monthly (optional).

    • Url: http://localhost:5000/addCountPlan
    • Payload:
       // Replace values accordingly
       /* Monthly Plan */
       {
       	"username": "admin",
       	"name": "Monthly Plan",
       	"repetition_type": "monthly",
       	"repetition_interval": 2,
       	"day_of_week": 1,
       	"start_time": "09:30:00",
       	"start_date": "2023-05-27"
       }
  • EXTRA Endpoint to build a CountPlan with a interval schedule. E.g every 10 days.

    • Url: http://localhost:5000/addCountPlan
    • Payload:
       // Replace values accordingly
       /* Interval Plan */
       {
       	"username": "admin",
       	"name": "Interval Plan",
       	"repetition_type": "interval",
       	"repetition_interval": 10,
       	"day_of_week": null,
       	"start_time": "14:15:00",
       	"start_date": "2023-05-27"
       }
  • Endpoint to check the current CountPlan and start CountExecution if necessary based on the schedule.

  • Endpoint to add UserProductCounts to CountExecution (allowed for admin and counter roles). (Make sure to go through phpmyadmin and get the relative barcodes. Simulates scanning a product)

  • Endpoint to end a CountExecution by changing its status to "end" (no more UserProductCounts can be added).

  • Calculate the pricing per Product based on the counted quantity in a CountExecution.

  • Calculate the total pricing of all Products based on the counted quantity in a CountExecution.

  • Calculate the pricing of Products by category in a CountExecution.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published