Skip to content

Add due_date field to Task #2

Description

@Navashub

Description

Tasks need a deadline. Add an optional due_date field so users can set when a task should be completed.

What to do

  • Add a due_date column to the Task model in models.py
    • Type: DateTime, nullable, no default
  • Add due_date as an optional field to TaskCreate and TaskUpdate schemas
    • Accept it as an ISO 8601 string: "2025-12-31T18:00:00"
    • Use Optional[datetime] = None
  • Include due_date in the TaskResponse schema

Acceptance Criteria

  • POST /tasks/ accepts an optional due_date
  • GET /tasks/ returns due_date (or null if not set) for every task
  • Existing tasks without a due_date still work fine

Hints

  • Import datetime from Python's standard library
  • In Pydantic v2, use Optional[datetime] = None
  • In SQLAlchemy, use Column(DateTime, nullable=True)

Difficulty

🟢 Beginner — Good First Issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions