Automated Action d2b80dacc4 Implement Shopping Cart and Checkout API
- Set up FastAPI application structure
- Create database models for User, Product, Cart, CartItem, Order, and OrderItem
- Set up Alembic for database migrations
- Create Pydantic schemas for request/response models
- Implement API endpoints for products, cart operations, and checkout process
- Add health endpoint
- Update README with project details and documentation
2025-05-18 00:00:02 +00:00

16 lines
662 B
Python

from sqlalchemy import Column, String, Boolean
from sqlalchemy.orm import relationship
from app.models.base import BaseModel, TimestampMixin
class User(BaseModel, TimestampMixin):
"""User model for authentication and ownership of carts/orders."""
email = Column(String, unique=True, index=True, nullable=False)
hashed_password = Column(String, nullable=False)
full_name = Column(String, index=True)
is_active = Column(Boolean, default=True)
# Relationships
carts = relationship("Cart", back_populates="user", cascade="all, delete-orphan")
orders = relationship("Order", back_populates="user", cascade="all, delete-orphan")