Spaces:
Runtime error
Runtime error
chrisaka commited on
Commit ·
35b5a11
1
Parent(s): 08e7501
fix: serialize date objects in espaces routes
Browse files- app/routers/espaces.py +5 -0
app/routers/espaces.py
CHANGED
|
@@ -28,6 +28,8 @@ async def create_espace(
|
|
| 28 |
"""Crée un nouvel espace (cabinet). Superadmin only."""
|
| 29 |
data = payload.model_dump()
|
| 30 |
data["is_archived"] = False
|
|
|
|
|
|
|
| 31 |
response = supabase_admin.table("espaces").insert(data).execute()
|
| 32 |
if not response.data:
|
| 33 |
raise HTTPException(
|
|
@@ -92,6 +94,9 @@ async def update_espace(
|
|
| 92 |
if not data:
|
| 93 |
raise HTTPException(status_code=400, detail="Aucune donnée à modifier")
|
| 94 |
|
|
|
|
|
|
|
|
|
|
| 95 |
response = (
|
| 96 |
supabase_admin.table("espaces")
|
| 97 |
.update(data)
|
|
|
|
| 28 |
"""Crée un nouvel espace (cabinet). Superadmin only."""
|
| 29 |
data = payload.model_dump()
|
| 30 |
data["is_archived"] = False
|
| 31 |
+
if "date_expiration_abonnement" in data and data["date_expiration_abonnement"]:
|
| 32 |
+
data["date_expiration_abonnement"] = data["date_expiration_abonnement"].isoformat()
|
| 33 |
response = supabase_admin.table("espaces").insert(data).execute()
|
| 34 |
if not response.data:
|
| 35 |
raise HTTPException(
|
|
|
|
| 94 |
if not data:
|
| 95 |
raise HTTPException(status_code=400, detail="Aucune donnée à modifier")
|
| 96 |
|
| 97 |
+
if "date_expiration_abonnement" in data and data["date_expiration_abonnement"]:
|
| 98 |
+
data["date_expiration_abonnement"] = data["date_expiration_abonnement"].isoformat()
|
| 99 |
+
|
| 100 |
response = (
|
| 101 |
supabase_admin.table("espaces")
|
| 102 |
.update(data)
|