Refactor/recipe routes (#370)

* format with black

* black format

* flake8

* remove bar exceptions

* remove test for depreciated route

* recipe settings editr

* add sqlite

Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
Hayden
2021-04-29 21:46:27 -08:00
committed by GitHub
parent 5dafe8fbb5
commit 1dc051f562
38 changed files with 179 additions and 224 deletions

View File

@@ -39,8 +39,8 @@ async def create_group(
try:
db.groups.create(session, group_data.dict())
except:
raise HTTPException( status.HTTP_400_BAD_REQUEST )
except Exception:
raise HTTPException(status.HTTP_400_BAD_REQUEST)
@router.put("/{id}")
@@ -61,23 +61,14 @@ async def delete_user_group(
""" Removes a user group from the database """
if id == 1:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail='DEFAULT_GROUP'
)
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="DEFAULT_GROUP")
group: GroupInDB = db.groups.get(session, id)
if not group:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail='GROUP_NOT_FOUND'
)
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="GROUP_NOT_FOUND")
if not group.users == []:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail='GROUP_WITH_USERS'
)
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="GROUP_WITH_USERS")
db.groups.delete(session, id)