docs udpated
This commit is contained in:
@@ -1,19 +1,22 @@
|
||||
# Scheduled Content Publishing Workflow
|
||||
|
||||
**Last Updated:** January 16, 2026
|
||||
**Module:** Publishing / Automation
|
||||
**Module:** Publishing / Automation
|
||||
**Status:** ✅ Site filtering fixed and verified
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
IGNY8 provides automated content publishing to WordPress sites. Content goes through a scheduling process before being published at the designated time.
|
||||
IGNY8 provides automated content publishing to WordPress, Shopify, and custom sites. Content goes through a scheduling process before being published at the designated time.
|
||||
|
||||
**Current System (v2.0):**
|
||||
- WordPress credentials stored directly on `Site` model (`wp_api_key`, `domain`)
|
||||
- Site credentials stored directly on `Site` model (`api_key`, `domain`, `platform_type`)
|
||||
- Multi-platform support: WordPress, Shopify, Custom APIs
|
||||
- No `SiteIntegration` model required
|
||||
- Publishing via `PublisherService` (not legacy Celery tasks)
|
||||
- API endpoint: `POST /api/v1/publisher/publish`
|
||||
- **Site Filtering:** All content queries filtered by `site_id` (fixed Jan 2026)
|
||||
|
||||
---
|
||||
|
||||
@@ -29,13 +32,15 @@ Content has **TWO separate status fields**:
|
||||
- `approved` - Ready for publishing
|
||||
- `published` - Legacy (not used for external publishing)
|
||||
|
||||
2. **`site_status`** - External site publishing status
|
||||
- `not_published` - Not yet published to WordPress
|
||||
2. **`site_status`** - External site publishing status (platform-agnostic)
|
||||
- `not_published` - Not yet published to any site
|
||||
- `scheduled` - Has a scheduled_publish_at time
|
||||
- `publishing` - Currently being published
|
||||
- `published` - Successfully published to WordPress
|
||||
- `published` - Successfully published to site (WordPress, Shopify, or Custom)
|
||||
- `failed` - Publishing failed
|
||||
|
||||
**Note:** `site_status` works across all platforms (WordPress, Shopify, Custom) and is filtered by `site_id` to show only content for the selected site.
|
||||
|
||||
### Publishing Flow
|
||||
|
||||
```
|
||||
@@ -84,6 +89,45 @@ Content has **TWO separate status fields**:
|
||||
|
||||
---
|
||||
|
||||
## Frontend Integration
|
||||
|
||||
### Site Selector & Content Filtering
|
||||
|
||||
**Content Calendar** (`frontend/src/pages/Publisher/ContentCalendar.tsx`):
|
||||
- Automatically filters all content by selected site
|
||||
- Reloads data when site selector changes
|
||||
- Shows scheduled, publishing, published, and failed content for active site only
|
||||
|
||||
**Critical Implementation Details:**
|
||||
- All API queries include `site_id: activeSite.id` parameter
|
||||
- Backend `ContentFilter` includes `site_id` in filterable fields
|
||||
- useEffect hook reacts to `activeSite?.id` changes to trigger reload
|
||||
- Content cleared when no site selected
|
||||
|
||||
**Site Selector Fix (Jan 2026):**
|
||||
- Fixed circular dependency in useEffect (lines 285-294)
|
||||
- Only depends on `activeSite?.id`, not on callback functions
|
||||
- Added console logging for debugging site changes
|
||||
- Pattern follows Dashboard and Approved pages
|
||||
|
||||
**Backend Filter Configuration:**
|
||||
```python
|
||||
# backend/igny8_core/modules/writer/views.py
|
||||
class ContentFilter(django_filters.FilterSet):
|
||||
class Meta:
|
||||
model = Content
|
||||
fields = [
|
||||
'cluster_id',
|
||||
'site_id', # Required for site filtering
|
||||
'status',
|
||||
'site_status', # Required for status filtering
|
||||
'content_type',
|
||||
# ...
|
||||
]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Celery Tasks
|
||||
|
||||
### 1. `schedule_approved_content`
|
||||
@@ -249,7 +293,28 @@ POST /api/v1/writer/content/{id}/unschedule/
|
||||
|
||||
## Monitoring & Debugging
|
||||
|
||||
### Log Files
|
||||
### Frontend Debugging
|
||||
|
||||
**Browser Console Logs:**
|
||||
When changing sites in Content Calendar, you should see:
|
||||
```
|
||||
[ContentCalendar] Site changed to: 45 My Site Name
|
||||
[ContentCalendar] Triggering loadQueue...
|
||||
```
|
||||
|
||||
**Check Site Filtering:**
|
||||
1. Open browser DevTools → Network tab
|
||||
2. Change site in site selector
|
||||
3. Look for API calls to `/api/v1/writer/content/`
|
||||
4. Verify `site_id` parameter is included in query string
|
||||
5. Verify count matches database for that site
|
||||
|
||||
**Common Issues:**
|
||||
- No console logs when changing sites → useEffect not triggering (refresh page)
|
||||
- API calls missing `site_id` parameter → backend filter not working
|
||||
- Wrong count displayed → database query issue or cache problem
|
||||
|
||||
### Backend Log Files
|
||||
- **Publish Logs:** `backend/logs/publish-sync-logs/`
|
||||
- **API Logs:** `backend/logs/wordpress_api.log`
|
||||
|
||||
@@ -276,6 +341,16 @@ Content.objects.filter(
|
||||
site_status='scheduled',
|
||||
scheduled_publish_at__gt=timezone.now()
|
||||
).order_by('scheduled_publish_at')[:10]
|
||||
|
||||
# Check scheduled content for specific site
|
||||
site_id = 45
|
||||
Content.objects.filter(
|
||||
site_id=site_id,
|
||||
site_status='scheduled'
|
||||
).count()
|
||||
|
||||
# Compare with frontend display
|
||||
# Should match count shown in Content Calendar for that site
|
||||
```
|
||||
|
||||
### Manual Task Execution
|
||||
@@ -340,12 +415,40 @@ for content in failed_content:
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Site Selector Not Updating Content Calendar
|
||||
|
||||
**Symptoms:**
|
||||
- Changing sites doesn't reload calendar content
|
||||
- Count shows wrong number of scheduled items
|
||||
- Content from wrong site displayed
|
||||
|
||||
**Solution:**
|
||||
1. **Hard refresh browser:** Ctrl+F5 (Windows/Linux) or Cmd+Shift+R (Mac)
|
||||
2. **Clear browser cache**
|
||||
3. **Check console logs:** Should see `[ContentCalendar] Site changed to: ...`
|
||||
4. **Verify API calls:** Check Network tab for `site_id` parameter
|
||||
|
||||
**What Was Fixed (Jan 2026):**
|
||||
- Frontend: Fixed useEffect circular dependency in ContentCalendar.tsx
|
||||
- Backend: Added `site_id` and `site_status` to ContentFilter fields
|
||||
- All API queries now properly filter by `site_id: activeSite.id`
|
||||
- Content clears when no site selected
|
||||
|
||||
**If Problem Persists:**
|
||||
```bash
|
||||
# Check backend filter configuration
|
||||
grep -n "site_id" backend/igny8_core/modules/writer/views.py
|
||||
|
||||
# Should show site_id in ContentFilter.Meta.fields
|
||||
```
|
||||
|
||||
### Content Not Being Scheduled
|
||||
|
||||
1. Check `PublishingSettings.auto_publish_enabled` is `True`
|
||||
2. Verify content has `status='approved'` and `site_status='not_published'`
|
||||
3. Check `scheduled_publish_at` is null (already scheduled content won't reschedule)
|
||||
4. Verify publish limits haven't been reached
|
||||
5. **Verify correct site selected** in site selector
|
||||
|
||||
### Content Not Publishing
|
||||
|
||||
|
||||
Reference in New Issue
Block a user