[BUG]: No Validation room type when creating a debate room

Open Beginner friendly
#492 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
api, backend

Research direction

Start by running the DebateAI backend and reproducing the issue with the provided POST /rooms curl request. Find the backend handler for POST /rooms and add validation so only public, private, and invite are accepted. Done means an unsupported type like banana returns 400 Bad Request with the stated error and no room is created.

Written by the indexing model from the issue text.

Description

bug
Bug Description

he POST /rooms endpoint accepts any non-empty value for the room type. Although the supported room types are public, private, and invite, unsupported values such as "banana" are accepted and stored successfully.
This allows invalid room data to enter the application and may cause unexpected behavior in room browsing, filtering, matchmaking, and access-control logic.

The backend should validate the supplied room type against the supported values and return 400 Bad Request when the value is invalid. This fix only requires backend validation and does not require a database schema change.

Steps to Reproduce
  1. Start the DebateAI backend server.

  2. Sign in and obtain a valid access token.

  3. Open Git Bash and define the API URL and token:
    api="http://localhost:1313"
    token="PASTE_ACCESS_TOKEN_HERE"

  4. Send a room-creation request with an unsupported type:
    curl.exe -i -X POST "$api/rooms"
    -H "Authorization: Bearer $token"
    -H "Content-Type: application/json"
    --data '{"type":"banana"}'

  5. Observe that the backend returns 200 OK and creates the room:
    HTTP/1.1 200 OK
    {
    "id": "882822",
    "type": "banana"
    }

Actual Behavior
The backend accepts the unsupported room type and creates a room with "type": "banana".

Expected Behavior
The backend should reject unsupported room types and return:
400 Bad Request
{
"error": "Invalid room type"
}

Logs and Screenshots
Image Image Image
Environment Details

No response

Impact

High - Major feature is broken

Code of Conduct
  • I have joined the Discord server and will post updates there
  • I have searched existing issues to avoid duplicates
Dominant language
TypeScript
Stars
88
Forks
207
Avg merge
2d 12h
Merged PRs (30d)
29

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.

More from AOSSIE-Org/DebateAI

All issues in AOSSIE-Org/DebateAI

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.