Skip to content

[ADVANCED] Add Proper Validation for Task Status Update API #124

@ash1shkumar

Description

@ash1shkumar

🚀 Description

The task status update API currently allows invalid status values to be inserted into the database because validation is missing in one controller.

This may corrupt Kanban workflows and analytics logic.


📍Affected Files

  • backend/controllers/tasks.controller.js

Function:

updateTaskStatus

❌ Current Problem

The API updates task status directly:

.update({ status, position })

without validating accepted status values.

Invalid values like:

  • "random"
  • "done123"
  • null

can be stored in the database.


✅ Expected Solution

  • Add status validation before updating tasks
  • Reuse existing validation logic
  • Allow only supported statuses:
    • todo
    • in_progress
    • done

🎯 Expected Outcome

  • Consistent database state
  • Reliable Kanban board behavior
  • Cleaner analytics and filtering

🏷️ Expected Labels

level3 NSoC'26

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions