feat: Implement Advoware Document Sync Handler

- Added advoware_document_sync_step.py to handle 3-way merge sync for documents.
- Introduced locking mechanism for per-Akte synchronization to allow parallel processing.
- Integrated data fetching from EspoCRM, Windows files, and Advoware history.
- Implemented 3-way merge logic for document synchronization and metadata updates.
- Triggered document preview generation for new/changed documents.

feat: Create Shared Steps Module

- Added shared/__init__.py for shared steps across multiple modules.
- Introduced generate_document_preview_step.py for generating document previews.
- Implemented logic to download documents, generate previews, and upload to EspoCRM.

feat: Add VMH Document xAI Sync Handler

- Created document_xai_sync_step.py to manage document synchronization with xAI collections.
- Handled create, update, and delete actions for documents in EspoCRM.
- Integrated logic for triggering preview generation and managing xAI collections.
- Implemented error handling and logging for synchronization processes.
This commit is contained in:
bsiggel
2026-03-26 01:00:49 +00:00
parent d78a4ee67e
commit 86ec4db9db
6 changed files with 279 additions and 106 deletions

View File

@@ -27,7 +27,7 @@ class SyncAction:
"""
action: Literal['CREATE', 'UPDATE_ESPO', 'UPLOAD_WINDOWS', 'DELETE', 'SKIP']
reason: str
source: Literal['Windows', 'EspoCRM', 'None']
source: Literal['Windows', 'EspoCRM', 'Both', 'None']
needs_upload: bool
needs_download: bool
@@ -149,15 +149,26 @@ class AdvowareDocumentSyncUtils:
needs_download=True
)
# Case 2: File only in EspoCRM → UPLOAD to Windows
# Case 2: File only in EspoCRM → DELETE (file was deleted from Windows/Advoware)
if espo_doc and not windows_file:
return SyncAction(
action='UPLOAD_WINDOWS',
reason='File exists in EspoCRM but not in Windows',
source='EspoCRM',
needs_upload=True,
needs_download=False
)
# Check if also not in History (means it was deleted in Advoware)
if not advo_history:
return SyncAction(
action='DELETE',
reason='File deleted from Windows and Advoware History',
source='Both',
needs_upload=False,
needs_download=False
)
else:
# Still in History but not in Windows - Upload not implemented
return SyncAction(
action='UPLOAD_WINDOWS',
reason='File exists in EspoCRM/History but not in Windows',
source='EspoCRM',
needs_upload=True,
needs_download=False
)
# Case 3: File in both → Compare hashes and USNs
if espo_doc and windows_file: