Skip to content

Stage 6A — Tournament Schemas, Admin Wizard & Registration #9

Description

@KineticTactic

What this is: The entry point for the knockout tournament system. No match engine logic — purely the data layer and the admin creation UI.

Starts after: Stage 4 complete.

Owner: Full-stack developer comfortable with multi-step forms and Mongoose.

Tasks

  1. Verify tournament schemas against real usage (schemas were created in Stage 1; this stage validates them with actual documents)

    • Create test Contest documents with format: 'bracket', roomFormat: 'blitz' and roomFormat: 'arena'.
    • Verify ContestRound and ContestStanding work correctly for bracket structure.
    • Verify ContestRoom tournament context fields (nullable roundId, bracket position) do not affect standalone room queries. Run Stage 3 + 4 tests to confirm.
  2. Tournament Creation Wizard (/internal/contests/admin/new-contest)

    • Multi-step form:
      • Step 1: name, description. Format is fixed: bracket. Room format: blitz or arena. Team size: 1 (1v1) or 3 (3v3).
      • Step 2: registration settings (open/closed, deadline, max participants).
      • Step 3: match preset selection.
      • Step 4: bracket settings (third-place playoff toggle, seeding method: CF rating or manual).
      • Step 5: preview & confirm.
    • Server-side validation on every step.
    • On submission: create Contest document with format: 'bracket', status: 'draft', roomFormat, teamSize.
  3. Registration flow

    • POST /api/contests/:id/register — player or team registers.
    • Validates deadline, max participants.
    • Triggers solved:<cfHandle> prefetch BullMQ job for all registering members.
    • Appends to Contest.registrations.
  4. Preset management (/internal/contests/admin/presets)

    • CRUD for ContestPreset. Archive (not delete). Archived presets are not shown in the creation wizard but are preserved in DB for historical reference.
  5. Contest status transitions

    • draft → registration (admin publishes).
    • registration → active (admin starts or scheduled auto-start).
    • active → completed (all bracket rounds done).

Testing Gate

  • Admin creates a knockout tournament (blitz rooms) via the wizard. Contest document in MongoDB has the correct shape: format: 'bracket', roomFormat: 'blitz', registrations: [], status: 'draft'.
  • Admin creates a knockout tournament with arena rooms. Same shape, roomFormat: 'arena'.
  • 4 players register. Contest.registrations updated. solved:* keys populated for all 4 CF handles.
  • Registering after deadline → rejected.
  • Preset archived → no longer appears in the wizard. A historical room referencing it still resolves correctly.

Handoff Contract

  • All testing gate items pass.
  • Contest documents for knockout format exist in the dev DB as test fixtures.
  • Stage 3 + 4 regression still passes — tournament context fields are inert on standalone rooms.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions