From 3a6a1ccefdcf55cd58ea14edb4b42e8486300a05 Mon Sep 17 00:00:00 2001 From: HeshamTB Date: Mon, 6 Jun 2022 16:33:02 +0300 Subject: [PATCH] sql_app: db: Changed incorrect variable name Signed-off-by: HeshamTB --- sql_app/crud.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sql_app/crud.py b/sql_app/crud.py index a301b0d..60bb4b5 100644 --- a/sql_app/crud.py +++ b/sql_app/crud.py @@ -82,7 +82,10 @@ def create_user_link_to_iot(db: Session, user_id: int, iot_dev_id: int): def remove_user_link_to_iot(db: Session, user_id: int, iot_dev_id: int): # Ensure link is not already present and it does not allow duplicates - link = db.query(models.UserAuthToIoTDev).filter(models.UserAuthToIoTDev.user_id == user_id).filter(models.UserAuthToIoTDev.iot_entity_id == iot_dev_id).first() + link = (db.query(models.UserAuthToIoTDev) + .filter(models.UserAuthToIoTDev.user_id == user_id) + .filter(models.UserAuthToIoTDev.iot_id == iot_dev_id) + .first()) if not link: return True db.delete(link) db.flush()