Skip to content

fix : validate goal target is positive number #499

@tmdeveloper007

Description

@tmdeveloper007

Summary of What Needs to be Done:
The goals route at src/app/api/goals/route.ts uses !body.target to check for missing target, but !body.target is false when body.target === 0. A goal with target: 0 would be accepted even though it's nonsensical.

Changes that Need to be Made:

  • File: src/app/api/goals/route.ts (line 116)
  • Change validation to explicitly check for positive number: typeof body.target !== number || body.target <= 0

Impact that it would Provide:

  • Prevents creation of invalid goals with target of 0
  • Ensures goals have meaningful target values

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions