diff --git a/app/services/platforms.py b/app/services/platforms.py deleted file mode 100644 index 6b659a9..0000000 --- a/app/services/platforms.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Platform registry: maps platform names to their poster implementations. - -Adding a new platform: - 1. Create app/services//client.py implementing PlatformClient - 2. Register it here in REGISTRY - -This keeps poster.py platform-agnostic — it looks up the right client by -the campaign's `platform` field rather than branching on strings everywhere. -""" -from __future__ import annotations - -from typing import Protocol - - -class PlatformClient(Protocol): - def post(self, target: str, title: str, body: str, flair: str | None = None) -> str: - """Post content to a target (sub, group, channel). Returns a URL.""" - ... - - -def get_client(platform: str) -> PlatformClient: - """Return an initialized client for the given platform name.""" - if platform == "reddit": - from app.services.reddit.client import RedditClient - return RedditClient() - raise NotImplementedError( - f"Platform '{platform}' is not yet implemented. " - f"Add a client in app/services/{platform}/ and register it here." - ) - - -# Platforms with posting support implemented -SUPPORTED_PLATFORMS = {"reddit"} - -# Platforms planned but not yet implemented -PLANNED_PLATFORMS = {"facebook", "discord", "lemmy", "mastodon"} diff --git a/scripts/seed_campaigns.py b/scripts/seed_campaigns.py index 16c35fd..badba8a 100644 --- a/scripts/seed_campaigns.py +++ b/scripts/seed_campaigns.py @@ -412,8 +412,9 @@ def seed(store: Store) -> None: print() print("Seeding sub rules...") for rule in SUB_RULES: - sub = rule.pop("sub") - store.upsert_sub_rules(sub=sub, last_checked="2026-04-21", **rule) + sub = rule["sub"] + fields = {k: v for k, v in rule.items() if k != "sub"} + store.upsert_sub_rules(sub=sub, last_checked="2026-04-21", **fields) allowed = "OK" if rule.get("promo_allowed") else "BANNED" print(f" r/{sub}: {allowed}")