crud: fix open door command db commit

Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
HeshamTB 2022-04-18 01:48:44 +03:00
parent 34f27c32e8
commit f5d7db5071

View File

@ -65,5 +65,7 @@ def create_user_link_to_iot(db: Session, user_id: int, iot_dev_id: int):
def set_open_door_request(db: Session, iot_entity_id: int):
device = get_iot_entity(db, iot_entity_id)
setattr(device, "open_request", True)
db.add(device)
db.commit()
db.refresh(device)
return True