🐛 Fix import for categories
This commit is contained in:
parent
7b597e2a35
commit
fe08fa3a2f
@ -1 +1 @@
|
|||||||
__version__ = "1.8.0"
|
__version__ = "1.8.1"
|
||||||
|
|||||||
@ -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", []):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user