fix: Update metadata synchronization logic to always sync changes and correct field mappings

This commit is contained in:
bsiggel
2026-03-25 21:34:18 +00:00
parent 1ffc37b0b7
commit 50c5070894
2 changed files with 27 additions and 15 deletions

View File

@@ -240,6 +240,9 @@ async def handler(event_data: Dict[str, Any], ctx: FlowContext) -> None:
# Extract full Windows path from watcher data
full_path = windows_file.get('path', '')
# Current timestamp for sync tracking
now_iso = datetime.now().isoformat()
new_doc = await espocrm.create_entity('CDokumente', {
'name': filename,
'dokumentId': attachment.get('id'), # Link to attachment
@@ -252,7 +255,8 @@ async def handler(event_data: Dict[str, Any], ctx: FlowContext) -> None:
'blake3hash': blake3_hash,
'syncedHash': blake3_hash,
'usn': windows_file.get('usn', 0),
'syncStatus': 'synced'
'syncStatus': 'synced',
'lastSyncTimestamp': now_iso
})
doc_id = new_doc.get('id')
@@ -281,12 +285,15 @@ async def handler(event_data: Dict[str, Any], ctx: FlowContext) -> None:
# Update document in EspoCRM with correct field names
ctx.logger.info(f"💾 Updating document in EspoCRM...")
now_iso = datetime.now().isoformat()
update_data = {
'blake3hash': blake3_hash,
'syncedHash': blake3_hash,
'usn': windows_file.get('usn', 0),
'dateipfad': full_path,
'syncStatus': 'synced'
'syncStatus': 'synced',
'lastSyncTimestamp': now_iso
}
# Also update History fields if available