
- Implemented user authentication with JWT tokens - Created product management endpoints - Added shopping cart functionality - Implemented order management system - Setup database models with SQLAlchemy - Created alembic migrations - Added health check endpoint generated with BackendIM... (backend.im)
15 lines
529 B
Python
15 lines
529 B
Python
from sqlalchemy import Column, Integer, ForeignKey
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from app.models.base import BaseModel
|
|
|
|
|
|
class CartItem(BaseModel):
|
|
__tablename__ = "cart_items"
|
|
|
|
user_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
|
product_id = Column(Integer, ForeignKey("products.id"), nullable=False)
|
|
quantity = Column(Integer, nullable=False, default=1)
|
|
|
|
user = relationship("User", back_populates="cart_items")
|
|
product = relationship("Product", back_populates="cart_items") |