Update app.py
Browse files
app.py
CHANGED
|
@@ -325,7 +325,7 @@ async def track_order(user_id: str, order_id: str) -> str:
|
|
| 325 |
response += f"\n{eta}"
|
| 326 |
return response
|
| 327 |
|
| 328 |
-
|
| 329 |
async with async_session() as session:
|
| 330 |
result = await session.execute(
|
| 331 |
select(UserProfile).where(UserProfile.user_id == user_id)
|
|
@@ -335,14 +335,13 @@ async def track_order(user_id: str, order_id: str) -> str:
|
|
| 335 |
if phone_number:
|
| 336 |
profile.phone_number = phone_number
|
| 337 |
if address:
|
| 338 |
-
# Assuming
|
| 339 |
-
profile.address = address
|
| 340 |
else:
|
| 341 |
profile = UserProfile(user_id=user_id, phone_number=phone_number)
|
| 342 |
session.add(profile)
|
| 343 |
await session.commit()
|
| 344 |
|
| 345 |
-
|
| 346 |
async def update_user_profile_with_order(user_id: str, order_id: str):
|
| 347 |
async with async_session() as session:
|
| 348 |
result = await session.execute(
|
|
|
|
| 325 |
response += f"\n{eta}"
|
| 326 |
return response
|
| 327 |
|
| 328 |
+
async def update_user_profile(user_id: str, phone_number: str = None, address: str = None):
|
| 329 |
async with async_session() as session:
|
| 330 |
result = await session.execute(
|
| 331 |
select(UserProfile).where(UserProfile.user_id == user_id)
|
|
|
|
| 335 |
if phone_number:
|
| 336 |
profile.phone_number = phone_number
|
| 337 |
if address:
|
| 338 |
+
# Assuming your UserProfile has an 'address' field; otherwise, adjust accordingly.
|
| 339 |
+
profile.address = address
|
| 340 |
else:
|
| 341 |
profile = UserProfile(user_id=user_id, phone_number=phone_number)
|
| 342 |
session.add(profile)
|
| 343 |
await session.commit()
|
| 344 |
|
|
|
|
| 345 |
async def update_user_profile_with_order(user_id: str, order_id: str):
|
| 346 |
async with async_session() as session:
|
| 347 |
result = await session.execute(
|