
- Set up project structure with FastAPI framework - Implement database models using SQLAlchemy - Create Alembic migrations for database schema - Build CRUD endpoints for Items resource - Add health check endpoint - Include API documentation with Swagger and ReDoc - Update README with project documentation
16 lines
544 B
Python
16 lines
544 B
Python
from sqlalchemy import Column, Integer, String, Boolean, DateTime
|
|
from sqlalchemy.sql import func
|
|
|
|
from app.db.database import Base
|
|
|
|
|
|
class Item(Base):
|
|
__tablename__ = "items"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
name = Column(String, index=True)
|
|
description = Column(String)
|
|
price = Column(Integer) # Price in cents
|
|
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()) |