Skip to content

POST /v1/goals allows creating duplicate goals for the same category #162

Description

@2u841r

Bug: No uniqueness enforcement on goal creation

Environment: Pre-live (apis-prelive.quran.foundation)

Description

POST /auth/v1/goals?mushafId=<id> does not enforce uniqueness per user + category.
Sending a second POST with the same category returns a new id and creates a second
goal rather than returning a conflict error.

Steps to reproduce

  1. POST /auth/v1/goals?mushafId=5 with body:
    { "type": "QURAN_PAGES", "amount": 10, "category": "QURAN" }
  2. Note the returned id
  3. POST /auth/v1/goals?mushafId=5 again with the same or different amount
  4. A different id is returned — both goals now exist simultaneously

Expected

Second POST should return 409 Conflict if an active goal already exists
for that user and category.

Actual

A duplicate goal is created silently. Each POST succeeds with a new id.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions