Automated Action f19a6fea04 Build complete Personal Task Management API with FastAPI
- Implemented user authentication with JWT tokens
- Created comprehensive task management with CRUD operations
- Added category system for task organization
- Set up SQLite database with SQLAlchemy ORM
- Configured Alembic for database migrations
- Added API documentation with OpenAPI/Swagger
- Implemented proper authorization and user scoping
- Created health check and root endpoints
- Updated README with complete documentation
2025-06-21 16:16:40 +00:00

18 lines
745 B
Python

from sqlalchemy import Column, Integer, String, DateTime, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.sql import func
from app.db.base import Base
class Category(Base):
__tablename__ = "categories"
id = Column(Integer, primary_key=True, index=True)
name = Column(String, nullable=False)
description = Column(String, nullable=True)
color = Column(String, nullable=True)
owner_id = Column(Integer, ForeignKey("users.id"))
created_at = Column(DateTime(timezone=True), server_default=func.now())
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
owner = relationship("User", back_populates="categories")
tasks = relationship("Task", back_populates="category")