fix: update Paperless webhook payload to match include_document format
Build and Push / build (release) Successful in 30s

- Change model field from document_id to id (Paperless sends id)
- Add content, created, modified, added, original_file_name, owner fields
- Add extra="ignore" config to handle additional Paperless fields
- Update sync service to use content from webhook payload
- Skip Paperless API call when content already provided

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-25 14:38:40 +01:00
co-authored by Claude Opus 4.5
parent f4352841a2
commit f2b8c7d111
5 changed files with 70 additions and 33 deletions
+9 -7
View File
@@ -64,12 +64,12 @@ async def receive_webhook(
"""
from src.services.document_sync_service import DocumentSyncService
logger.info(f"Webhook received: document_id={payload.document_id}, event={payload.event}")
logger.info(f"Webhook received: document_id={payload.id}, title={payload.title}")
settings = get_settings()
if not settings.document_store_enabled:
return WebhookResponse(
document_id=payload.document_id,
document_id=payload.id,
status="skipped",
indexed=False,
message="Document store is disabled"
@@ -86,21 +86,23 @@ async def receive_webhook(
)
result = await sync_service.index_document(
document_id=payload.document_id,
user=user
document_id=payload.id,
user=user,
content=payload.content, # Use content from webhook payload
title=payload.title,
)
return WebhookResponse(
document_id=payload.document_id,
document_id=payload.id,
status="indexed" if result.success else "failed",
indexed=result.success,
message=result.error if not result.success else f"Indexed: {result.title}"
)
except Exception as e:
logger.error(f"Webhook processing failed for document {payload.document_id}: {e}", exc_info=True)
logger.error(f"Webhook processing failed for document {payload.id}: {e}", exc_info=True)
return WebhookResponse(
document_id=payload.document_id,
document_id=payload.id,
status="error",
indexed=False,
message=str(e)