Automated Action 609e7fb237 Implement retail management and payment API with FastAPI
This API provides endpoints for:
- Product and inventory management
- Customer management
- Order processing
- Payment processing with Stripe integration
- User authentication

generated with BackendIM... (backend.im)
2025-05-12 12:00:19 +00:00

21 lines
856 B
Python

from sqlalchemy import Column, Integer, String, Float, Text, Boolean, DateTime
from sqlalchemy.orm import relationship
from sqlalchemy.sql import func
from app.db.base_class import Base
class Product(Base):
id = Column(Integer, primary_key=True, index=True)
name = Column(String, index=True)
description = Column(Text, nullable=True)
sku = Column(String, unique=True, index=True)
price = Column(Float, nullable=False)
image_url = Column(String, nullable=True)
is_active = Column(Boolean, default=True)
created_at = Column(DateTime(timezone=True), server_default=func.now())
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
# Relationships
inventory = relationship("Inventory", back_populates="product", uselist=False)
order_items = relationship("OrderItem", back_populates="product")