Compare commits

..

No commits in common. "583d1de06ac5c1f38ed9a33ec6a7a2e0f6cf72b2" and "008f0b2cf6235ad8dfd9d57b8d92e36efc2dff97" have entirely different histories.

2 changed files with 3 additions and 6 deletions

View file

@ -36,7 +36,7 @@ class Responses:
"content": None,
}
NEEDS_PERMISSION = {
"description": "Operation not permitted",
"description": "You're not allowed that operation",
"content": None,
}
ENTRY_EXISTS = {

View file

@ -36,13 +36,9 @@ async def add_device(
if not current_user.can_create(Device, owner):
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN)
# fail if owner doesn't exist
if owner is None:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND)
# create the new device
new_device = Device.create(
owner=owner,
owner=current_user,
device=device,
)
@ -61,6 +57,7 @@ async def add_device(
status.HTTP_400_BAD_REQUEST: Responses.NOT_INSTALLED,
status.HTTP_401_UNAUTHORIZED: Responses.NEEDS_USER,
status.HTTP_403_FORBIDDEN: Responses.NEEDS_PERMISSION,
status.HTTP_404_NOT_FOUND: Responses.ENTRY_DOESNT_EXIST,
},
response_model=User,
)