Commit Graph

44 Commits

Author SHA1 Message Date
root
9a1eb5bf0b Remove lock checking and setting from event step, keep only deletion in finally 2025-10-24 00:44:31 +00:00
root
f6bcbe664c Fix event handler signature to async def handler(event_data, context) 2025-10-24 00:38:12 +00:00
root
d18187f3aa Change event topic to calendar_sync_employee without dots to fix INVALID EMIT 2025-10-24 00:29:09 +00:00
root
6d2089ec69 Ensure Redis lock is always released with finally block 2025-10-24 00:26:18 +00:00
root
9ca3191542 Add flows to API and cron steps to fix INVALID EMIT error 2025-10-24 00:22:51 +00:00
root
b70619ab2d Update API step to trigger sync for specific employee with kuerzel 2025-10-24 00:20:41 +00:00
root
8e9dc87b2a Refactor calendar sync for parallel processing: cron emits per-employee events, event-step processes one employee with per-employee locks 2025-10-24 00:19:34 +00:00
root
409bea3615 Update logging to use Motia workbench context for visibility 2025-10-24 00:12:53 +00:00
root
ddad58faa3 Refactor calendar sync phases into separate functions for better modularity 2025-10-24 00:10:09 +00:00
root
c91d3fc76d Fix 'adv_map' not defined error by correcting state dict references 2025-10-24 00:08:18 +00:00
root
11ca7a5e75 Add missing phase functions to event step 2025-10-23 23:58:53 +00:00
root
3a1ed1ee55 Refactor calendar sync: move employee loop to cron step, parallel sync per employee 2025-10-23 23:57:51 +00:00
root
d15bd04167 Fix variable references in calendar sync after refactoring 2025-10-23 23:53:38 +00:00
root
a6d061a708 Refactor calendar sync: reduce redundancies, remove dead code, improve structure
- Remove unused share_google_calendar function
- Add centralized log_operation for consistent logging with context
- Add get_timestamps helper for Phase 4 timestamp handling
- Consolidate safe_* functions into generic safe_advoware_operation
- Optimize reload functions to handle initial fetches
- Split standardize_appointment_data into parse_times, adjust_times, build_notiz helpers
- Use state dict for better encapsulation in handler
2025-10-23 23:48:16 +00:00
root
42949c6871 Fix systemd service for automatic Motia startup 2025-10-23 23:37:52 +00:00
root
5ef77c91d5 Fix Advoware time filtering pitfall: extend ranges (Advoware -1 to +9 years, Google -2 to +10 years) and document issue in README 2025-10-23 23:28:49 +00:00
root
db1206f91c Fix recurring event duplication - handle recurringEventId properly in all phases 2025-10-23 18:46:49 +00:00
root
da2b9960b0 Fix recurring event duplication - handle recurringEventId properly in all phases 2025-10-23 18:30:46 +00:00
root
ddd64a5e0f Fix critical bug: End date for recurring events should use 'datum' not 'datumBis'
- Fixed: For recurring appointments (dauertermin=1), end date now correctly uses 'datum' instead of 'datumBis'
- 'datumBis' is only for recurrence series end, not individual event duration
- Events now have correct duration instead of being capped at 24h unnecessarily
- Updated README with detailed explanation of the bug and fix
- Time breakdowns in descriptions are now accurate
2025-10-23 18:12:02 +00:00
root
08b21ef268 Fix cron handler signature: remove event parameter from cron step
- Fix calendar_sync_cron_step.py handler signature from (event, context) to (context)
- Cron steps only receive context parameter, not event
2025-10-23 17:33:58 +00:00
root
080eebd5ea Fix calendar sync issues: correct True/False, limit recurrence to 2 years, add share_google_calendar function
- Fix Python syntax error: change 'true' to 'True' in config.py
- Limit recurring events to max 2 years to avoid Google Calendar API limits
- Add share_google_calendar function for manual calendar sharing
- Update README with calendar sync documentation
- Debug mode: limit sync to user AI only
2025-10-23 13:53:51 +00:00
root
974116c024 Sync all employees in loop, remove employee_kuerzel requirement, update README 2025-10-23 13:02:52 +00:00
root
7b6e287b66 Remove AI limit, update README, fix update loops by setting last_sync to post-update time 2025-10-23 12:57:33 +00:00
root
48ce8d8e73 Add exponential backoff for Google API calls
- Use backoff library with 5s base, max 5 tries for HttpError 429/5xx
- Decorate Google functions: ensure_calendar, fetch_events, create/update/delete events
- Add backoff to requirements.txt
2025-10-23 12:49:45 +00:00
root
0d758b07ea Fix KeyError in Phase 3 recreate: use str(frnr) for adv_map key
- adv_map keys are str, frnr is int, so adv_map[str(frnr)] fixes KeyError
2025-10-23 12:44:54 +00:00
root
9312586f18 Fix Advoware timestamp parsing bug causing sync loops
- Change .replace(tzinfo=BERLIN_TZ) to BERLIN_TZ.localize() for correct pytz TZ handling
- Update Phase 4 to use proper TZ localization for adv_ts
- Add documentation section on correct Advoware timestamp handling
- Add .gitignore, GOOGLE_SETUP_README.md, and check_db.py utility
2025-10-23 12:43:22 +00:00
root
0d54243e9d Fix Phase 3 logic for symmetric delete handling: remove 'sb' field, add employee_kuerzel to updates, correct missing event recreation/deletion based on source_system 2025-10-23 11:53:24 +00:00
root
9f50f201df Fix Phase 4 in calendar sync to reset unauthorized changes in target system based on timestamps for source_system_wins strategy 2025-10-23 11:26:25 +00:00
root
7d5403b4af Fix calendar sync Phase 3 logic for missing Advoware appointments when source is Google; update README with Advoware API peculiarities 2025-10-23 11:13:15 +00:00
root
96fa1f58f5 Update log message for Phase 3 delete operation to reflect the corrected logic. 2025-10-23 10:51:08 +00:00
root
6a72809817 Fix Phase 3 logic for source_system_wins: when Google event is missing and source is Google, propagate delete to Advoware instead of recreating. 2025-10-23 10:49:25 +00:00
root
ed669f8561 Fix Phase 3 delete logic for source_system_wins: propagate delete to Google when Advoware appointment is missing and source is Advoware, instead of recreating. 2025-10-23 10:42:49 +00:00
root
9ab90fef5a Fix timestamp-based update logic and remove global last_sync update to prevent redundant syncs and race conditions. Update README with anonymization and latest changes. 2025-10-23 10:40:00 +00:00
root
1de5bcd369 Pre-optimization commit: Calendar sync implementation with hub design 2025-10-23 08:29:46 +00:00
root
2f9203cac2 Add calendar sync step files: API, cron, and event handlers for bidirectional Advoware-Google Calendar sync 2025-10-22 23:37:28 +00:00
root
0a4317c44a Update README.md with comprehensive documentation of Advoware Calendar Sync implementation, including API quirks, token security, and known issues 2025-10-22 23:36:21 +00:00
root
c897f4c39d Fix: Logger-Aufrufe durch print statements ersetzt
- Alle context.logger Aufrufe durch print() ersetzt
- Behebt 'Logger object has no attribute' Fehler
- Temporäre Lösung bis Logger-API geklärt ist
2025-10-22 19:08:00 +00:00
root
805a1cce3e Fix: context Parameter für get_google_service Funktion
- context als Parameter an get_google_service() übergeben
- Behebt 'name context is not defined' Fehler
2025-10-22 19:06:07 +00:00
root
76a236ac37 Google Calendar Sync graceful handling für fehlende Credentials
- Graceful Fallback wenn token.pickle nicht vorhanden
- Warning statt Exception bei fehlenden Google Credentials
- Sync wird übersprungen statt zu crashen
2025-10-22 19:05:16 +00:00
root
83a154a4a5 Neuer Advoware Calendar Sync implementiert
- steps/advoware_cal_sync/advoware_calendar_sync_step.py: Bidirektionale Sync zwischen Advoware und Google Calendar
- Automatische Kalender-Erstellung für jeden Mitarbeiter (AW-{Kuerzel})
- Konfigurierbare Sync-Optionen (volle Details vs. nur 'blocked')
- Google Calendar API Integration mit OAuth
- Mitarbeiter- und Termin-API Integration
- Umfassende Fehlerbehandlung und Logging
- steps/advoware_cal_sync/README.md: Detaillierte Dokumentation
- requirements.txt: Google API Dependencies hinzugefügt
- motia-workbench.json: Neuer advoware_cal_sync Flow
2025-10-22 19:01:30 +00:00
root
d715fca5f5 Aufteilung der README.md in modulare Dokumentation
- Haupt-README.md behält Übersicht und Links zu detaillierten READMEs
- steps/advoware_proxy/README.md: Detaillierte Dokumentation der 4 Proxy-Steps
- steps/vmh/README.md: Detaillierte Dokumentation der Webhook-Receiver und Sync-Steps
- Verbesserte Navigation und modulare Dokumentationsstruktur
2025-10-20 11:46:30 +00:00
root
805d8c7362 Vollständige Advoware-EspoCRM Integration implementiert
- Advoware API Proxy für alle HTTP-Methoden (GET/POST/PUT/DELETE)
- EspoCRM Webhook-Receiver für Beteiligte CRUD-Operationen
- Redis-basierte Deduplikation für Webhook-Events
- Event-driven Synchronisations-Handler (Placeholder)
- Detaillierte README.md mit Setup und Verwendungsanleitung
- Fehlerbehebungen für Context-Attribute und Redis-Verbindungen
2025-10-20 11:42:52 +00:00
root
1f893812b2 Clean up Advoware proxy steps: remove redundant /api/ from paths, simplify method-specific code, and fix DELETE json_data 2025-10-19 16:03:11 +00:00
root
273aa8b549 Initial commit with Advoware proxy 2025-10-19 14:57:07 +00:00