Production Release: RestDays Widget + Trainingstyp Fix #16
|
|
@ -9,6 +9,7 @@ from datetime import datetime, timedelta
|
||||||
|
|
||||||
from fastapi import APIRouter, HTTPException, Depends, Header
|
from fastapi import APIRouter, HTTPException, Depends, Header
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
from psycopg2.extras import Json
|
||||||
|
|
||||||
from db import get_db, get_cursor, r2d
|
from db import get_db, get_cursor, r2d
|
||||||
from auth import require_auth
|
from auth import require_auth
|
||||||
|
|
@ -103,7 +104,7 @@ def create_rest_day(
|
||||||
note = EXCLUDED.note
|
note = EXCLUDED.note
|
||||||
RETURNING id, profile_id, date, rest_config, note, created_at
|
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()
|
result = cur.fetchone()
|
||||||
|
|
@ -161,7 +162,7 @@ def update_rest_day(
|
||||||
|
|
||||||
if data.rest_config:
|
if data.rest_config:
|
||||||
updates.append("rest_config = %s")
|
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:
|
if data.note is not None:
|
||||||
updates.append("note = %s")
|
updates.append("note = %s")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user