import sqlmodel
from sqlalchemy.future import Engine
from . import models
def purge_accounts(engine: Engine, user_id: int) -> None:
statement = sqlmodel.delete(models.Account).where(models.Account.user_id == user_id)
with sqlmodel.Session(engine) as session:
session.exec(statement)
session.commit()
def delete_master_pass(engine: Engine, user_id: int) -> None:
statement = sqlmodel.delete(models.MasterPass).where(
models.MasterPass.user_id == user_id
)
def delete_account(engine: Engine, user_id: int, name: str) -> None:
statement = sqlmodel.delete(models.Account).where(
models.Account.user_id == user_id and models.Account.name == name