refactor(feed): extract read-model to app.feedquery + admin_user sweep

B-core-3 (2026-08-17 review): decouple two things from router modules.

1. Feed read-model → new app/feedquery.py: the pure query-building and
   row-serialization layer (feed_columns, serialize, _filtered_query,
   to_tsquery_str, and the keyset-pagination helpers) moves out of
   routes/feed.py, which keeps only the route handlers, _feed_params, and
   the request models. The three external consumers (playlists, search,
   plex/browse) now import from app.feedquery instead of reaching into the
   feed router.

2. admin_user sweep: 7 modules imported admin_user via app.routes.admin
   (an incidental re-export of app.auth.admin_user). Repoint them all to
   the definition in app.auth (audit, channels, config, quota, scheduler,
   plex/admin, plex/browse); routes.admin keeps its own import for its use.

Pure code motion — no behaviour change. Full DB-lane suite 287 passed /
2 skipped; ruff clean.
This commit is contained in:
2026-08-17 17:42:01 +02:00
parent c361fc2581
commit 5f09259bbf
11 changed files with 459 additions and 432 deletions
+1 -2
View File
@@ -8,7 +8,7 @@ from sqlalchemy import select
from sqlalchemy.orm import Session
from app import sysconfig
from app.auth import current_user
from app.auth import admin_user, current_user
from app.db import get_db
from app.models import (
PlexItem,
@@ -19,7 +19,6 @@ from app.plex import paths as plex_paths
from app.plex import sync as plex_sync
from app.plex import watch_sync as plex_watch
from app.plex.client import PlexClient, PlexError, PlexNotConfigured
from app.routes.admin import admin_user
from app.utils import iso
router = APIRouter(prefix="/api/plex", tags=["plex"])
+2 -3
View File
@@ -25,7 +25,7 @@ from sqlalchemy import (
from sqlalchemy.orm import Session, aliased
from app import sysconfig
from app.auth import current_user
from app.auth import admin_user, current_user
from app.db import get_db
from app.models import (
PlexCollection,
@@ -45,9 +45,8 @@ from app.plex import rollup, subtitles
from app.plex import sync as plex_sync
from app.plex.client import PlexClient, PlexError, PlexNotConfigured
from app.plex.lookups import by_rating_key
from app.feedquery import to_tsquery_str
from app.routes._common import owned_or_404
from app.routes.admin import admin_user
from app.routes.feed import to_tsquery_str
from app.routes.plex._shared import item_or_404
router = APIRouter(prefix="/api/plex", tags=["plex"])