
- 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)
18 lines
639 B
Python
18 lines
639 B
Python
from sqlalchemy import Column, String, Float, Integer, Text, Boolean
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from app.models.base import BaseModel
|
|
|
|
|
|
class Product(BaseModel):
|
|
__tablename__ = "products"
|
|
|
|
name = Column(String, index=True, nullable=False)
|
|
description = Column(Text, nullable=True)
|
|
price = Column(Float, nullable=False)
|
|
stock = Column(Integer, nullable=False, default=0)
|
|
image_url = Column(String, nullable=True)
|
|
is_active = Column(Boolean, default=True)
|
|
|
|
order_items = relationship("OrderItem", back_populates="product")
|
|
cart_items = relationship("CartItem", back_populates="product") |