mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 06:23:34 -07:00
format
This commit is contained in:
parent
e5d5c28f71
commit
e183dd1dcd
2 changed files with 9 additions and 4 deletions
|
@ -47,8 +47,10 @@ class UserLockedOut(Exception): ...
|
||||||
|
|
||||||
class MissingClaimException(Exception): ...
|
class MissingClaimException(Exception): ...
|
||||||
|
|
||||||
|
|
||||||
class IncompleteData(Exception):
|
class IncompleteData(Exception):
|
||||||
"""
|
"""
|
||||||
This exception is raised when a user sends incomplete data to the API
|
This exception is raised when a user sends incomplete data to the API
|
||||||
"""
|
"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -86,7 +86,10 @@ class RecipeController(BaseRecipeController):
|
||||||
raise HTTPException(status_code=404, detail=ErrorResponse.respond(message="No Entry Found"))
|
raise HTTPException(status_code=404, detail=ErrorResponse.respond(message="No Entry Found"))
|
||||||
elif thrownType == exceptions.IncompleteData:
|
elif thrownType == exceptions.IncompleteData:
|
||||||
self.logger.error("Incomplete data provided to API route")
|
self.logger.error("Incomplete data provided to API route")
|
||||||
raise HTTPException(status_code=400, detail=ErrorResponse.respond(message="Some data were missing on the body of this API request"))
|
raise HTTPException(
|
||||||
|
status_code=400,
|
||||||
|
detail=ErrorResponse.respond(message="Some data were missing on the body of this API request"),
|
||||||
|
)
|
||||||
elif thrownType == sqlalchemy.exc.IntegrityError:
|
elif thrownType == sqlalchemy.exc.IntegrityError:
|
||||||
self.logger.error("SQL Integrity Error on recipe controller action")
|
self.logger.error("SQL Integrity Error on recipe controller action")
|
||||||
raise HTTPException(status_code=400, detail=ErrorResponse.respond(message="Recipe already exists"))
|
raise HTTPException(status_code=400, detail=ErrorResponse.respond(message="Recipe already exists"))
|
||||||
|
@ -364,11 +367,11 @@ class RecipeController(BaseRecipeController):
|
||||||
@router.put("/{slug}")
|
@router.put("/{slug}")
|
||||||
def update_one(self, slug: str, data: Recipe):
|
def update_one(self, slug: str, data: Recipe):
|
||||||
"""
|
"""
|
||||||
Updates a recipe by existing slug and data.
|
Updates a recipe by existing slug and data.
|
||||||
|
|
||||||
Requires all the fields of the recipe to be passed in the body
|
Requires all the fields of the recipe to be passed in the body
|
||||||
|
|
||||||
If you wish to update parts of the recipe only, use a PATCH request to this route
|
If you wish to update parts of the recipe only, use a PATCH request to this route
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
recipe = self.service.update_one(slug, data, strict=True)
|
recipe = self.service.update_one(slug, data, strict=True)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue