This document serves as the technical documentation for the Storefront project. It provides an overview of the features implemented, along with details of the files changed and links to related commits. This documentation is designed to help track the progress of the project and serve as a reference for future development.
The Storefront project is a Django-based e-commerce platform that provides APIs for managing products, orders, customers, and more. It uses Django REST Framework (DRF) for building APIs and integrates with third-party libraries like Djoser for authentication.
Description:
The Orders API allows customers to place orders, view their order history, and manage order items.
Key Changes:
- Added
Order
andOrderItem
models instore/models.py
. - Created serializers for orders:
- Implemented order creation logic in
CreateOrderSerializer.save()
:- Handles cart-to-order conversion.
- Deletes the cart after order creation.
- Added permissions for canceling orders in
store/migrations/0011_alter_order_options.py
.
Files Changed:
Related Commits:
Description:
The Cart Management feature allows customers to add, update, and remove items from their shopping cart.
Key Changes:
- Added
Cart
andCartItem
models instore/models.py
. - Created serializers for cart operations:
- Implemented logic for adding items to the cart in
AddCartItemSerializer.save()
.
Files Changed:
Related Commits:
Description:
The Product Management feature provides APIs for listing, creating, updating, and deleting products.
Key Changes:
- Added
Product
andCollection
models instore/models.py
. - Created
ProductSerializer
instore/serializers.py
. - Implemented tax calculation logic in
ProductSerializer.calculate_tax()
.
Files Changed:
Related Commits:
Description:
The Customer Management feature allows managing customer profiles and their associated data.
Key Changes:
- Added
Customer
model instore/models.py
. - Created
CustomerSerializer
instore/serializers.py
. - Linked customers to users via a
OneToOneField
.
Files Changed:
Related Commits:
Description:
Integrated authentication and authorization using Djoser and JWT.
Key Changes:
- Configured
SIMPLE_JWT
instorefront/settings.py
. - Customized Djoser serializers for user creation and management.
Files Changed:
Related Commits:
Description:
The Reviews API allows customers to leave reviews for products.
Key Changes:
- Added
Review
model instore/models.py
. - Created
ReviewSerializer
instore/serializers.py
. - Implemented review creation logic in
ReviewSerializer.create()
.
Files Changed:
Related Commits:
Description:
Integrated Django Debug Toolbar for performance monitoring and debugging.
Key Changes:
- Added
debug_toolbar
toINSTALLED_APPS
instorefront/settings.py
. - Configured middleware and URLs for Debug Toolbar.
Files Changed:
Related Commits:
The database schema includes the following key models:
Product
Collection
Customer
Order
OrderItem
Cart
CartItem
Review
Refer to the migrations folder for detailed schema changes: store/migrations/
.
Here are some of the key API endpoints implemented:
GET /store/products/
- List all products.POST /store/products/
- Create a new product.
POST /store/orders/
- Create a new order.GET /store/orders/
- List all orders for the authenticated user.
POST /store/cart/items/
- Add an item to the cart.PATCH /store/cart/items/<id>/
- Update the quantity of a cart item.
POST /store/products/<id>/reviews/
- Add a review for a product.
This documentation will be updated as new features are implemented.