https://github.com/manangandhi1810/gdsc-web-dev-task-2
Web Development Task 2 for GDSC Recruitment
https://github.com/manangandhi1810/gdsc-web-dev-task-2
Last synced: 4 months ago
JSON representation
Web Development Task 2 for GDSC Recruitment
- Host: GitHub
- URL: https://github.com/manangandhi1810/gdsc-web-dev-task-2
- Owner: MananGandhi1810
- Created: 2023-09-25T03:54:19.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-26T12:36:07.000Z (almost 2 years ago)
- Last Synced: 2025-01-17T23:28:16.531Z (6 months ago)
- Language: Python
- Size: 646 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GDSC Web Dev Task (Backend Development)
This GitHub repository is my (Manan Gandhi's) submission for the GDSC Web Dev Task 2.
The goal of the task was to develop an Inventory Management System. I have accomplished this task using the Flask framework in Python.## Technologies Used
- Python
- Flask
- Flask-PyMongo
- MongoDB (Instance hosted on MongoDB Atlas)
- aspose-pdf (for generating PDF files)
- Postman (for testing the API)
- MongoDB Compass (for viewing the database)## Item class and routes
### Attributes
- id: Unique identifier for the item
- name: Name of the item
- stock: Number of items in stock
- price: Price of the item### Routes
- GET /get_all_items: Returns a list of all items in the inventory
- Parameters - None
- GET /get_item?id={item_id}: Returns the item with the given id
- Parameters - id (int)
- POST /add_item: Adds a new item to the inventory
- Parameters - name (str), stock (int), price (float)
- PUT /update_item: Updates the item with the given id
- Parameters - id (int), name (str), stock (int), price (float) (at least one of these parameters must be provided)
- DELETE /delete_item?id={item_id}: Deletes the item with the given id
- Parameters - id (int)
## Invoice class and routes
### Attributes
- id: Unique identifier for the invoice
- items: List of items in the invoice
- subtotal: Total price of the invoice before discount and tax
- taxes_percent: Percentage of taxes to be applied to the invoice
- tax: Total amount of taxes to be applied to the invoice
- discount_percent: Percentage of discount to be applied to the invoice
- discount: Total amount of discount to be applied to the invoice
- total: Total price of the invoice after discount and tax## Methods
- generate_pdf: Generates a PDF file of the invoice and saves it in the `invoices` folder, runs every time an invoice is created or updated (example: [invoice1.pdf](https://github.com/MananGandhi1810/GDSC-Web-Dev-Task-2/blob/main/invoices/invoice1.pdf))### Routes
- GET /get_all_invoices: Returns a list of all invoices
- Parameters - None
- GET /get_invoice?id={invoice_id}: Returns the invoice with the given id
- Parameters - id (int)
- GET /get_invoice_pdf?id={invoice_id}: Returns the invoice with the given id in PDF format (example: [invoice1.pdf](https://github.com/MananGandhi1810/GDSC-Web-Dev-Task-2/blob/main/invoices/invoice1.pdf))
- Parameters - id (int)
- POST /new_invoice: Adds a new invoice
- Parameters - items (list of dicts), taxes_percent (float), discount_percent (float)
- PUT /update_invoice: Updates the invoice with the given id
- Parameters - id (int), items (list of dicts), taxes_percent (float), discount_percent (float) (at least one of these parameters must be provided)
- DELETE /delete_invoice?id={invoice_id}: Deletes the invoice with the given id
- Parameters - id (int)
