2.3 KiB
2.3 KiB
type, category, name, version, status, tags, dependencies, emits
| type | category | name | version | status | tags | dependencies | emits | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| step | api | Calendar Sync API | 1.0.0 | active |
|
|
|
Calendar Sync API Step
Zweck
Manueller Trigger für Calendar-Synchronisation via HTTP-Endpoint. Ermöglicht Sync für alle oder einzelne Mitarbeiter.
Config
{
'type': 'api',
'name': 'Calendar Sync API',
'path': '/advoware/calendar/sync',
'method': 'POST',
'emits': ['calendar_sync_all', 'calendar_sync_employee'],
'flows': ['advoware_cal_sync']
}
Input
POST /advoware/calendar/sync
Content-Type: application/json
{
"kuerzel": "ALL", # or specific: "SB"
"full_content": true
}
Parameters:
kuerzel(optional): "ALL" oder Mitarbeiter-Kürzel (default: "ALL")full_content(optional): true = volle Details, false = anonymisiert (default: true)
Output
{
"status": "triggered",
"kuerzel": "ALL",
"message": "Calendar sync triggered for ALL"
}
Verhalten
Case 1: ALL (oder kein kuerzel):
- Emit
calendar_sync_allevent calendar_sync_all_stepfetcht alle Employees- Pro Employee: Emit
calendar_sync_employee
Case 2: Specific Employee (z.B. "SB"):
- Set Redis Lock:
calendar_sync:lock:SB - Emit
calendar_sync_employeeevent direkt - Lock verhindert parallele Syncs für denselben Employee
Redis Locking
lock_key = f'calendar_sync:lock:{kuerzel}'
redis_client.set(lock_key, '1', nx=True, ex=300) # 5min TTL
Testing
# Sync all employees
curl -X POST "http://localhost:3000/advoware/calendar/sync" \
-H "Content-Type: application/json" \
-d '{"full_content": true}'
# Sync single employee
curl -X POST "http://localhost:3000/advoware/calendar/sync" \
-H "Content-Type: application/json" \
-d '{"kuerzel": "SB", "full_content": true}'
# Sync with anonymization
curl -X POST "http://localhost:3000/advoware/calendar/sync" \
-H "Content-Type: application/json" \
-d '{"kuerzel": "SB", "full_content": false}'
Error Handling
- Lock active: Wartet oder gibt Fehler zurück
- Invalid kuerzel: Wird an all_step oder event_step weitergegeben
Related
- calendar_sync_all_step.md - Handles "ALL"
- calendar_sync_event_step.md - Per-employee sync