forked from retoor/devplacepy
feat: add featured/locked columns and auto-rotation logic to news pipeline
- Add `ai_grade`, `featured`, `featured_locked`, `landing_locked`, `author`, `article_published`, `image_url`, `has_unique_image` columns to news table - Extend `news_images` schema with `alt_text`, `phash`, `width`, `height`, `is_placeholder` columns - Create `idx_news_featured` index for efficient featured queries - Update admin toggle endpoints to set `featured_locked`/`landing_locked` when manually toggling - Propagate `featured` and `image_url` fields through landing page, news list, and detail page rendering - Update `get_featured_news` to return `featured` and `image_url` fields - Document in AGENTS.md the full zero-maintenance pipeline: image perceptual hashing, placeholder detection, AI grading on cleaned text, reliability gate, effective score computation, and post-loop landing rotation - Update README.md service description to reflect automatic image comparison and landing rotation capabilities - Clarify docs_api.py summaries that toggling featured/landing now locks articles from auto-rotation
This commit is contained in:
@@ -85,7 +85,9 @@ async def admin_news_toggle(request: Request, uid: str):
|
||||
if article:
|
||||
current = article.get("featured", 0)
|
||||
new_value = 0 if current else 1
|
||||
news_table.update({"uid": uid, "featured": new_value}, ["uid"])
|
||||
news_table.update(
|
||||
{"uid": uid, "featured": new_value, "featured_locked": 1}, ["uid"]
|
||||
)
|
||||
logger.info(
|
||||
f"Admin {admin['username']} toggled news {uid} featured={'off' if current else 'on'}"
|
||||
)
|
||||
@@ -137,7 +139,9 @@ async def admin_news_landing(request: Request, uid: str):
|
||||
if article:
|
||||
current = article.get("show_on_landing", 0)
|
||||
new_value = 0 if current else 1
|
||||
news_table.update({"uid": uid, "show_on_landing": new_value}, ["uid"])
|
||||
news_table.update(
|
||||
{"uid": uid, "show_on_landing": new_value, "landing_locked": 1}, ["uid"]
|
||||
)
|
||||
logger.info(
|
||||
f"Admin {admin['username']} toggled news {uid} landing={'on' if not current else 'off'}"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user