Skip to content

refactor: inject db/service into admin panel views#134

Merged
adrunkhuman merged 2 commits intomasterfrom
refactor/118-admin-panel-di
Mar 21, 2026
Merged

refactor: inject db/service into admin panel views#134
adrunkhuman merged 2 commits intomasterfrom
refactor/118-admin-panel-di

Conversation

@adrunkhuman
Copy link
Owner

Summary

  • OwnerRestrictedView now takes db, service, bot directly — no more admin_cog pass-through
  • OpenFixtureWarningView injects start_fixture_dm: Callable instead of the whole cog
  • FixtureSelect: removed dead open_only param — callers already pre-filter their fixture lists before calling update_options
  • All TYPE_CHECKING guards and the circular import workaround removed across all 5 panel modules
  • Bonus fix: ViewResultsButton — moved fixture is None guard before get_results to avoid an unguarded DB call on a potentially deleted fixture

Closes #118

Test plan

  • /admin panel opens home view
  • Fixtures / Predictions / Results buttons navigate to correct subpanels
  • Back button returns to home view from each subpanel
  • Fixture deletion confirmation flow works end-to-end
  • Open fixture warning flow (proceed → DM) works
  • Prediction replace modal submits correctly
  • Late waiver toggle updates panel status
  • Results correction modal submits correctly

🤖 Generated with Claude Code

Replace admin_cog pass-through with direct dependency injection across
all OwnerRestrictedView subclasses. Views now declare exactly what they
need (db, service, bot) instead of reaching through the cog.

- Remove TYPE_CHECKING guard and circular import workaround in all panel modules
- OwnerRestrictedView: takes db, service, bot instead of admin_cog
- OpenFixtureWarningView: inject start_fixture_dm callable instead of cog
- FixtureSelect: remove open_only param (dead code; callers already
  pre-filter their fixture lists before calling update_options)
- results.py ViewResultsButton: guard fixture None-check before get_results

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@railway-app railway-app bot temporarily deployed to patient-quietude / matchday-typer-pr-134 March 21, 2026 22:00 Destroyed
@railway-app
Copy link

railway-app bot commented Mar 21, 2026

🚅 Deployed to the matchday-typer-pr-134 environment in patient-quietude

Service Status Web Updated (UTC)
matchday-typer ✅ Success (View Logs) Mar 21, 2026 at 10:02 pm

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@railway-app railway-app bot temporarily deployed to patient-quietude / matchday-typer-pr-134 March 21, 2026 22:01 Destroyed
@adrunkhuman adrunkhuman merged commit 9df03b7 into master Mar 21, 2026
2 checks passed
@adrunkhuman adrunkhuman deleted the refactor/118-admin-panel-di branch March 21, 2026 22:03
@adrunkhuman adrunkhuman changed the title refactor: inject db/service into admin panel views (#118) refactor: inject db/service into admin panel views Mar 21, 2026
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.

refactor: inject db/service into admin panel views instead of passing cog

1 participant