🐛 Fix import for categories

This commit is contained in:
itskovacs 2025-07-30 08:48:31 +02:00
parent 7b597e2a35
commit fe08fa3a2f
2 changed files with 3 additions and 3 deletions

View File

@ -1 +1 @@
__version__ = "1.8.0" __version__ = "1.8.1"

View File

@ -95,7 +95,7 @@ async def import_data(
raise HTTPException(status_code=400, detail="Invalid file") raise HTTPException(status_code=400, detail="Invalid file")
for category in data.get("categories", []): for category in data.get("categories", []):
category_name = category.get("category", {}).get("name") category_name = category.get("name")
category_exists = session.exec( category_exists = session.exec(
select(Category).filter(Category.user == current_user, Category.name == category_name) select(Category).filter(Category.user == current_user, Category.name == category_name)
).first() ).first()
@ -126,7 +126,7 @@ async def import_data(
new_category = Category(**category_data) new_category = Category(**category_data)
session.add(new_category) session.add(new_category)
session.flush() session.flush()
session.refresh() session.refresh(new_category)
places = [] places = []
for place in data.get("places", []): for place in data.get("places", []):