
Create a complete e-commerce application with the following features: - User authentication and authorization - Product and category management - Shopping cart functionality - Order processing - Database migrations with Alembic - Comprehensive documentation
16 lines
556 B
Python
16 lines
556 B
Python
from datetime import datetime
|
|
from sqlalchemy import Column, String, DateTime, Text
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from app.db.base_class import Base
|
|
|
|
|
|
class Category(Base):
|
|
id = Column(String, primary_key=True, index=True)
|
|
name = Column(String, index=True)
|
|
description = Column(Text, nullable=True)
|
|
created_at = Column(DateTime, default=datetime.utcnow)
|
|
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
# Relationships
|
|
products = relationship("Product", back_populates="category") |