in source/core-api/lambda_functions/get_waiting_num.py [0:0]
def lambda_handler(event, context):
"""
This function is the entry handler for Lambda.
"""
print(event)
client_event_id = deep_clean(event['queryStringParameters']['event_id'])
headers = {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*'
}
if client_event_id == EVENT_ID:
queue_count = int(rc.get(QUEUE_COUNTER))
token_count = int(rc.get(TOKEN_COUNTER))
waiting_num = queue_count - token_count
response = {
"statusCode": 200,
"headers": headers,
"body": json.dumps({"waiting_num": waiting_num})
}
else:
response = {
"statusCode": 400,
"headers": headers,
"body": json.dumps({"error": "Invalid event ID"})
}
return response