
- Set up FastAPI project structure with best practices - Implemented SQLAlchemy models with SQLite database - Added Alembic for database migrations - Created CRUD API endpoints for items - Added health check endpoint - Updated documentation generated with BackendIM... (backend.im)
11 lines
460 B
Python
11 lines
460 B
Python
from datetime import datetime
|
|
from sqlalchemy import Column, Integer, DateTime
|
|
from app.core.database import Base
|
|
|
|
class TimestampModel(Base):
|
|
"""Base model with created and updated timestamps."""
|
|
__abstract__ = True
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
|
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False) |