Fix event handler signature to async def handler(event_data, context)

This commit is contained in:
root
2025-10-24 00:38:12 +00:00
parent d18187f3aa
commit f6bcbe664c
2 changed files with 4 additions and 3 deletions

View File

@@ -12,7 +12,8 @@ config = {
'flows': ['advoware'] 'flows': ['advoware']
} }
async def handler(req, context): async def handler(req):
context = req.context
try: try:
# Konfiguration aus Request-Body # Konfiguration aus Request-Body
body = req.get('body', {}) body = req.get('body', {})

View File

@@ -14,7 +14,7 @@ config = {
'flows': ['advoware'] 'flows': ['advoware']
} }
async def get_advoware_employees(advoware): async def get_advoware_employees(context, advoware):
"""Fetch list of employees from Advoware.""" """Fetch list of employees from Advoware."""
try: try:
result = await advoware.api_call('api/v1/advonet/Mitarbeiter', method='GET', params={'aktiv': 'true'}) result = await advoware.api_call('api/v1/advonet/Mitarbeiter', method='GET', params={'aktiv': 'true'})
@@ -33,7 +33,7 @@ async def handler(context):
advoware = AdvowareAPI(context) advoware = AdvowareAPI(context)
# Fetch employees # Fetch employees
employees = await get_advoware_employees(advoware) employees = await get_advoware_employees(context, advoware)
if not employees: if not employees:
context.logger.error("Keine Mitarbeiter gefunden. Cron abgebrochen.") context.logger.error("Keine Mitarbeiter gefunden. Cron abgebrochen.")
return {'status': 500, 'body': {'error': 'Keine Mitarbeiter gefunden'}} return {'status': 500, 'body': {'error': 'Keine Mitarbeiter gefunden'}}