refactor: extract AdminDMHandler base to eliminate _verify_admin duplication#137
Merged
adrunkhuman merged 1 commit intomasterfrom Mar 21, 2026
Merged
refactor: extract AdminDMHandler base to eliminate _verify_admin duplication#137adrunkhuman merged 1 commit intomasterfrom
adrunkhuman merged 1 commit intomasterfrom
Conversation
…ication (#117) `FixtureCreationHandler` and `ResultsEntryHandler` had identical ~40-line `_verify_admin` implementations and repeated `has_session` boilerplate. Introduces `AdminDMHandler[S]` in `handlers/base_dm_handler.py` with: - abstract `get_session` / `clear_session` for subclasses to bind to the correct store methods - concrete `has_session` delegating to `get_session` - concrete `_verify_admin` using `self.clear_session` instead of direct store calls Both admin handlers inherit from the base; `DMPredictionHandler` is left standalone (no admin check, different session model). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
🚅 Deployed to the matchday-typer-pr-137 environment in patient-quietude
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #117
Summary
AdminDMHandler[S](handlers/base_dm_handler.py) — a generic ABC that owns the common session lifecycle interface and the duplicated_verify_adminlogicFixtureCreationHandlerandResultsEntryHandlernow inherit from it; each implements the two abstract methods (get_session,clear_session) that bind to their respectiveWorkflowStateStoremethodshas_sessionlives once in the base, delegating throughget_sessionDMPredictionHandlerleft standalone — no admin check, different session model, doesn't fit the abstraction_verify_adminremovedTest plan
uv run pytest)ruff checkclean on all changed files🤖 Generated with Claude Code