fix: use field ID for Paperless custom field updates

Paperless API requires field ID (integer) not field name (string)
when updating custom fields. Now looks up field ID by name before
updating library_indexed custom field.

Also includes webhook debugging endpoint for development.

🤖 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 16:37:26 +01:00
co-authored by Claude Opus 4.5
parent f2b8c7d111
commit 867de65354
4 changed files with 159 additions and 27 deletions
+7 -4
View File
@@ -281,10 +281,13 @@ class DocumentSyncService:
"""Mark document as indexed in Paperless custom field."""
# Try to update library_indexed custom field if it exists
try:
await self.paperless.update_document(
document_id=document_id,
custom_fields=[{"field": "library_indexed", "value": True}]
)
# Look up field ID by name (Paperless requires ID, not name)
field = await self.paperless.get_custom_field_by_name("library_indexed")
if field:
await self.paperless.update_document(
document_id=document_id,
custom_fields=[{"field": field["id"], "value": True}]
)
except Exception:
# Field might not exist, that's OK
pass