From 41cb7ae14fb68a28da68dcf951851ec4b0554738 Mon Sep 17 00:00:00 2001 From: Oscar Krause Date: Wed, 4 Jan 2023 09:52:51 +0100 Subject: [PATCH] implemented delete origin endpoint for frontend --- app/orm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/orm.py b/app/orm.py index 063c12d..0f1fdfe 100644 --- a/app/orm.py +++ b/app/orm.py @@ -56,12 +56,12 @@ class Origin(Base): session.close() @staticmethod - def delete(engine: Engine, origins: ["Origin"] = None) -> int: + def delete(engine: Engine, origin_ref: str = None) -> int: session = sessionmaker(bind=engine)() - if origins is None: + if origin_ref is None: deletions = session.query(Origin).delete() else: - deletions = session.query(Origin).filter(Origin.origin_ref in origins).delete() + deletions = session.query(Origin).filter(Origin.origin_ref == origin_ref).delete() session.commit() session.close() return deletions