Skip to content

PUT /api/tasks/:id missing title validation #9

Description

@sbley

Problem

The POST /api/tasks handler validates that title is present, but the PUT /api/tasks/:id handler does not. A PUT request with no title will overwrite the existing title with undefined, setting the column to NULL — violating the NOT NULL constraint and returning a 500 error instead of a proper 400 Bad Request.

Recommendation

Add the same title presence check to the PUT handler before running the UPDATE query:

if (!title) {
  return res.status(400).json({ error: 'Title is required' });
}

Location: src/routes/tasks.js — PUT route handler (around line 70)
Severity: high

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions