Skip to content

Add ContestRequest model for Contest Creator rights request workflow#1

Open
GauriGupta21 wants to merge 1 commit into
mainfrom
feature/contest-request-model
Open

Add ContestRequest model for Contest Creator rights request workflow#1
GauriGupta21 wants to merge 1 commit into
mainfrom
feature/contest-request-model

Conversation

@GauriGupta21

Copy link
Copy Markdown
Collaborator

What this adds

A new ContestRequest model representing a user's request for Contest Creator rights — this is a permission request, not a contest itself.

Why this design

Initially I migrated the old wikicontest backend's ContestRequest model, which duplicated almost all Contest fields (name, dates, scoring, categories, jury members, etc.) via a shared mixin.

After confirming the actual product workflow with the team, we agreed this was unnecessary:

  • Requesting Contest Creator rights only needs a reason + Wikimedia edit count (300+ eligibility) + review status.
  • Full contest details are only collected later, through a separate Create Contest form, once rights are granted.
  • Keeping ContestRequest minimal avoids duplicating Contest's schema and keeps the two concerns (permission vs. contest) properly decoupled.

Fields

  • id
  • user_id (FK → users.id — requester)
  • reason (required)
  • edit_count (cached Wikimedia edit count at request time)
  • status (pending / approved / rejected, default 'pending')
  • reviewed_by (FK → users.id — superadmin who reviewed)
  • reviewed_at
  • rejection_reason
  • created_at

How I tested this

  1. Generated and reviewed the Alembic migration manually (no blind autogenerate trust)
  2. Applied migration locally (flask db upgrade) against SQLite
  3. Verified via flask shell:
   from model import db, User, ContestRequest
   u = User(username="TestUser456")
   db.session.add(u); db.session.commit()

   cr = ContestRequest(user_id=u.id, reason="I have 350+ edits and want to run a contest for my wikiproject")
   db.session.add(cr); db.session.commit()

   print(cr.id, cr.status, cr.reason, cr.user_id, cr.edit_count)
   # Output: 1 pending "I have 350+ edits..." 1 None

Confirms: record saves, default status='pending' applies automatically, all fields retrieve correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant