Production Release: RestDays Widget + Trainingstyp Fix #16
|
|
@ -7,6 +7,7 @@ import logging
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from fastapi import APIRouter, HTTPException, Depends
|
from fastapi import APIRouter, HTTPException, Depends
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
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, require_admin
|
from auth import require_auth, require_admin
|
||||||
|
|
@ -103,7 +104,7 @@ def create_training_type(data: TrainingTypeCreate, session: dict = Depends(requi
|
||||||
data.description_de,
|
data.description_de,
|
||||||
data.description_en,
|
data.description_en,
|
||||||
data.sort_order,
|
data.sort_order,
|
||||||
abilities_json
|
Json(abilities_json)
|
||||||
))
|
))
|
||||||
|
|
||||||
new_id = cur.fetchone()['id']
|
new_id = cur.fetchone()['id']
|
||||||
|
|
@ -153,7 +154,7 @@ def update_training_type(
|
||||||
values.append(data.sort_order)
|
values.append(data.sort_order)
|
||||||
if data.abilities is not None:
|
if data.abilities is not None:
|
||||||
updates.append("abilities = %s")
|
updates.append("abilities = %s")
|
||||||
values.append(data.abilities)
|
values.append(Json(data.abilities))
|
||||||
|
|
||||||
if not updates:
|
if not updates:
|
||||||
raise HTTPException(400, "No fields to update")
|
raise HTTPException(400, "No fields to update")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user