Commit graph

299 commits

Author SHA1 Message Date
e4fea9db4c feat(youtube): add ROI cost fields to YouTubeContent
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:35:57 +00:00
ce4c21fd0a feat(youtube): add upload worker and API route
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:34:28 +00:00
e6ef78a08a feat(youtube): register upload worker in queue startup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:33:52 +00:00
6cc3011804 feat(youtube): add VideoUploadService
Implements a service that uploads videos to YouTube via the Data API v3.
Resolves OAuth credentials from social-accounts, reads media files from
disk, and handles scheduled publishes by setting privacyStatus to private
with a publishAt timestamp. Includes 12 unit tests covering successful
uploads, scheduled publishing, credential/media validation, and API errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:31:25 +00:00
fb4d5a8fe5 feat(youtube): add upload queue job definition
Add YOUTUBE_UPLOAD to QUEUE_NAMES and create the job definition
with enqueue and status functions. Uses 2 retry attempts instead
of the default 3 since uploads are resource-intensive.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:30:07 +00:00
289b69380f feat(youtube): add reply thread import to comment sync
Add getCommentReplies method to YouTubeClient for fetching reply threads
via the YouTube comments.list API. Modify CommentsSyncService to import
reply threads during sync, storing them as type 'reply' with
parentInteraction relationship in community-interactions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:28:33 +00:00
13507d1361 feat(youtube): add metrics sync cron endpoints
Add two cron endpoints for automated YouTube metrics syncing:
- /api/cron/youtube-metrics-sync (every 6 hours): syncs video performance
  metrics (views, likes, comments) for all active channels
- /api/cron/youtube-channel-sync (daily at 04:00 UTC): syncs channel-level
  statistics (subscribers, total views, video count)

Both endpoints follow the established cron pattern with CRON_SECRET auth,
concurrent execution guards, HEAD monitoring, and structured logging.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:27:05 +00:00
5ddcd5ab45 feat(youtube): add VideoMetricsSyncService for batch metrics sync
Syncs video performance metrics (views, likes, comments) from YouTube
API to YouTubeContent.performance fields. Supports batch processing
with 50-video API limit, credential validation, and per-batch error
handling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:25:12 +00:00
b52e668ecb feat(youtube): add ChannelMetricsSyncService
Syncs channel-level statistics (subscribers, views, video count) from
YouTube Data API to YouTubeChannels.currentMetrics fields for all active
channels. Follows the same credential-loading pattern as existing sync
services.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:24:57 +00:00
065e75b014 feat(youtube): add getVideoStatistics to YouTubeClient
Add batch video statistics retrieval method that fetches view counts,
like counts, and comment counts for up to 50 videos per request.
Includes unit tests covering normal operation, empty input, missing
statistics defaults, null API response, and error propagation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:21:33 +00:00
097bc5225c feat(youtube): add upload and analytics OAuth scopes
Add youtube.upload and yt-analytics.readonly scopes to enable video
uploading and analytics data retrieval in the YouTube Operations Hub.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:19:23 +00:00
2718dea356 docs: add YouTube Operations Hub extensions implementation plan
22-task implementation plan covering 4 phases:
- Phase 1: YouTube API Integration (10 tasks)
- Phase 2: Analytics Dashboard (3 tasks)
- Phase 3: Workflow Automation (3 tasks)
- Phase 4: Content Calendar (6 tasks)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 12:45:42 +00:00
2e32a958bc docs: add YouTube Operations Hub extensions design
Design for 4 extensions: YouTube API Integration (metrics sync,
video upload, comment import), Analytics Dashboard (comparison,
trends, ROI), Workflow Automation (auto-status, deadline reminders,
capacity planning), Content Calendar (FullCalendar, drag & drop,
conflict detection).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 12:38:37 +00:00
8907653744 docs: add YouTube thumbnail download to documentation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 12:33:31 +00:00
6ffe6e756c feat: add bulk YouTube thumbnail download endpoint
POST /api/youtube/thumbnails/bulk (Super-Admin only)
Supports ?dryRun=true for preview. Downloads sequentially with 500ms delay.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 12:32:31 +00:00
2872f32635 feat: auto-download YouTube channel images on create/update
Adds channelThumbnailUrl field to store YouTube API URL.
afterChange hook downloads image to Payload Media when branding.logo is empty.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 12:30:48 +00:00
a09f6abc3d feat: auto-download YouTube thumbnails on content create/update
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 12:29:44 +00:00
52a6bce815 feat: add downloadAndUploadImage utility for YouTube thumbnails
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 12:29:04 +00:00
0691031c36 docs: add YouTube thumbnail download implementation plan
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 11:55:00 +00:00
5aef72f72b docs: add YouTube thumbnail download design document
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 11:51:13 +00:00
2d4f43e780 docs: update PROJECT_STATUS.md - Meta sync complete, CI/CD added
Mark Meta comment sync as completed, add CI/CD pipeline to completed
section, update changelog with 14.02.2026 entries, renumber next steps.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 11:41:26 +00:00
c33372cc70 fix(community): use UnifiedSyncService for manual sync + document Meta integration
The manual sync button in Community Inbox was only syncing YouTube comments
via the legacy syncAllComments service. Now uses UnifiedSyncService to sync
all platforms (YouTube, Facebook, Instagram). Also adds comprehensive
Community Management documentation to CLAUDE.md.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 23:40:26 +00:00
e49d32fa01 chore(ci): remove SSH debug step from staging workflow
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 23:18:09 +00:00
4909638889 fix(ci): rotate staging SSH key and add connection debug step
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 23:11:21 +00:00
cf84103817 fix(ci): add SSH port 2222 for staging deployment
Port forwarding: 37.24.237.181:2222 -> 10.10.181.100:22 (sv-payload)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 23:09:00 +00:00
28e6c6c125 fix(ci): fix staging deployment SSH and workflow issues
- Rotate STAGING_SSH_KEY (new ED25519 keypair)
- Remove environment block (same startup_failure fix as production)
- Fix staging URL: pl.c2sgmbh.de -> pl.porwoll.tech
- Update Node.js: 20 -> 22 (match project standard)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 22:42:13 +00:00
cc4eb930ae docs: update CLAUDE.md to reflect passing CI pipeline
- ESLint: document flat config with 0 errors
- Typecheck: document 4GB heap for 55+ collections
- Deploy: add post-deployment verification step
- Update timestamp

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 22:39:08 +00:00
d896b72c18 fix(ci): accept 4xx from API health check (401 = running)
API returns 401 without auth, which proves it's alive. Only 5xx
indicates a real server failure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 22:31:23 +00:00
16f7a203bc fix(ci): use valid API endpoint for post-deployment health check
/api returns 404 in Payload CMS (no root handler). Use /api/users
which returns 401 (valid response, proves API is running).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 22:31:00 +00:00
d94db78aec fix: resolve all ESLint errors for clean CI pipeline
- Extend admin component overrides to cover all Payload admin views
  (no-html-link-for-pages, no-img-element off for admin panel)
- Rename useGeneratedReply to applyGeneratedReply (not a hook)
- Fix useRealtimeUpdates: resolve circular dependency with connectRef,
  wrap ref assignments in useEffect for React 19 compiler compliance
- Fix MetaBaseClient: let -> const for single-assignment variable

ESLint now passes with 0 errors (68 warnings only).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 22:24:12 +00:00
55189aaa1a fix: resolve ESLint circular structure crash and tsc OOM
- Replace FlatCompat bridge with native flat config imports from
  eslint-config-next (16.x exports flat configs directly)
- Remove unused @eslint/eslintrc devDependency
- Increase tsc heap to 4096MB for typecheck (55+ collections exceed 2GB)
- Exclude migrations, test artifacts from tsconfig type-checking

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 22:13:45 +00:00
b6dd7e354c fix(ci): remove environment block causing startup_failure
The GitHub environment 'production' was causing startup_failure on all
workflow_dispatch runs (0 jobs started). Remove the environment reference
to unblock deployments. Can be re-added once the root cause is identified.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 21:41:02 +00:00
a849359c20 docs: consolidate and update documentation for Payload 3.76.1 / Next.js 16
Update all version references from Payload 3.69.0 → 3.76.1 and Next.js
15.5.9 → 16.2.0-canary.41. Replace .env.example (MongoDB → PostgreSQL)
and README.md (generic template → project-specific). Remove obsolete
BUG_REPORT_CUSTOM_VIEWS.md. Add YouTube Analytics Dashboard to URLs and
February 2026 changelog entry.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 21:29:50 +00:00
197d45f9e4 chore: add blogwoman seed script, ignore playwright-mcp
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 21:07:02 +00:00
6fafadfb57 fix: add tsx as explicit devDependency
tsx was a transitive dependency that disappeared after the package
upgrade, causing queue-worker to crash on production.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 17:28:40 +00:00
84685778c3 refactor(admin-nav): unify sidebar nav groups to match Payload native style
Replace custom BEM classes and SCSS with Payload's native nav-group CSS
classes for Community and YouTube dashboard nav links. Removes emojis,
adds collapsible toggle with chevron, matches the native sidebar UX.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 14:25:57 +00:00
826e404955 fix(youtube-analytics): fix tab-switch crash and channel selector
- Clear data state on tab switch to prevent stale data type mismatch
- Add defensive null guards in all render functions (?.stats, ?.pipeline)
- Use channel ID instead of slug for API filtering

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 14:00:35 +00:00
06c93ba05c feat: add YouTube Analytics Dashboard custom admin view
Custom admin view at /admin/youtube-analytics with 4 tabs:
- Performance: Views, Watch Time, CTR, Subscribers with period comparison
- Pipeline: Status distribution, scheduled videos, overdue tasks
- Goals: Monthly target progress bars and custom KPIs
- Community: Sentiment analysis, response time, top topics

Includes channel selector, period selector (7d/30d/90d), and
sidebar nav link in the YouTube section.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 13:50:35 +00:00
8b037c91af feat: upgrade Next.js 15.5.9 → 16.2.0-canary.41
- Upgrade next and eslint-config-next to 16.2.0-canary.41
- Fix ReportGeneratorService: replace non-existent sendEmail import
  with sendTenantEmail (latent bug exposed by Next.js 16 strict
  module checking)
- Fix SCSS: replace :global(.dark) with .dark in 4 admin component
  stylesheets (Next.js 16 Lightning CSS rejects :global pseudo-class
  in non-CSS-Module files)
- Update tsconfig.json: jsx "preserve" → "react-jsx" (Next.js 16 req)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 12:29:25 +00:00
ec91116ae6 feat: re-enable custom admin views after Payload 3.76.1 fix
Issue #15241 (TypeError: Missing parameter name with custom admin
components + multi-tenant plugin) is resolved in Payload 3.76.1.
Re-enable TenantDashboard custom view at /admin/tenant-dashboard.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 11:21:01 +00:00
304e54f9e2 feat: upgrade Payload CMS 3.69.0 → 3.76.1
Upgrade all 11 @payloadcms/* packages to 3.76.1, gaining fixes from
PRs #15404 (user.collection property for multi-tenant access control)
and #15499 (tenant selector uses beforeNav slot).

Fix afterLogin audit hook deadlock: payload.create() inside the hook
caused a transaction deadlock with PgBouncer in transaction mode under
Payload 3.76.1's stricter transaction handling. Changed to fire-and-forget
pattern to prevent login hangs.

Note: Next.js 15.5.9 peer dependency warning exists but build/runtime
work correctly. Consider upgrading Next.js to 16.x or downgrading to
15.4.11 in a follow-up.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 11:07:46 +00:00
9f575963ed docs: clean up CLAUDE.md redundancies and update collections
- Fix tenant count: 4 → 3 active websites (remove zweitmein.ng)
- Update blocks count: 42 → 43 (add ScriptSectionBlock)
- Update collections count: 40+ → 55+ (add 11 missing collections)
- Remove redundant TRUST_PROXY explanation (keep only in Security section)
- Remove duplicate DB access commands from multiple sections
- Remove hardcoded locale table count (was outdated)
- Add missing YouTube/Community collections to documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 17:34:23 +00:00
0976a691ec fix(setup-tenants): improve error handling to prevent silent failures
- Add robust error handling to check_existing function
- Fix create_social_links to handle API errors gracefully
- Fix create_pages to handle API errors and track skipped/failed counts
- Fix create_navigation with proper error handling
- Replace ((count++)) with $((count + 1)) for POSIX compatibility
- Add 2>/dev/null to jq calls to suppress error output
- Return 0 from functions on early exit to prevent set -e issues

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 10:42:10 +00:00
77f70876f4 chore: add Claude Code config, prompts, and tenant setup scripts
- Add .claude/ configuration (agents, commands, hooks, get-shit-done workflows)
- Add prompts/ directory with development planning documents
- Add scripts/setup-tenants/ with tenant configuration
- Add docs/screenshots/
- Remove obsolete phase2.2-corrections-report.md
- Update pnpm-lock.yaml
- Update detect-secrets.sh to ignore setup.sh (env var usage, not secrets)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 10:18:05 +00:00
847018cd60 docs: add Git branching workflow to CLAUDE.md and DEPLOYMENT.md
- Document develop → staging, main → production workflow
- Add branch descriptions and commit conventions
- Include workflow steps with commands

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 17:35:25 +00:00
d7dfa2e2ea docs: add Community Management APIs to FRONTEND.md and API_ANLEITUNG.md
Add documentation for YouTube/Meta integration:
- YouTube Channels, Content, Series, Notifications APIs
- Social Platforms, Accounts, Community Interactions APIs
- Code examples for frontend integration
- Field documentation with curl examples

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 17:23:10 +00:00
4198e5cc8f fix(auth): make login route fail-safe with lazy-loaded security modules
Refactor custom login route to be more resilient:
- Lazy-load security modules to prevent initialization errors
- Wrap each security feature in try-catch for graceful degradation
- Skip CSRF validation for API requests (no Origin header + JSON content)
- Improve error handling and logging throughout

This ensures login works even if individual security modules fail,
while still providing full protection when everything is available.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 16:04:47 +00:00
a923d3ecb4 docs: cleanup and update documentation for January 2026
- Delete redundant TODO.md (consolidated into PROJECT_STATUS.md)
- Simplify STAGING-DEPLOYMENT.md to quick reference format
- Update PROJECT_STATUS.md with January 2026 status:
  - Add Community Management System section
  - Document Payload 3.72.0 login bug (#15243)
  - Update roadmap and changelog
- Update framework-monitoring.md with current versions and bug warning
- Add YouTube/Meta collections to CLAUDE.md:
  - YouTubeChannels, YouTubeContent, YtSeries, YtNotifications
  - MetaAccounts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 15:29:34 +00:00
cb035d209d feat(dashboard): Phase 3 - Scheduled Reports & Real-time Updates
Phase 3.0a - Scheduled Reports:
- ReportSchedules Collection: Zeitplan-Verwaltung für automatische Reports
  - Frequenz: täglich, wöchentlich, monatlich
  - Formate: PDF, Excel (CSV), HTML E-Mail
  - Report-Typen: Übersicht, Sentiment, Response-Metriken, Content-Performance
  - Multiple Empfänger per E-Mail
  - Zeitzone-Support

- ReportGeneratorService: Report-Generierung
  - Datensammlung aus community-interactions
  - HTML-Template für PDF und E-Mail
  - CSV-Export für Excel-kompatible Daten

- Cron-Endpoint: /api/cron/send-reports (stündlich)
  - Prüft fällige Reports
  - Automatischer Versand per E-Mail
  - Status-Tracking und Fehlerbehandlung

Phase 3.0b - Real-time Updates:
- SSE Stream Endpoint: /api/community/stream
  - Server-Sent Events für Live-Updates
  - 5-Sekunden Polling-Intervall
  - Heartbeat für Verbindungserhalt
  - Automatische Reconnection

- useRealtimeUpdates Hook:
  - React Hook für SSE-Konsum
  - Verbindungsstatus-Management
  - Update-Counter für Badges
  - Channel-Filterung

Vercel Cron aktualisiert:
- send-reports: stündlich (0 * * * *)

Migrationen:
- 20260116_120000_add_report_schedules

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 22:10:30 +00:00
7774616f00 feat(cron): Phase 2.6 - Vercel Cron Configuration
Konfiguriert automatische Hintergrund-Jobs für Vercel:

- Token-Refresh Cron: 2x täglich (6:00 + 18:00 UTC)
  - Erneuert OAuth-Tokens 7 Tage vor Ablauf
  - Benachrichtigt Manager bei Problemen

- Dokumentation in CLAUDE.md:
  - Neue Sektion "Scheduled Cron Jobs (Vercel)"
  - Übersicht aller Cron-Endpoints
  - Beispiele für manuellen Trigger
  - Monitoring-Hinweise

Bestehende Crons:
- community-sync: alle 15 Minuten (YouTube/Facebook/Instagram)
- token-refresh: 2x täglich (OAuth Token Renewal)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 21:53:15 +00:00