Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
-
#
|
| 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:
|