Automated Action 4458f5320b Build e-commerce API with FastAPI and SQLite
- 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)
2025-05-13 22:46:42 +00:00

17 lines
619 B
Python

from sqlalchemy import Boolean, Column, String
from sqlalchemy.orm import relationship
from app.models.base import BaseModel
class User(BaseModel):
__tablename__ = "users"
email = Column(String, unique=True, index=True, nullable=False)
password = Column(String, nullable=False)
full_name = Column(String, nullable=True)
is_active = Column(Boolean, default=True)
is_admin = Column(Boolean, default=False)
orders = relationship("Order", back_populates="user", cascade="all, delete-orphan")
cart_items = relationship("CartItem", back_populates="user", cascade="all, delete-orphan")