fix: device creation
This commit is contained in:
parent
008f0b2cf6
commit
a88168b8d4
1 changed files with 5 additions and 1 deletions
|
@ -36,9 +36,13 @@ async def add_device(
|
||||||
if not current_user.can_create(Device, owner):
|
if not current_user.can_create(Device, owner):
|
||||||
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN)
|
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
|
# create the new device
|
||||||
new_device = Device.create(
|
new_device = Device.create(
|
||||||
owner=current_user,
|
owner=owner,
|
||||||
device=device,
|
device=device,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue