tueniuu commited on
Commit
1e14947
·
verified ·
1 Parent(s): 5301294

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -65,13 +65,13 @@ async def get_itinerary_data(authorization: str = Header(...)):
65
 
66
  # 4. Query Supabase for the itinerary data
67
  # Using the admin client bypasses RLS, which is what we want here
68
- response = supabase.table("itineraries").select("itinerary_data").eq("user_id", user_id).single().execute()
 
 
 
 
69
 
70
- # Check for errors from Supabase (e.g., no rows found)
71
- if not response.data:
72
- raise HTTPException(status_code=404, detail="Itinerary not found for this user")
73
-
74
- # 5. Return the data
75
  return response.data
76
 
77
  except JWTError:
 
65
 
66
  # 4. Query Supabase for the itinerary data
67
  # Using the admin client bypasses RLS, which is what we want here
68
+ response = supabase.table("itineraries") \
69
+ .select("id, created_at, itinerary_data") \
70
+ .eq("user_id", user_id) \
71
+ .order("created_at", desc=True) \
72
+ .execute()
73
 
74
+ # 5. Return the list of data
 
 
 
 
75
  return response.data
76
 
77
  except JWTError: