mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 06:23:34 -07:00
Better API feedback
This commit is contained in:
parent
f192dd0c73
commit
b9a63e59b7
2 changed files with 9 additions and 3 deletions
|
@ -28,7 +28,7 @@ def create_meal_plan(
|
|||
):
|
||||
""" Creates a meal plan database entry """
|
||||
processed_plan = process_meals(session, data)
|
||||
db.meals.create(session, processed_plan.dict())
|
||||
return db.meals.create(session, processed_plan.dict())
|
||||
|
||||
|
||||
@router.put("/{plan_id}")
|
||||
|
|
|
@ -35,7 +35,10 @@ async def create_recipe_category(
|
|||
):
|
||||
""" Creates a Category in the database """
|
||||
|
||||
return db.categories.create(session, category.dict())
|
||||
try:
|
||||
return db.categories.create(session, category.dict())
|
||||
except:
|
||||
raise HTTPException( status.HTTP_400_BAD_REQUEST )
|
||||
|
||||
|
||||
@router.put("/{category}", response_model=RecipeCategoryResponse)
|
||||
|
@ -47,7 +50,10 @@ async def update_recipe_category(
|
|||
):
|
||||
""" Updates an existing Tag in the database """
|
||||
|
||||
return db.categories.update(session, category, new_category.dict())
|
||||
try:
|
||||
return db.categories.update(session, category, new_category.dict())
|
||||
except:
|
||||
raise HTTPException( status.HTTP_400_BAD_REQUEST )
|
||||
|
||||
|
||||
@router.delete("/{category}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue