[server]: Cleaner code for return_newest_data

This commit is contained in:
2025-02-28 14:18:34 +00:00
parent 908f75e386
commit 1e50355db7

View File

@ -18,7 +18,8 @@ def lambda_handler(event, context):
# assuming that filtering by timestamp first makes sense, as we expect to have a lot of historical data and not many object types
if 'queryStringParameters' in event and event['queryStringParameters'] and 'objectType' in event['queryStringParameters']:
newest_items = [item for item in items if item['objectType'] == event['queryStringParameters']['objectType']]
objectType = event['queryStringParameters']['objectType']
newest_items = [item for item in newest_items if item['objectType'] == objectType]
return {
'statusCode': 200,