
- 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
16 lines
662 B
Python
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") |