Automated Action 0e00013b7f Implement product catalog API with CRUD operations
- Created FastAPI application with product catalog functionality
- Implemented CRUD operations for products
- Added SQLAlchemy models and Pydantic schemas
- Set up SQLite database with Alembic migrations
- Added health check endpoint
- Updated README with project documentation

generated with BackendIM... (backend.im)
2025-05-13 17:21:00 +00:00

16 lines
717 B
Python

from sqlalchemy import Column, Integer, String, Float, Text, DateTime
from sqlalchemy.sql import func
from app.db.database import Base
class Product(Base):
__tablename__ = "products"
id = Column(Integer, primary_key=True, index=True)
name = Column(String(100), nullable=False, index=True)
description = Column(Text, nullable=True)
price = Column(Float, nullable=False)
sku = Column(String(50), unique=True, index=True)
stock = Column(Integer, default=0)
category = Column(String(50), nullable=True, index=True)
created_at = Column(DateTime(timezone=True), server_default=func.now())
updated_at = Column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now())