Decoupling audit cleanup: fix protocol gaps, remove dead APIs

- Add search_posts, entry_ids_for_content, visible_entries_for_period
  to protocols and stubs
- Delete internal_api.py and factory cleanup hook (zero callers)
- Convert utils.py to utils/ package with calendar_helpers module
- Remove deleted_at check from calendar_view template (service filters)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-20 10:58:07 +00:00
parent 7ee8638d6e
commit e83df2f742
8 changed files with 149 additions and 159 deletions

View File

@@ -5,6 +5,7 @@ implementations (Sql*Service) and no-op stubs both satisfy them.
"""
from __future__ import annotations
from datetime import datetime
from typing import Protocol, runtime_checkable
from sqlalchemy.ext.asyncio import AsyncSession
@@ -27,6 +28,10 @@ class BlogService(Protocol):
async def get_post_by_id(self, session: AsyncSession, id: int) -> PostDTO | None: ...
async def get_posts_by_ids(self, session: AsyncSession, ids: list[int]) -> list[PostDTO]: ...
async def search_posts(
self, session: AsyncSession, query: str, page: int = 1, per_page: int = 10,
) -> tuple[list[PostDTO], int]: ...
@runtime_checkable
class CalendarService(Protocol):
@@ -107,6 +112,16 @@ class CalendarService(Protocol):
self, session: AsyncSession, user_id: int, session_id: str,
) -> None: ...
async def entry_ids_for_content(
self, session: AsyncSession, content_type: str, content_id: int,
) -> set[int]: ...
async def visible_entries_for_period(
self, session: AsyncSession, calendar_id: int,
period_start: datetime, period_end: datetime,
*, user_id: int | None, is_admin: bool, session_id: str | None,
) -> list[CalendarEntryDTO]: ...
@runtime_checkable
class MarketService(Protocol):