
- Created FastAPI application with CRUD operations for tasks - Implemented SQLAlchemy models with Task entity - Added Pydantic schemas for request/response validation - Set up Alembic for database migrations - Configured SQLite database with proper file structure - Added health check and root endpoints - Included comprehensive API documentation - Applied CORS middleware for development - Updated README with detailed setup and usage instructions - Applied code formatting with ruff linter
17 lines
589 B
Python
17 lines
589 B
Python
from datetime import datetime
|
|
from sqlalchemy import Column, Integer, String, Text, Boolean, DateTime
|
|
from app.db.base import Base
|
|
|
|
|
|
class Task(Base):
|
|
__tablename__ = "tasks"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
title = Column(String, nullable=False, index=True)
|
|
description = Column(Text, nullable=True)
|
|
completed = Column(Boolean, default=False, nullable=False)
|
|
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
|
updated_at = Column(
|
|
DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False
|
|
)
|