Commit graph

207 commits

Author SHA1 Message Date
5394f628e4 feat(youtube): add FullCalendar content calendar component
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:53:30 +00:00
95079ec652 feat(youtube): add content calendar API with conflict detection
GET endpoint returns FullCalendar-compatible events with schedule
conflict detection. PATCH endpoint supports drag & drop rescheduling
with published-video protection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:52:17 +00:00
2466745e7f feat(youtube): add conflict detection service
Detect scheduling conflicts in the content calendar including same-day
longform collisions, weekly frequency limit violations, and weekend
scheduling warnings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:50:24 +00:00
d8118528db feat(youtube): add team capacity planning API
Adds a capacity calculator utility and API endpoint that computes
workload utilization for team members with YouTube roles.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:49:55 +00:00
2ea42ca404 chore: add FullCalendar dependencies
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:49:32 +00:00
1f63ae14f4 docs: optimize CLAUDE.md for context window efficiency (1493→401 lines)
Extract detailed subsystem documentation into docs/CLAUDE_REFERENCE.md.
CLAUDE.md is loaded into every AI conversation - reducing it by 73% saves
~38KB of context window tokens per session while keeping all essential info.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:46:52 +00:00
8ae5841cc1 feat(youtube): add auto status transition hook
Automatically transitions YouTube content status when conditions are met
(e.g., upload_scheduled -> published when videoId is present) and sends
notifications to assigned users.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:42:25 +00:00
9e7b433cd0 feat(youtube): add comparison, trends, ROI analytics
Add analytics helper functions (calculateComparison, calculateTrends,
calculateROI) and extend the analytics API route with three new tabs
for video metric comparison, trend analysis, and ROI calculation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:37:51 +00:00
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