quran / quran/qf-api-docs

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

Open
#162 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
15
Forks
14
Avg merge
1d 6h
Merged PRs (30d)
16

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the documented POST /auth/v1/goals?mushafId= entry point and locate the goal-creation implementation behind it; no source file or test is named in the issue. Reproduce the two requests described, then add or update coverage so an active goal for the same user and category makes the second request return 409 Conflict.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.