diff --git a/backend/routers/rest_days.py b/backend/routers/rest_days.py index 3177a0e..3fef4cd 100644 --- a/backend/routers/rest_days.py +++ b/backend/routers/rest_days.py @@ -9,6 +9,7 @@ from datetime import datetime, timedelta from fastapi import APIRouter, HTTPException, Depends, Header from pydantic import BaseModel, Field +from psycopg2.extras import Json from db import get_db, get_cursor, r2d from auth import require_auth @@ -103,7 +104,7 @@ def create_rest_day( note = EXCLUDED.note RETURNING id, profile_id, date, rest_config, note, created_at """, - (pid, data.date, config_dict, data.note) + (pid, data.date, Json(config_dict), data.note) ) result = cur.fetchone() @@ -161,7 +162,7 @@ def update_rest_day( if data.rest_config: updates.append("rest_config = %s") - values.append(data.rest_config.model_dump()) + values.append(Json(data.rest_config.model_dump())) if data.note is not None: updates.append("note = %s")