Commit graph

14 commits

Author SHA1 Message Date
e9b4cdd88e feat: link_url variants, team accounts, session layout, menagerie route (#18 #19)
#19 — link_url on campaign variants (migration 019)
- ADD COLUMN link_url TEXT on campaign_variants
- create_variant, upsert_variant, update_variant all carry link_url
- RedditClient.post() supports kind=link when link_url set + body empty
- RedditPostStrategy passes link_url from extra dict
- poster.py merges link_url from variant into extra (same as slug/tags)
- API VariantCreate/VariantUpdate schemas include link_url
- CampaignDetail: link_url field in Add Variant form with copy button;
  link_url shown in variant list with clickable link + copy button
- Variant button disabled if neither body nor link_url is set

#18 — Multi-user team accounts (migrations 020-022)
- 020: team_accounts table (display_name, platform, username, session_file)
- 021: opportunities.assigned_to + post_as FK → team_accounts
- 022: posts.posted_by_account_id FK → team_accounts
- Store: list/get/get_by_username/create_team_account, assign_opportunity
- API: GET/POST /api/v1/team; POST /api/v1/team/{id}/assign
- config.py: sessions_dir added; reddit_session_file now points to
  sessions/alan_reddit.json (backward compat path kept)
- scripts/migrate_sessions.py: one-shot move session.json →
  sessions/alan_reddit.json + creates placeholder files for future accounts
- manage.sh: build (VITE_BASE_URL=/magpie/ npm build), serve (static),
  migrate-sessions subcommands added; login updated to new session path
- Caddy: @magpie_no_session gate + handle /magpie/api* and /magpie*
  blocks added to menagerie.circuitforge.tech site block
2026-05-27 15:31:58 -07:00
e7316d177f feat: register BlogPostStrategy in platform registry 2026-04-27 16:10:15 -07:00
65fd09c06d feat: add BlogPostStrategy wrapping Directus publish_blog_post() 2026-04-27 16:09:35 -07:00
a3932aef1e fix: handle ValueError from parse_occurrence and add edge-case occurrence tests
- Wrap parse_occurrence() call in try/except ValueError; return skipped with reason instead of crashing
- Remove redundant `or {}` guard on sub_row (already defaulted to {} via next(..., {}))
- Strengthen test_occurrence_passes assertion to check status == "success"
- Add 3 edge-case tests: occurrence="every", missing occurrence key, invalid occurrence string
2026-04-27 12:57:44 -07:00
08aa019439 feat: add occurrence check to poster before strategy dispatch
Parse the occurrence field from sub_row and skip execution when today
is not the nth weekday specified (e.g. first_sunday). Check runs after
sub_row fetch but before dupe guard. Two new tests confirm skip and
pass paths using patched date.today in app.services.poster.
2026-04-27 12:27:16 -07:00
90d30167f8 fix: add timeout and error wrapping to _find_sticky, clean up test fixture 2026-04-27 12:23:44 -07:00
e37be0935d feat: implement RedditCommentStrategy and register in platform registry
Adds RedditCommentStrategy to app/services/platforms/reddit_comment.py,
resolving thread_id via thread_url_override or _find_sticky title search,
falling back to reconstructed URL when client.comment() returns empty string.
Registers the strategy under "reddit_comment" in the platform _REGISTRY.
7 new tests confirm all execution paths: url override, title pattern lookup,
not-found error, missing-extra error, empty-URL reconstruction, dupe guard,
and registry presence. Full suite: 34/34 passing.
2026-04-27 12:00:08 -07:00
719a1d5aca fix: address code review issues in reddit_comment thread detection helpers 2026-04-27 11:55:55 -07:00
9d955b2c50 feat: add thread detection helpers to reddit_comment strategy 2026-04-27 11:36:36 -07:00
ca9b2ac0b2 feat: add is_nth_weekday() and parse_occurrence() for scheduled comment gating 2026-04-27 11:04:30 -07:00
81a63ab0ec refactor: dispatch poster by campaign.type via platform strategy registry
Replace hardcoded platform dispatch with get_client(campaign["type"]) so
any future campaign type (blog_post, email, etc.) routes automatically
through the strategy registry. Adds dupe-guard opt-out per strategy,
sub_row pre-fetch for extra metadata, and 5 new TDD tests (14 total).
2026-04-27 08:38:12 -07:00
de6dc645f6 feat: add platform registry with get_client() dispatch 2026-04-27 08:12:47 -07:00
ae96621f6c feat: add RedditPostStrategy wrapping RedditClient.post() 2026-04-27 08:09:03 -07:00
2dd88285a2 feat: add PostingStrategy ABC and PostResult dataclass 2026-04-27 08:00:36 -07:00