refactor(reader): the unit's tables move into reader/models

VideoState, Playlist, PlaylistItem, SavedView, ComfortPin, Tag and ChannelTag leave app/models.py
for app/reader/models.py; app.tables registers them. No schema change.
This commit is contained in:
2026-10-19 00:53:44 +02:00
parent e9c60f72cd
commit e82f87acb0
35 changed files with 262 additions and 274 deletions
+1 -1
View File
@@ -106,7 +106,7 @@ def test_the_single_playlist_repull_shares_the_pull_cooldown(db, as_user, make_u
# SEC-14, the sweep half: `revert-youtube` spends under the SAME QuotaAction.PLAYLISTS_PULL key
# as the bulk `sync-youtube`, so limiting only one of them left the identical drain open one
# route over. Both must draw on the one allowance.
from app.models import Playlist
from app.reader.models import Playlist
from app.routes import playlists as plroutes
user = make_user()
+2 -1
View File
@@ -7,7 +7,8 @@ drops an unknown id, so the view silently showed the whole feed under its old na
from sqlalchemy import select
from app.models import Channel, ChannelTag, SavedView, Tag
from app.models import Channel
from app.reader.models import ChannelTag, SavedView, Tag
from app.sync import autotag
+2 -1
View File
@@ -14,7 +14,8 @@ import app.state as state
from app.auth import current_user
from app.db import get_db
from app.main import app
from app.models import Channel, ChannelTag, Tag, User
from app.models import Channel, User
from app.reader.models import ChannelTag, Tag
def test_channel_detail_returns_only_this_users_tag_ids(db, monkeypatch, override_dep):
+2 -11
View File
@@ -9,17 +9,8 @@ from app.auth import current_user
from app.collation import sorted_words
from app.db import get_db
from app.main import app
from app.models import (
Channel,
Playlist,
PlaylistItem,
PlexCollection,
PlexItem,
PlexLibrary,
Subscription,
User,
Video,
)
from app.models import Channel, PlexCollection, PlexItem, PlexLibrary, Subscription, User, Video
from app.reader.models import Playlist, PlaylistItem
from datetime import datetime, timezone
WORDS = ["Zorró", "Életrajzi", "Ötödik", "oroszlán", "Csillag", "Cukor"]
+1 -4
View File
@@ -20,18 +20,15 @@ from app.plex.cards import leaf_card
from app.models import (
BlockedChannel,
Channel,
ComfortPin,
PlexItem,
PlexLibrary,
PlexShow,
PlexState,
Playlist,
PlaylistItem,
Subscription,
User,
Video,
VideoState,
)
from app.reader.models import ComfortPin, Playlist, PlaylistItem, VideoState
NOW = datetime(2026, 6, 1, tzinfo=timezone.utc)
+2 -9
View File
@@ -12,15 +12,8 @@ contradicts the remote's own count is not believed either.
import pytest
from sqlalchemy import select
from app.models import (
Channel,
Playlist,
PlaylistItem,
PlexCollection,
PlexItem,
PlexLibrary,
Video,
)
from app.models import Channel, PlexCollection, PlexItem, PlexLibrary, Video
from app.reader.models import Playlist, PlaylistItem
from app.plex import sync as plex_sync
from app.sync import playlists as plsync
from app.youtube.client import YouTubeError
+2 -1
View File
@@ -14,7 +14,8 @@ import pytest
from app import feedquery
from app.models import Channel, ChannelTag, Subscription, Tag, Video, VideoState
from app.models import Channel, Subscription, Video
from app.reader.models import ChannelTag, Tag, VideoState
def _dt(day: int) -> datetime:
+2 -1
View File
@@ -12,7 +12,8 @@ from datetime import datetime, timedelta, timezone
import pytest
from sqlalchemy import select
from app.models import Channel, Notification, Playlist, PlaylistItem, Video
from app.models import Channel, Notification, Video
from app.reader.models import Playlist, PlaylistItem
from app.sync import maintenance
+2 -1
View File
@@ -8,7 +8,8 @@ the position is an index over the ORDERED rows, and the list is renumbered aroun
from datetime import datetime, timezone
from app.models import Channel, Playlist, PlaylistItem, Video
from app.models import Channel, Video
from app.reader.models import Playlist, PlaylistItem
def _seed(db, user, ids, *, positions=None, **kw):
+2 -1
View File
@@ -10,7 +10,8 @@ from datetime import datetime, timezone
import pytest
from app.models import Channel, Playlist, PlaylistItem, Video
from app.models import Channel, Video
from app.reader.models import Playlist, PlaylistItem
from app.sync import playlists as pl_mod
from app.sync.playlist_merge import merge_plan
from app.sync.playlists import (
+2 -1
View File
@@ -16,7 +16,8 @@ from datetime import datetime, timedelta, timezone
import pytest
from sqlalchemy.exc import OperationalError
from app.models import Channel, Playlist, PlaylistItem, Video
from app.models import Channel, Video
from app.reader.models import Playlist, PlaylistItem
def _seed_videos(db, ids):
+2 -10
View File
@@ -19,16 +19,8 @@ from datetime import datetime, timezone
import pytest
from sqlalchemy import event
from app.models import (
Channel,
Playlist,
PlaylistItem,
PlexItem,
PlexLibrary,
PlexPlaylist,
PlexPlaylistItem,
Video,
)
from app.models import Channel, PlexItem, PlexLibrary, PlexPlaylist, PlexPlaylistItem, Video
from app.reader.models import Playlist, PlaylistItem
@pytest.fixture
+1 -1
View File
@@ -10,7 +10,7 @@ from sqlalchemy import text
from app.auth import require_write_scope
from app.db import SessionLocal
from app.models import Playlist
from app.reader.models import Playlist
from app.routes import playlists as plroutes
from app.sync import playlists as plsync
@@ -18,7 +18,8 @@ import pytest
from sqlalchemy import delete, event, text
from app.db import SessionLocal
from app.models import Channel, Playlist, PlaylistItem, Video
from app.models import Channel, Video
from app.reader.models import Playlist, PlaylistItem
from app.sync import playlists as pl_mod
ITEMS = PlaylistItem.__table__.name
+2 -1
View File
@@ -11,7 +11,8 @@ network, pure DB state.
Uses the DB lane (`db` fixture) — skipped when no Postgres is reachable.
"""
from app.models import Channel, ChannelTag, Subscription, Tag, User
from app.models import Channel, Subscription, User
from app.reader.models import ChannelTag, Tag
from app.sync.tagsuggest import (
AUTOAPPLY_THRESHOLD,
CHAR_SUPPORT,