mirror of
https://git.collinwebdesigns.de/oscar.krause/fastapi-dls.git
synced 2024-11-23 23:41:06 +03:00
fixed Origin.delete()
This commit is contained in:
parent
bed24b56ce
commit
f7ef8d76b6
@ -57,12 +57,12 @@ class Origin(Base):
|
||||
session.close()
|
||||
|
||||
@staticmethod
|
||||
def delete(engine: Engine, origins: ["Origin"] = None) -> int:
|
||||
def delete(engine: Engine, origin_refs: [str] = None) -> int:
|
||||
session = sessionmaker(bind=engine)()
|
||||
if origins is None:
|
||||
if origin_refs 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 in origin_refs).delete()
|
||||
session.commit()
|
||||
session.close()
|
||||
return deletions
|
||||
|
Loading…
Reference in New Issue
Block a user