Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -376,14 +376,9 @@ async def post_to_url(background_tasks: BackgroundTasks, url: str, json: dict):
|
|
| 376 |
logging.error(f"Unexpected response from Google Apps Script API: {response.status_code} - {response.text}")
|
| 377 |
raise HTTPException(status_code=500, detail="Error from external API.")
|
| 378 |
|
| 379 |
-
class Item(BaseModel):
|
| 380 |
-
userRef: str
|
| 381 |
-
syncType: str
|
| 382 |
-
status: int
|
| 383 |
-
|
| 384 |
@app.post('/update-userdoc')
|
| 385 |
-
async def update_user_doc(item:
|
| 386 |
-
data =
|
| 387 |
user_doc = users_ref.document(data['userRef'])
|
| 388 |
# get the 'total_uploaded' field from the user's document
|
| 389 |
user_data = user_doc.get().to_dict()
|
|
|
|
| 376 |
logging.error(f"Unexpected response from Google Apps Script API: {response.status_code} - {response.text}")
|
| 377 |
raise HTTPException(status_code=500, detail="Error from external API.")
|
| 378 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 379 |
@app.post('/update-userdoc')
|
| 380 |
+
async def update_user_doc(item: str, background_tasks: BackgroundTasks):
|
| 381 |
+
data = json.loads(item)
|
| 382 |
user_doc = users_ref.document(data['userRef'])
|
| 383 |
# get the 'total_uploaded' field from the user's document
|
| 384 |
user_data = user_doc.get().to_dict()
|