Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -31,7 +31,7 @@ async def handler(request: ApiRequest, ctx: FlowContext[Any]) -> ApiResponse:
|
||||
|
||||
if not entity_ids:
|
||||
ctx.logger.warn("⚠️ No entity IDs in payload")
|
||||
return ApiResponse(status_code=400, body={"error": "No entity ID found in payload"})
|
||||
return ApiResponse(status=400, body={"error": "No entity ID found in payload"})
|
||||
|
||||
for eid in entity_ids:
|
||||
await ctx.enqueue({'topic': 'akte.sync', 'data': {'akte_id': eid, 'aktennummer': None}})
|
||||
@@ -39,8 +39,8 @@ async def handler(request: ApiRequest, ctx: FlowContext[Any]) -> ApiResponse:
|
||||
ctx.logger.info(f"✅ Emitted akte.sync for {len(entity_ids)} ID(s): {entity_ids}")
|
||||
ctx.logger.info("=" * 60)
|
||||
|
||||
return ApiResponse(status_code=200, body={"status": "received", "action": "create", "ids_count": len(entity_ids)})
|
||||
return ApiResponse(status=200, body={"status": "received", "action": "create", "ids_count": len(entity_ids)})
|
||||
|
||||
except Exception as e:
|
||||
ctx.logger.error(f"❌ Webhook error: {e}")
|
||||
return ApiResponse(status_code=500, body={"error": str(e)})
|
||||
return ApiResponse(status=500, body={"error": str(e)})
|
||||
|
||||
Reference in New Issue
Block a user