fix: device creation

This commit is contained in:
Jörn-Michael Miehe 2022-03-31 16:48:52 +00:00
parent 008f0b2cf6
commit a88168b8d4

View file

@ -36,9 +36,13 @@ 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=current_user,
owner=owner,
device=device,
)